Advertisement
AlexejK

WQ Tracker Patched for lag

Jun 25th, 2017
2,337
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 366.92 KB | None | 0 0
  1.  
  2. --details! framework
  3. local DF = _G ["DetailsFramework"]
  4. if (not DF) then
  5. print ("|cFFFFAA00World Quest Tracker: framework not found, if you just installed or updated the addon, please restart your client.|r")
  6. return
  7. end
  8.  
  9. local L = LibStub ("AceLocale-3.0"):GetLocale ("WorldQuestTrackerAddon", true)
  10. if (not L) then
  11. print ("|cFFFFAA00World Quest Tracker|r: Reopen your client to finish updating the addon.|r")
  12. print ("|cFFFFAA00World Quest Tracker|r: Reopen your client to finish updating the addon.|r")
  13. print ("|cFFFFAA00World Quest Tracker|r: Reopen your client to finish updating the addon.|r")
  14. return
  15. end
  16.  
  17. if (true) then
  18. --return - nah, not today
  19. end
  20.  
  21. -- 219978
  22. -- /run SetSuperTrackedQuestID(44033);
  23. -- TaskPOI_OnClick
  24.  
  25. do
  26. --register things we'll use
  27. local color = OBJECTIVE_TRACKER_COLOR ["Header"]
  28. DF:NewColor ("WQT_QUESTTITLE_INMAP", color.r, color.g, color.b, .8)
  29. DF:NewColor ("WQT_QUESTTITLE_OUTMAP", 1, .8, .2, .7)
  30. DF:NewColor ("WQT_QUESTZONE_INMAP", 1, 1, 1, 1)
  31. DF:NewColor ("WQT_QUESTZONE_OUTMAP", 1, 1, 1, .7)
  32. DF:NewColor ("WQT_ORANGE_ON_ENTER", 1, 0.847059, 0, 1)
  33. DF:NewColor ("WQT_ORANGE_RESOURCES_AVAILABLE", 1, .7, .2, .85)
  34.  
  35. DF:InstallTemplate ("font", "WQT_SUMMARY_TITLE", {color = "orange", size = 12, font = "Friz Quadrata TT"})
  36. DF:InstallTemplate ("font", "WQT_RESOURCES_AVAILABLE", {color = {1, .7, .2, .85}, size = 10, font = "Friz Quadrata TT"})
  37. end
  38.  
  39. local GameCooltip = GameCooltip2
  40. local Saturate = Saturate
  41. local floor = floor
  42. local ceil = ceil
  43. local ipairs = ipairs
  44. local GetItemInfo = GetItemInfo
  45. local p = math.pi/2
  46. local pi = math.pi
  47. local pipi = math.pi*2
  48. local GetPlayerFacing = GetPlayerFacing
  49. local GetPlayerMapPosition = GetPlayerMapPosition
  50. local GetCurrentMapZone = GetCurrentMapZone
  51. local GetQuestsForPlayerByMapID = C_TaskQuest.GetQuestsForPlayerByMapID
  52. local HaveQuestData = HaveQuestData
  53. local QuestMapFrame_IsQuestWorldQuest = QuestMapFrame_IsQuestWorldQuest or QuestUtils_IsQuestWorldQuest
  54. local GetNumQuestLogRewardCurrencies = GetNumQuestLogRewardCurrencies
  55. local GetQuestLogRewardInfo = GetQuestLogRewardInfo
  56. local GetQuestLogRewardCurrencyInfo = GetQuestLogRewardCurrencyInfo
  57. local GetQuestLogRewardMoney = GetQuestLogRewardMoney
  58. --local GetQuestLogIndexByID = GetQuestLogIndexByID
  59. local GetQuestTagInfo = GetQuestTagInfo
  60. local GetNumQuestLogRewards = GetNumQuestLogRewards
  61. local GetQuestInfoByQuestID = C_TaskQuest.GetQuestInfoByQuestID
  62. --local LE_WORLD_QUEST_QUALITY_COMMON = LE_WORLD_QUEST_QUALITY_COMMON
  63. --local LE_WORLD_QUEST_QUALITY_RARE = LE_WORLD_QUEST_QUALITY_RARE
  64. --local LE_WORLD_QUEST_QUALITY_EPIC = LE_WORLD_QUEST_QUALITY_EPIC
  65. local GetQuestTimeLeftMinutes = C_TaskQuest.GetQuestTimeLeftMinutes
  66.  
  67. local MapRangeClamped = DF.MapRangeClamped
  68. local FindLookAtRotation = DF.FindLookAtRotation
  69. local GetDistance_Point = DF.GetDistance_Point
  70.  
  71. --importing FindLookAtRotation
  72. if (not FindLookAtRotation) then
  73. FindLookAtRotation = function (_, x1, y1, x2, y2)
  74. return atan2 (y2 - y1, x2 - x1) + pi
  75. end
  76. end
  77.  
  78. local WQT_QUESTTYPE_MAX = 9
  79. local WQT_QUESTTYPE_GOLD = "gold"
  80. local WQT_QUESTTYPE_RESOURCE = "resource"
  81. local WQT_QUESTTYPE_APOWER = "apower"
  82. local WQT_QUESTTYPE_EQUIPMENT = "equipment"
  83. local WQT_QUESTTYPE_TRADE = "trade"
  84. local WQT_QUESTTYPE_DUNGEON = "dungeon"
  85. local WQT_QUESTTYPE_PROFESSION = "profession"
  86. local WQT_QUESTTYPE_PVP = "pvp"
  87. local WQT_QUESTTYPE_PETBATTLE = "petbattle"
  88.  
  89. local FILTER_TO_QUEST_TYPE ={
  90. pet_battles = WQT_QUESTTYPE_PETBATTLE,
  91. pvp = WQT_QUESTTYPE_PVP,
  92. profession = WQT_QUESTTYPE_PROFESSION,
  93. dungeon = WQT_QUESTTYPE_DUNGEON,
  94. gold = WQT_QUESTTYPE_GOLD,
  95. artifact_power = WQT_QUESTTYPE_APOWER,
  96. garrison_resource = WQT_QUESTTYPE_RESOURCE,
  97. equipment = WQT_QUESTTYPE_EQUIPMENT,
  98. trade_skill = WQT_QUESTTYPE_TRADE,
  99. }
  100. local QUEST_TYPE_TO_FILTER = {
  101. [WQT_QUESTTYPE_GOLD] = "gold",
  102. [WQT_QUESTTYPE_RESOURCE] = "garrison_resource",
  103. [WQT_QUESTTYPE_APOWER] = "artifact_power",
  104. [WQT_QUESTTYPE_EQUIPMENT] = "equipment",
  105. [WQT_QUESTTYPE_TRADE] = "trade_skill",
  106. [WQT_QUESTTYPE_DUNGEON] = "dungeon",
  107. [WQT_QUESTTYPE_PROFESSION] = "profession",
  108. [WQT_QUESTTYPE_PVP] = "pvp",
  109. [WQT_QUESTTYPE_PETBATTLE] = "pet_battles",
  110. }
  111.  
  112. local WQT_QUERYTYPE_REWARD = "reward"
  113. local WQT_QUERYTYPE_QUEST = "quest"
  114. local WQT_QUERYTYPE_PERIOD = "period"
  115. local WQT_QUERYDB_ACCOUNT = "global"
  116. local WQT_QUERYDB_LOCAL = "character"
  117. local WQT_REWARD_RESOURCE = "resource"
  118. local WQT_REWARD_GOLD = "gold"
  119. local WQT_REWARD_APOWER = "artifact"
  120. local WQT_QUESTS_TOTAL = "total"
  121. local WQT_QUESTS_PERIOD = "quest"
  122. local WQT_DATE_TODAY = 1
  123. local WQT_DATE_YESTERDAY = 2
  124. local WQT_DATE_1WEEK = 3
  125. local WQT_DATE_2WEEK = 4
  126. local WQT_DATE_MONTH = 5
  127.  
  128. --219978
  129. --world of quets IsQuestFlaggedCompleted (WORLD_QUESTS_AVAILABLE_QUEST_ID) - colocar junto com o level do personagem
  130.  
  131. local _
  132. local default_config = {
  133. profile = {
  134. filters = {
  135. pet_battles = true,
  136. pvp = true,
  137. profession = true,
  138. dungeon = true,
  139. gold = true,
  140. artifact_power = true,
  141. garrison_resource = true,
  142. equipment = true,
  143. trade_skill = true,
  144. },
  145. disable_world_map_widgets = false,
  146. worldmap_widgets = {
  147. textsize = 9,
  148. scale = 1,
  149. },
  150. zonemap_widgets = {
  151. scale = 1,
  152. },
  153. filter_always_show_faction_objectives = true,
  154. filter_force_show_brokenshore = true,
  155. sort_order = {
  156. [WQT_QUESTTYPE_TRADE] = 9,
  157. [WQT_QUESTTYPE_APOWER] = 8,
  158. [WQT_QUESTTYPE_GOLD] = 6,
  159. [WQT_QUESTTYPE_RESOURCE] = 7,
  160. [WQT_QUESTTYPE_EQUIPMENT] = 5,
  161. [WQT_QUESTTYPE_DUNGEON] = 4,
  162. [WQT_QUESTTYPE_PROFESSION] = 3,
  163. [WQT_QUESTTYPE_PVP] = 2,
  164. [WQT_QUESTTYPE_PETBATTLE] = 1,
  165. },
  166. sort_time_priority = false,
  167. force_sort_by_timeleft = false,
  168. alpha_time_priority = true,
  169. show_timeleft = false,
  170. quests_tracked = {},
  171. quests_all_characters = {},
  172. syntheticMapIdList = {
  173. [1015] = 1, --azsuna
  174. [1018] = 2, --valsharah
  175. [1024] = 3, --highmountain
  176. [1017] = 4, --stormheim
  177. [1033] = 5, --suramar
  178. [1096] = 6, --eye of azshara
  179. },
  180. taxy_showquests = true,
  181. taxy_trackedonly = false,
  182. taxy_tracked_scale = 3,
  183. arrow_update_frequence = 0.016,
  184. map_lock = false,
  185. enable_doubletap = false,
  186. sound_enabled = true,
  187. use_tracker = true,
  188. tracker_is_movable = false,
  189. tracker_is_locked = false,
  190. tracker_only_currentmap = false,
  191. tracker_scale = 1,
  192. tracker_show_time = false,
  193. use_quest_summary = false,
  194. zone_only_tracked = false,
  195. bar_anchor = "bottom",
  196. use_old_icons = false,
  197. history = {
  198. reward = {
  199. global = {},
  200. character = {},
  201. },
  202. quest = {
  203. global = {},
  204. character = {},
  205. },
  206. period = {
  207. global = {},
  208. character = {},
  209. },
  210. },
  211. show_yards_distance = true,
  212. player_names = {},
  213. tomtom = {
  214. enabled = false,
  215. uids = {},
  216. persistent = true,
  217. },
  218. },
  219. }
  220.  
  221. local azsuna_mapId = 1015
  222. local highmountain_mapId = 1024
  223. local stormheim_mapId = 1017
  224. local suramar_mapId = 1033
  225. local valsharah_mapId = 1018
  226. local eoa_mapId = 1096
  227.  
  228. local is_broken_isles_map = {
  229. [azsuna_mapId] = true,
  230. [highmountain_mapId] = true,
  231. [stormheim_mapId] = true,
  232. [suramar_mapId] = true,
  233. [valsharah_mapId] = true,
  234. [eoa_mapId] = true,
  235. [1014] = true, --dalaran
  236. [1021] = true, --broken shore
  237. }
  238.  
  239. local WORLDMAP_SQUARE_SIZE = 24
  240. local WORLDMAP_SQUARE_TIMEBLIP_SIZE = 14
  241.  
  242. local QUESTTYPE_GOLD = 0x1
  243. local QUESTTYPE_RESOURCE = 0x2
  244. local QUESTTYPE_ITEM = 0x4
  245. local QUESTTYPE_ARTIFACTPOWER = 0x8
  246.  
  247. local FILTER_TYPE_PET_BATTLES = "pet_battles"
  248. local FILTER_TYPE_PVP = "pvp"
  249. local FILTER_TYPE_PROFESSION = "profession"
  250. local FILTER_TYPE_DUNGEON = "dungeon"
  251. local FILTER_TYPE_GOLD = "gold"
  252. local FILTER_TYPE_ARTIFACT_POWER = "artifact_power"
  253. local FILTER_TYPE_GARRISON_RESOURCE = "garrison_resource"
  254. local FILTER_TYPE_EQUIPMENT = "equipment"
  255. local FILTER_TYPE_TRADESKILL = "trade_skill"
  256.  
  257. local WQT_QUEST_NAMES_AND_ICONS = {
  258. [WQT_QUESTTYPE_APOWER] = {name = L["S_QUESTTYPE_ARTIFACTPOWER"], icon = [[Interface\AddOns\WorldQuestTracker\media\icon_artifactpower_red_roundT]], coords = {0, 1, 0, 1}},
  259. [WQT_QUESTTYPE_GOLD] = {name = L["S_QUESTTYPE_GOLD"], icon = [[Interface\GossipFrame\auctioneerGossipIcon]], coords = {0, 1, 0, 1}},
  260. [WQT_QUESTTYPE_RESOURCE] = {name = L["S_QUESTTYPE_RESOURCE"], icon = [[Interface\AddOns\WorldQuestTracker\media\resource_iconT]], coords = {0, 1, 0, 1}},
  261. [WQT_QUESTTYPE_EQUIPMENT] = {name = L["S_QUESTTYPE_EQUIPMENT"], icon = [[Interface\PaperDollInfoFrame\UI-EquipmentManager-Toggle]], coords = {0, 1, 0, 1}},
  262. --[WQT_QUESTTYPE_EQUIPMENT] = {name = "Equipment", icon = [[Interface\PaperDollInfoFrame\PaperDollSidebarTabs]], coords = {4/64, 32/64, 122/256, 155/256}},
  263. [WQT_QUESTTYPE_DUNGEON] = {name = L["S_QUESTTYPE_DUNGEON"], icon = [[Interface\TARGETINGFRAME\Nameplates]], coords = {41/256, 0/256, 42/128, 80/128}},
  264. [WQT_QUESTTYPE_PROFESSION] = {name = L["S_QUESTTYPE_PROFESSION"], icon = [[Interface\MINIMAP\TRACKING\Profession]], coords = {2/32, 30/32, 2/32, 30/32}},
  265. --[WQT_QUESTTYPE_PROFESSION] = {name = "Profession", icon = [[Interface\Garrison\MobileAppIcons]], coords = {256/1024, 384/1024, 0/1024, 128/1024}},
  266. --[WQT_QUESTTYPE_PVP] = {name = "PvP", icon = [[Interface\PVPFrame\Icon-Combat]], coords = {0, 1, 0, 1}},
  267. [WQT_QUESTTYPE_PVP] = {name = L["S_QUESTTYPE_PVP"], icon = [[Interface\QUESTFRAME\QuestTypeIcons]], coords = {37/128, 53/128, 19/64, 36/64}},
  268. [WQT_QUESTTYPE_PETBATTLE] = {name = L["S_QUESTTYPE_PETBATTLE"], icon = [[Interface\MINIMAP\ObjectIconsAtlas]], coords = {172/512, 201/512, 270/512, 301/512}},
  269. [WQT_QUESTTYPE_TRADE] = {name = L["S_QUESTTYPE_TRADESKILL"], icon = [[Interface\ICONS\INV_Blood of Sargeras]], coords = {5/64, 59/64, 5/64, 59/64}},
  270. }
  271.  
  272. local WQT_GENERAL_STRINGS_AND_ICONS = {
  273. ["criteria"] = {name = "criteria", icon = [[Interface\AdventureMap\AdventureMap]], coords = {901/1024, 924/1024, 251/1024, 288/1024}}
  274. }
  275.  
  276. local calcPerformance = CreateFrame ("frame")
  277. calcPerformance.timeTable = {}
  278. local measurePerformance = function (self, deltaTime)
  279. if (self.DumpTime) then
  280. self.DumpTime = self.DumpTime + 1
  281. if (self.DumpTime == 8) then
  282. for i = 1, #self.timeTable do
  283. local v = self.timeTable [i]
  284. if (v > .02) then
  285. print ("Load Time:", v, "seconds.")
  286. end
  287. end
  288. self.DumpTime = nil
  289. end
  290. end
  291. self.LatestTick = GetTime()
  292. tinsert (self.timeTable, 1, deltaTime)
  293. tremove (self.timeTable, 15)
  294. end
  295. --calcPerformance:SetScript ("OnUpdate", measurePerformance) -- remove this comment to enable the load time display
  296.  
  297. local TQueue = CreateFrame ("frame")
  298. TQueue.queue = {}
  299. local throttle = function (self, deltaTime)
  300. for i = 1, 10 do
  301. local t = tremove (self.queue, 1)
  302. if (t) then
  303. local widget, file, coords, color = unpack (t)
  304. widget:Show()
  305. if (widget:GetObjectType() == "texture") then
  306. if (file) then
  307. widget:SetTexture (file)
  308. end
  309. if (coords) then
  310. widget:SetTexCoord (unpack (coords))
  311. end
  312. if (color) then
  313. widget:SetVertexColor (unpack (color))
  314. end
  315. else
  316. if (widget.fadeInAnimation) then
  317. --widget.fadeInAnimation:Play()
  318. end
  319. end
  320. else
  321. TQueue:SetScript ("OnUpdate", nil)
  322. end
  323. end
  324. end
  325. function TQueue:AddToQueue (texture, file, coords, color)
  326. tinsert (TQueue.queue, {texture, file, coords, color})
  327. if (not TQueue.Running) then
  328. TQueue:SetScript ("OnUpdate", throttle)
  329. end
  330. end
  331.  
  332. local BROKEN_ISLES_ZONES = {
  333. [azsuna_mapId] = true, --azsuna
  334. [valsharah_mapId] = true, --valsharah
  335. [highmountain_mapId] = true, --highmountain
  336. [stormheim_mapId] = true, --stormheim
  337. [suramar_mapId] = true, --suramar
  338. [eoa_mapId] = true, --eye of azshara
  339.  
  340. [1014] = true, --dalaran
  341. [1021] = true, --broken shore
  342. }
  343.  
  344. local WorldQuestTracker = DF:CreateAddOn ("WorldQuestTrackerAddon", "WQTrackerDB", default_config)
  345. WorldQuestTracker.QuestTrackList = {} --place holder until OnInit is triggered
  346. WorldQuestTracker.AllTaskPOIs = {}
  347. WorldQuestTracker.JustAddedToTracker = {}
  348. WorldQuestTracker.Cache_ShownQuestOnWorldMap = {}
  349. WorldQuestTracker.Cache_ShownQuestOnZoneMap = {}
  350. WorldQuestTracker.Cache_ShownWidgetsOnZoneMap = {}
  351. WorldQuestTracker.WorldMapSupportWidgets = {}
  352. WorldQuestTracker.PartyQuestsPool = {}
  353. WorldQuestTracker.PartySharedQuests = {}
  354. WorldQuestTracker.CurrentMapID = 0
  355. WorldQuestTracker.LastWorldMapClick = 0
  356. WorldQuestTracker.MapSeason = 0
  357. WorldQuestTracker.MapOpenedAt = 0
  358. WorldQuestTracker.QueuedRefresh = 1
  359. WorldQuestTracker.WorldQuestButton_Click = 0
  360. WorldQuestTracker.Temp_HideZoneWidgets = 0
  361. WorldQuestTracker.lastZoneWidgetsUpdate = 0
  362. WorldQuestTracker.lastMapTap = 0
  363. WorldQuestTracker.SoundPitch = math.random (2)
  364. WorldQuestTracker.RarityColors = {
  365. [3] = "|cff2292FF",
  366. [4] = "|cffc557FF",
  367. }
  368. WorldQuestTracker.GameLocale = GetLocale()
  369.  
  370. local LibWindow = LibStub ("LibWindow-1.1")
  371. if (not LibWindow) then
  372. print ("|cFFFFAA00World Quest Tracker|r: libwindow not found, did you just updated the addon? try reopening the client.|r")
  373. end
  374.  
  375. WorldQuestTracker.MAPID_DALARAN = 1014
  376. local MAPID_BROKENISLES = 1007
  377. local ARROW_UPDATE_FREQUENCE = 0.016
  378.  
  379. WorldQuestTracker.QUEST_COMMENTS = {
  380. [42275] = {help = "'Dimensional Anchors' are green crystals on the second floor of the central build."}, --azsuna - not on my watch
  381. [43963] = {help = "Kill and loot mobs around the quest location."},
  382. [42108] = {help = "Use the extra button near friendly ghosty npcs."},
  383. [42080] = {help = "Select eagles and use the extra button. Click on sheeps outside the town."},
  384. [41701] = {help = "Kill fish inside the water. Walk on outlined garbage."},
  385. }
  386.  
  387. WorldQuestTracker.CAVE_QUESTS = {
  388. [41145] = true,
  389. }
  390.  
  391. function WorldQuestTracker.CanLinkToChat (object, button)
  392. if (button == "LeftButton") then
  393. if (IsShiftKeyDown()) then
  394.  
  395. local questID = (object.questID) or (object.info and object.info.questID)
  396.  
  397. if (questID) then
  398. local questName = GetQuestInfoByQuestID (questID)
  399. local link = [=[|cffffff00|Hquest:@QUESTID:110|h[@QUESTNAME]|h|r]=]
  400. link = link:gsub ("@QUESTID", questID)
  401. link = link:gsub ("@QUESTNAME", questName)
  402.  
  403. return ChatEdit_InsertLink (link)
  404. --print ("|cffffff00|Hquest:41145:110|h[Water of Life]|h|r")
  405. --SendChatMessage("|cffffff00|Hquest:41145:110|h[Water of Life]|h|r", "SAY", "Common")
  406. --SendChatMessage("|cffffff00|Hquest:40883:110|h[Fate of the Guard]|h|r", "SAY", "Common");
  407. end
  408. end
  409. end
  410. end
  411.  
  412. --debug
  413. function WorldQuestTracker.DumpTrackingList()
  414. local t = WorldQuestTracker.table.dump (WorldQuestTracker.QuestTrackList)
  415. print (t)
  416. end
  417.  
  418. hooksecurefunc ("TaskPOI_OnEnter", function (self)
  419. --WorldMapTooltip:AddLine ("quest ID: " .. self.questID)
  420. --print (self.questID)
  421. WorldQuestTracker.CurrentHoverQuest = self.questID
  422. end)
  423. hooksecurefunc ("TaskPOI_OnLeave", function (self)
  424. WorldQuestTracker.CurrentHoverQuest = nil
  425. end)
  426. --enddebug
  427.  
  428. local all_widgets = {}
  429. local extra_widgets = {}
  430. local faction_frames = {}
  431.  
  432. local azsuna_widgets = {}
  433. local highmountain_widgets = {}
  434. local stormheim_widgets = {}
  435. local suramar_widgets = {}
  436. local valsharah_widgets = {}
  437. local eoa_widgets = {}
  438. local WorldWidgetPool = {}
  439.  
  440. ----------------------------------------------------------------------------------------------------------------------------------------------------------------
  441. --> initialize the addon
  442.  
  443. local reGetTrackerList = function()
  444. C_Timer.After (.2, WorldQuestTracker.GetTrackedQuestsOnDB)
  445. end
  446. function WorldQuestTracker.GetTrackedQuestsOnDB()
  447. local GUID = UnitGUID ("player")
  448. if (not GUID) then
  449. reGetTrackerList()
  450. WorldQuestTracker.QuestTrackList = {}
  451. return
  452. end
  453. local questList = WorldQuestTracker.db.profile.quests_tracked [GUID]
  454. if (not questList) then
  455. questList = {}
  456. WorldQuestTracker.db.profile.quests_tracked [GUID] = questList
  457. end
  458. WorldQuestTracker.QuestTrackList = questList
  459.  
  460. --> faz o cliente carregar as quests antes de realmente verificar o tepo restante
  461. C_Timer.After (3, WorldQuestTracker.CheckTimeLeftOnQuestsFromTracker_Load)
  462. C_Timer.After (4, WorldQuestTracker.CheckTimeLeftOnQuestsFromTracker_Load)
  463. C_Timer.After (6, WorldQuestTracker.CheckTimeLeftOnQuestsFromTracker_Load)
  464. C_Timer.After (10, WorldQuestTracker.CheckTimeLeftOnQuestsFromTracker)
  465.  
  466. WorldQuestTracker.RefreshTrackerWidgets()
  467. end
  468. function WorldQuestTracker.GetTrackedQuests()
  469. return WorldQuestTracker.QuestTrackList
  470. end
  471.  
  472. function WorldQuestTracker:UpdateCurrentStandingZone()
  473. if (WorldMapFrame:IsShown()) then
  474. return
  475. end
  476.  
  477. if (WorldQuestTracker.ScheduledMapFrameShownCheck and not WorldQuestTracker.ScheduledMapFrameShownCheck._cancelled) then
  478. WorldQuestTracker.ScheduledMapFrameShownCheck:Cancel()
  479. end
  480.  
  481. local mapID = GetCurrentMapAreaID()
  482. if (mapID == 1080 or mapID == 1072) then
  483. mapID = 1024
  484. end
  485. WorldMapFrame.currentStandingZone = mapID
  486. WorldQuestTracker:FullTrackerUpdate()
  487. end
  488. function WorldQuestTracker:WaitUntilWorldMapIsClose()
  489. if (WorldQuestTracker.ScheduledMapFrameShownCheck and not WorldQuestTracker.ScheduledMapFrameShownCheck._cancelled) then
  490. WorldQuestTracker.ScheduledMapFrameShownCheck:Cancel()
  491. end
  492. WorldQuestTracker.ScheduledMapFrameShownCheck = C_Timer.NewTicker (1, WorldQuestTracker.UpdateCurrentStandingZone)
  493. end
  494.  
  495. function WorldQuestTracker.UpdateArrowFrequence()
  496. ARROW_UPDATE_FREQUENCE = WorldQuestTracker.db.profile.arrow_update_frequence
  497. end
  498.  
  499. -- See: https://wow.curseforge.com/projects/world-quest-tracker/issues/417
  500. function WorldQuestTracker.SelectSingleQuestInBlizzardWQTracker(questID)
  501. for i = 1, GetNumWorldQuestWatches() do
  502. local watchedWorldQuestID = GetWorldQuestWatchInfo(i);
  503. if (watchedWorldQuestID) then
  504. BonusObjectiveTracker_UntrackWorldQuest(watchedWorldQuestID)
  505. end
  506. end
  507. BonusObjectiveTracker_TrackWorldQuest(questID, true)
  508. SetSuperTrackedQuestID (questID)
  509. end
  510.  
  511. --/run WorldQuestTrackerAddon.db.profile.arrow_update_frequence = .1; WorldQuestTrackerAddon.UpdateArrowFrequence()
  512.  
  513. function WorldQuestTracker.IsPartyQuest (questID)
  514. return WorldQuestTracker.PartySharedQuests [questID]
  515. end
  516.  
  517. -- ~party ~share
  518. local CreatePartySharer = function()
  519.  
  520. local COMM_PREFIX = "WQTC"
  521.  
  522. local CanShareQuests = function()
  523. if (UnitLevel ("player") < 110) then
  524. return
  525. elseif (not IsQuestFlaggedCompleted (WORLD_QUESTS_AVAILABLE_QUEST_ID)) then
  526. return
  527. end
  528. local inInstance = IsInInstance()
  529. if (inInstance) then
  530. return
  531. end
  532. if (IsInRaid() or not IsInGroup (LE_PARTY_CATEGORY_HOME)) then
  533. return
  534. end
  535. if (not LibStub ("AceSerializer-3.0")) then
  536. return
  537. end
  538.  
  539. return true
  540. end
  541.  
  542. local build_shared_quest_list = function (noMapUpdate)
  543. --> conta quantas pessoes tem a mesma quest no grupo
  544. local newList = {}
  545. local playersAmount = 0
  546. for guid, questList in pairs (WorldQuestTracker.PartyQuestsPool) do
  547. playersAmount = playersAmount + 1
  548. for index, questID in ipairs (questList) do
  549. newList [questID] = (newList [questID] or 0) + 1
  550. end
  551. end
  552.  
  553. --> remove as quests que possuem menos gente que o total de pessoas no grupo
  554. local groupMembers = GetNumSubgroupMembers() + 1
  555. for questID, amountPlayers in pairs (newList) do
  556. if (amountPlayers < groupMembers) then
  557. newList [questID] = nil
  558. end
  559. end
  560.  
  561. --> atualiza o container e os widgets
  562. WorldQuestTracker.PartySharedQuests = newList
  563.  
  564. if (not noMapUpdate) then
  565. if (WorldMapFrame and WorldMapFrame:IsShown()) then
  566. if (WorldMapFrame.mapID == 1007 or GetCurrentMapAreaID() == 1007) then
  567. WorldQuestTracker.UpdateWorldQuestsOnWorldMap (false, false) --noCache, showFade, isQuestFlaggedRecheck, forceCriteriaAnimation
  568. else
  569. if (is_broken_isles_map [GetCurrentMapAreaID()]) then
  570. WorldQuestTracker.UpdateZoneWidgets()
  571. end
  572. end
  573. end
  574. end
  575.  
  576. if (WorldQuestTracker.PartyStarIcon) then
  577. --> compara a quantidade de jogadores que j� recebemos os dados com a quantidade de jogadores no grupo
  578. if (CanShareQuests()) then
  579. if (playersAmount == groupMembers) then
  580. WorldQuestTracker.PartyStarIcon:SetTexture ([[Interface\AddOns\WorldQuestTracker\media\icon_party_sharedT]])
  581. WorldQuestTracker.PartyAmountText:SetText (playersAmount .. "/" .. groupMembers)
  582. WorldQuestTracker.PartyAmountText:SetTextColor ("orange")
  583. else
  584. WorldQuestTracker.PartyStarIcon:SetTexture ([[Interface\AddOns\WorldQuestTracker\media\icon_party_shared_badT]])
  585. WorldQuestTracker.PartyAmountText:SetText (playersAmount .. "/" .. groupMembers)
  586. WorldQuestTracker.PartyAmountText:SetTextColor ("orangered")
  587. end
  588. WorldQuestTracker.PartyStarIcon:SetDesaturated (false)
  589. else
  590. WorldQuestTracker.PartyStarIcon:SetDesaturated (true)
  591. WorldQuestTracker.PartyAmountText:SetText (0)
  592. WorldQuestTracker.PartyAmountText:SetTextColor (1, .7, .2, .85)
  593. end
  594. end
  595.  
  596. end
  597.  
  598. WorldQuestTracker.UpdatePartySharedQuests = build_shared_quest_list
  599.  
  600. function WorldQuestTracker:CommReceived (_, data)
  601. local QuestList = {LibStub ("AceSerializer-3.0"):Deserialize (data)}
  602. QuestList = QuestList [2]
  603.  
  604. if (type (QuestList) == "string") then
  605. if (QuestList == "L") then
  606. WorldQuestTracker:GROUP_ROSTER_UPDATE()
  607. return
  608. end
  609. end
  610.  
  611. if (type (QuestList) == "table" and QuestList.GUID) then
  612. local FromWho = QuestList.GUID
  613. QuestList.GUID = nil
  614.  
  615. WorldQuestTracker.PartyQuestsPool [FromWho] = QuestList
  616. build_shared_quest_list()
  617. end
  618. end
  619. WorldQuestTracker:RegisterComm (COMM_PREFIX, "CommReceived")
  620.  
  621. WorldQuestTracker.Sharer_LastSentUpdate = 0
  622. WorldQuestTracker.Sharer_LastTimer = nil --
  623.  
  624.  
  625.  
  626. --> fazendo em uma funcao separada para aplicar um delay antes de envia-las
  627. local SendQuests = function()
  628. if (not CanShareQuests()) then
  629. return
  630. end
  631.  
  632. --> pega a lista de quests
  633. local ActiveQuests = WorldQuestTracker.SavedQuestList_GetList()
  634. local list_to_send = {}
  635.  
  636. --monta a tabela para ser enviada
  637. for questID, expireAt in pairs (ActiveQuests) do
  638. list_to_send [#list_to_send+1] = questID
  639. end
  640.  
  641. list_to_send.GUID = UnitGUID ("player")
  642.  
  643. local data = LibStub ("AceSerializer-3.0"):Serialize (list_to_send)
  644. WorldQuestTracker:SendCommMessage (COMM_PREFIX, data, "PARTY")
  645. end
  646.  
  647. local group_changed = function (loggedIn)
  648. if (CanShareQuests()) then
  649. if (loggedIn) then
  650. --> precisa pedir as quests dos demais membros do grupo
  651. --> pode dar return pois ele vai enviar para si mesmo
  652. local data = LibStub ("AceSerializer-3.0"):Serialize ("L")
  653. WorldQuestTracker:SendCommMessage (COMM_PREFIX, data, "PARTY")
  654. return
  655. end
  656.  
  657. --> manda as quests que nos temos para os membros da party
  658. if (WorldQuestTracker.Sharer_LastSentUpdate+10 < GetTime()) then --ja passou 1 min des do ultimo update
  659. --> manda as quests depois de 1 segundo
  660. C_Timer.After (1, SendQuests)
  661. WorldQuestTracker.Sharer_LastSentUpdate = GetTime()
  662. else
  663. --> se n�o passou ainda os 10 segundos, fazer ele agendar o update
  664. if (WorldQuestTracker.Sharer_LastTimer) then
  665. WorldQuestTracker.Sharer_LastTimer:Cancel()
  666. end
  667. local nextUpdate = (WorldQuestTracker.Sharer_LastSentUpdate + 10) - GetTime()
  668. WorldQuestTracker.Sharer_LastTimer = C_Timer.NewTimer (nextUpdate, SendQuests)
  669. end
  670. end
  671. end
  672.  
  673. function WorldQuestTracker:GROUP_JOINED()
  674. --> � s� quiando o jogador entra no grupo, nao dispara para os demais
  675. WorldQuestTracker.InGroup = true
  676. group_changed()
  677. end
  678. function WorldQuestTracker:GROUP_LEFT()
  679. WorldQuestTracker.InGroup = nil
  680. wipe (WorldQuestTracker.PartySharedQuests)
  681.  
  682. if (WorldMapFrame and WorldMapFrame:IsShown()) then
  683. if (WorldMapFrame.mapID == 1007 or GetCurrentMapAreaID() == 1007) then
  684. WorldQuestTracker.UpdateWorldQuestsOnWorldMap (false, false) --noCache, showFade, isQuestFlaggedRecheck, forceCriteriaAnimation
  685. else
  686. if (is_broken_isles_map [GetCurrentMapAreaID()]) then
  687. WorldQuestTracker.UpdateZoneWidgets()
  688. end
  689. end
  690. end
  691.  
  692. if (WorldQuestTracker.PartyStarIcon) then
  693. WorldQuestTracker.PartyStarIcon:SetDesaturated (true)
  694. WorldQuestTracker.PartyAmountText:SetText (0)
  695. WorldQuestTracker.PartyAmountText:SetTextColor (1, .7, .2, .85)
  696. end
  697. end
  698. function WorldQuestTracker:GROUP_ROSTER_UPDATE()
  699. group_changed()
  700. end
  701.  
  702. WorldQuestTracker:RegisterEvent ("GROUP_JOINED")
  703. WorldQuestTracker:RegisterEvent ("GROUP_LEFT")
  704. WorldQuestTracker:RegisterEvent ("GROUP_ROSTER_UPDATE")
  705.  
  706. group_changed (true)
  707. end
  708.  
  709. -- /run WorldQuestTrackerAddon:GetNextResearchNoteTime()
  710. -- /run for a, b in pairs (_G) do if b == "Artifact Research Notes" then print (a,b) end end
  711.  
  712. --[[ by name?
  713. Artifact Research Notes
  714. Artefaktforschungsnotizen
  715. Notas de investigaci�n de artefactos
  716. Recherches sur les armes prodigieuses
  717. Appunti sulla Ricerca dell'Artefatto
  718. Anota��es de Pesquisa de Artefato
  719. --]]
  720.  
  721. -- 173 shipment ID -- MAGE
  722. -- each class hall has its own containerID for the research
  723. -- /dump C_Garrison.GetLandingPageShipmentInfoByContainerID (173) -- MAGE
  724. -- each
  725. -- ~research
  726.  
  727. -- /run for i=1, 500 do local _,texture,_,_,_,_,_, timeleftString=C_Garrison.GetLandingPageShipmentInfoByContainerID(i) if texture==237446 then print ("achour research, timeleft:", timeleftString) end end
  728.  
  729. function WorldQuestTracker:GetNextResearchNoteTime()
  730. local looseShipments = C_Garrison.GetLooseShipments (LE_GARRISON_TYPE_7_0)
  731. if (looseShipments and #looseShipments > 0) then
  732. for i = 1, #looseShipments do
  733. local name, texture, _, ready, _, creationTime, duration, timeleftString = C_Garrison.GetLandingPageShipmentInfoByContainerID (looseShipments [i])
  734. --print (looseShipments [i], name)
  735. if (name and creationTime and creationTime > 0 and texture == 237446) then
  736. local elapsedTime = time() - creationTime
  737. local timeLeft = duration - elapsedTime
  738. --print ("timeleft: ", timeLeft / 60 / 60)
  739. return name, timeleftString, timeLeft, elapsedTime, ready
  740. --print (name, texture, shipmentCapacity, shipmentsReady, shipmentsTotal, creationTime, duration, timeleftString)
  741. end
  742. end
  743. end
  744. end
  745.  
  746. function WorldQuestTracker:OnInit()
  747. WorldQuestTracker.InitAt = GetTime()
  748. WorldQuestTracker.LastMapID = GetCurrentMapAreaID()
  749. WorldQuestTracker.GetTrackedQuestsOnDB()
  750.  
  751. WorldQuestTracker.CreateLoadingIcon()
  752.  
  753. WQTrackerDBChr = WQTrackerDBChr or {}
  754. WorldQuestTracker.dbChr = WQTrackerDBChr
  755. WorldQuestTracker.dbChr.ActiveQuests = WorldQuestTracker.dbChr.ActiveQuests or {}
  756.  
  757. C_Timer.After (2, function()
  758. if (WorldQuestTracker.db:GetCurrentProfile() ~= "Default") then
  759. WorldQuestTracker.db:SetProfile ("Default")
  760. if (LibWindow) then
  761. if (WorldQuestTracker.db:GetCurrentProfile() == "Default") then
  762. LibWindow.RegisterConfig (WorldQuestTrackerScreenPanel, WorldQuestTracker.db.profile)
  763. if (WorldQuestTracker.db.profile.tracker_is_movable) then
  764. LibWindow.RestorePosition (WorldQuestTrackerScreenPanel)
  765. WorldQuestTrackerScreenPanel.RegisteredForLibWindow = true
  766. end
  767. end
  768. end
  769. end
  770. end)
  771.  
  772. if (LibWindow) then
  773. if (WorldQuestTracker.db:GetCurrentProfile() == "Default") then
  774. LibWindow.RegisterConfig (WorldQuestTrackerScreenPanel, WorldQuestTracker.db.profile)
  775. if (WorldQuestTracker.db.profile.tracker_is_movable) then
  776. LibWindow.RestorePosition (WorldQuestTrackerScreenPanel)
  777. WorldQuestTrackerScreenPanel.RegisteredForLibWindow = true
  778. end
  779. end
  780. end
  781.  
  782. function WorldQuestTracker:CleanUpJustBeforeGoodbye()
  783. WorldQuestTracker.AllCharactersQuests_CleanUp()
  784. end
  785. WorldQuestTracker.db.RegisterCallback (WorldQuestTracker, "OnDatabaseShutdown", "CleanUpJustBeforeGoodbye") --more info at https://www.youtube.com/watch?v=GXFnT4YJLQo
  786.  
  787. --
  788. C_Timer.After (10, CreatePartySharer)
  789. --
  790.  
  791. local save_player_name = function()
  792. local guid = UnitGUID ("player")
  793. local name = UnitName ("player")
  794. local realm = GetRealmName()
  795. if (guid and name and name ~= "" and realm and realm ~= "") then
  796. local playerTable = WorldQuestTracker.db.profile.player_names [guid]
  797. if (not playerTable) then
  798. playerTable = {}
  799. WorldQuestTracker.db.profile.player_names [guid] = playerTable
  800. end
  801. playerTable.name = name
  802. playerTable.realm = realm
  803. playerTable.class = playerTable.class or select (2, UnitClass ("player"))
  804. end
  805. end
  806. C_Timer.After (3, save_player_name)
  807. C_Timer.After (10, save_player_name)
  808.  
  809. local canLoad = IsQuestFlaggedCompleted (WORLD_QUESTS_AVAILABLE_QUEST_ID)
  810.  
  811. local re_ZONE_CHANGED_NEW_AREA = function()
  812. WorldQuestTracker:ZONE_CHANGED_NEW_AREA()
  813. end
  814. function WorldQuestTracker:ZONE_CHANGED_NEW_AREA()
  815. if (IsInInstance()) then
  816. WorldQuestTracker:FullTrackerUpdate()
  817. else
  818. WorldQuestTracker:FullTrackerUpdate()
  819.  
  820. if (WorldMapFrame:IsShown()) then
  821. return WorldQuestTracker:WaitUntilWorldMapIsClose()
  822. else
  823. C_Timer.After (.5, WorldQuestTracker.UpdateCurrentStandingZone)
  824. end
  825. end
  826. end
  827.  
  828. -- ~reward ~questcompleted
  829. local oneday = 60*60*24
  830. local days_amount = {
  831. [WQT_DATE_1WEEK] = 8,
  832. [WQT_DATE_2WEEK] = 15,
  833. [WQT_DATE_MONTH] = 30,
  834. }
  835.  
  836. function WorldQuestTracker.GetDateString (t)
  837. if (t == WQT_DATE_TODAY) then
  838. return date ("%y%m%d")
  839. elseif (t == WQT_DATE_YESTERDAY) then
  840. return date ("%y%m%d", time() - oneday)
  841. elseif (t == WQT_DATE_1WEEK or t == WQT_DATE_2WEEK or t == WQT_DATE_MONTH) then
  842. local days = days_amount [t]
  843. local result = {}
  844. for i = 1, days do
  845. tinsert (result, date ("%y%m%d", time() - (oneday * (i-1) )))
  846. end
  847. return result
  848. else
  849. return t
  850. end
  851. end
  852.  
  853. function WorldQuestTracker.GetCharInfo (guid)
  854. local t = WorldQuestTracker.db.profile.player_names [guid]
  855. if (t) then
  856. return t.name, t.realm, t.class
  857. else
  858. return "Unknown", "Unknown", "PRIEST"
  859. end
  860. end
  861.  
  862. function WorldQuestTracker.QueryHistory (queryType, dbLevel, arg1, arg2, arg3)
  863. local db = WorldQuestTracker.db.profile.history
  864. db = db [queryType]
  865. db = db [dbLevel]
  866.  
  867. if (dbLevel == WQT_QUERYDB_LOCAL) then
  868. db = db [UnitGUID ("player")]
  869. if (not db) then
  870. return
  871. end
  872. end
  873.  
  874. if (not arg1) then
  875. return db
  876. end
  877.  
  878. if (queryType == WQT_QUERYTYPE_REWARD) then
  879. return db [arg1] --arg1 = the reward type (gold, resource, artifact)
  880.  
  881. elseif (queryType == WQT_QUERYTYPE_QUEST) then
  882. return db [arg1] --arg1 = the questID
  883.  
  884. elseif (queryType == WQT_QUERYTYPE_PERIOD) then
  885.  
  886. local dateString = WorldQuestTracker.GetDateString (arg1)
  887.  
  888. if (type (dateString) == "table") then --mais de 1 dia
  889. --quer saber da some total ou quer dia a dia para fazer um gr�fico
  890. local result = {}
  891. local total = 0
  892. local dayTable = dateString
  893.  
  894. for i = 1, #dayTable do --table com v�rias strings representando dias
  895. local day = db [dayTable [i]]
  896. if (day) then
  897. if (arg2) then
  898. total = total + (day [arg2] or 0)
  899. else
  900. tinsert (result, {["day"] = dayTable [i], ["table"] = day})
  901. end
  902. end
  903. end
  904.  
  905. if (arg2) then
  906. return total
  907. else
  908. return result
  909. end
  910.  
  911. else --um unico dia
  912. if (arg2) then --pediu apenas 1 reward
  913. db = db [dateString] --tabela do dia
  914. if (db) then
  915. return db [arg2] --quantidade de recursos
  916. end
  917. return
  918. end
  919. return db [dateString] --arg1 = data0 / retorna a tabela do dia com todos os rewards
  920. end
  921. end
  922.  
  923. end
  924.  
  925. -- ~completed ~questdone
  926. function WorldQuestTracker:QUEST_TURNED_IN (event, questID, XP, gold)
  927.  
  928. --> Court of Farondis 42420
  929. --> The Dreamweavers 42170
  930. --print ("world quest:", questID, QuestMapFrame_IsQuestWorldQuest (questID), XP, gold)
  931.  
  932. if (QuestMapFrame_IsQuestWorldQuest (questID)) then
  933. --print (event, questID, XP, gold)
  934. --QUEST_TURNED_IN 44300 0 772000
  935. -- QINFO: 0 nil nil Petrified Axe Haft true 370
  936.  
  937. WorldQuestTracker.AllCharactersQuests_Remove (questID)
  938. WorldQuestTracker.RemoveQuestFromTracker (questID)
  939.  
  940. if (QuestMapFrame_IsQuestWorldQuest (questID)) then --wait, is this inception?
  941. local title, questType, texture, factionID, tagID, tagName, worldQuestType, rarity, isElite, tradeskillLineIndex, selected, isSpellTarget, timeLeft, isCriteria, gold, goldFormated, rewardName, rewardTexture, numRewardItems, itemName, itemTexture, itemLevel, quantity, quality, isUsable, itemID, isArtifact, artifactPower, isStackable = WorldQuestTracker:GetQuestFullInfo (questID)
  942.  
  943. --print (title, questType, texture, factionID, tagID, tagName, worldQuestType, rarity, isElite, tradeskillLineIndex)
  944. --Retake the Skyhorn 8 Interface\AddOns\WorldQuestTracker\media\icon_artifactpower_redT_round 1828 109 World Quest 3 1 false nil
  945.  
  946. --print ("QINFO:", goldFormated, rewardName, numRewardItems, itemName, isArtifact, artifactPower)
  947.  
  948. local questHistory = WorldQuestTracker.db.profile.history
  949.  
  950. local guid = UnitGUID ("player")
  951. local today = date ("%y%m%d") -- YYMMDD
  952.  
  953. local itemName, itemTexture, itemLevel, quantity, quality, isUsable, itemID, isArtifact, artifactPower, isStackable = WorldQuestTracker.GetQuestReward_Item (questID)
  954. --print ("WQT", itemName, itemTexture, itemLevel, quantity, quality, isUsable, itemID, isArtifact, artifactPower, isStackable)
  955. --WQT Blood of Sargeras 1417744 110 1 3 true 124124 false 0 true
  956.  
  957. --quanto de gold recursos e poder de artefato ganho na conta e no personagem (� o total)
  958. local rewardHistory = questHistory.reward
  959. local _global = rewardHistory.global
  960. local _local = rewardHistory.character [guid]
  961. if (not _local) then
  962. _local = {}
  963. rewardHistory.character [guid] = _local
  964. end
  965.  
  966. if (gold and gold > 0) then
  967. _global ["gold"] = _global ["gold"] or 0
  968. _local ["gold"] = _local ["gold"] or 0
  969. _global ["gold"] = _global ["gold"] + gold
  970. _local ["gold"] = _local ["gold"] + gold
  971.  
  972. --print ("Gold added:", _global ["gold"], _local ["gold"])
  973. end
  974. if (isArtifact) then
  975. _global ["artifact"] = _global ["artifact"] or 0
  976. _local ["artifact"] = _local ["artifact"] or 0
  977. _global ["artifact"] = _global ["artifact"] + artifactPower
  978. _local ["artifact"] = _local ["artifact"] + artifactPower
  979.  
  980. --print ("Artifact added:", _global ["artifact"], _local ["artifact"])
  981. end
  982. if (rewardName) then --class hall resource
  983. _global ["resource"] = _global ["resource"] or 0
  984. _local ["resource"] = _local ["resource"] or 0
  985. _global ["resource"] = _global ["resource"] + numRewardItems
  986. _local ["resource"] = _local ["resource"] + numRewardItems
  987.  
  988. --print ("Resource added:", _global ["resource"], _local ["resource"])
  989. end
  990.  
  991. --trade skill - blood of sargeras
  992. if (itemID == 124124) then
  993. _global ["blood"] = (_global ["blood"] or 0) + quantity
  994. _local ["blood"] = (_local ["blood"] or 0) + quantity
  995. end
  996.  
  997. --professions
  998. --print ("itemID:", itemID)
  999. if (tradeskillLineIndex) then
  1000. --print ("eh profissao 1", tradeskillLineIndex)
  1001. local tradeskillLineID = tradeskillLineIndex and select (7, GetProfessionInfo(tradeskillLineIndex))
  1002. if (tradeskillLineID) then
  1003. --print ("eh profissao 2", tradeskillLineID)
  1004. if (itemID) then
  1005. --print ("eh profissao 3", itemID)
  1006. _global ["profession"] = _global ["profession"] or {}
  1007. _local ["profession"] = _local ["profession"] or {}
  1008. _global ["profession"] [itemID] = (_global ["profession"] [itemID] or 0) + 1
  1009. _local ["profession"] [itemID] = (_local ["profession"] [itemID] or 0) + 1
  1010. --print ("local global 3", _local ["profession"] [itemID], _global ["profession"] [itemID])
  1011. end
  1012. end
  1013. end
  1014.  
  1015. --quais quest ja foram completadas e quantas vezes
  1016. local questDoneHistory = questHistory.quest
  1017. local _global = questDoneHistory.global
  1018. local _local = questDoneHistory.character [guid]
  1019. if (not _local) then
  1020. _local = {}
  1021. questDoneHistory.character [guid] = _local
  1022. end
  1023. _global [questID] = (_global [questID] or 0) + 1
  1024. _local [questID] = (_local [questID] or 0) + 1
  1025. _global ["total"] = (_global ["total"] or 0) + 1
  1026. _local ["total"] = (_local ["total"] or 0) + 1
  1027.  
  1028. --estat�sticas dia a dia
  1029. local periodHistory = questHistory.period
  1030. local _global = periodHistory.global
  1031. local _local = periodHistory.character [guid]
  1032. if (not _local) then
  1033. _local = {}
  1034. periodHistory.character [guid] = _local
  1035. end
  1036.  
  1037. local _globalToday = _global [today]
  1038. local _localToday = _local [today]
  1039. if (not _globalToday) then
  1040. _globalToday = {}
  1041. _global [today] = _globalToday
  1042. end
  1043. if (not _localToday) then
  1044. _localToday = {}
  1045. _local [today] = _localToday
  1046. end
  1047.  
  1048. _globalToday ["quest"] = (_globalToday ["quest"] or 0) + 1
  1049. _localToday ["quest"] = (_localToday ["quest"] or 0) + 1
  1050.  
  1051. if (itemID == 124124) then
  1052. _globalToday ["blood"] = (_globalToday ["blood"] or 0) + quantity
  1053. _localToday ["blood"] = (_localToday ["blood"] or 0) + quantity
  1054. end
  1055.  
  1056. if (tradeskillLineIndex) then
  1057. --print ("eh profissao today 4", tradeskillLineIndex)
  1058. local tradeskillLineID = tradeskillLineIndex and select (7, GetProfessionInfo (tradeskillLineIndex))
  1059. if (tradeskillLineID) then
  1060. --print ("eh profissao today 5", tradeskillLineID)
  1061. if (itemID) then
  1062. --print ("eh profissao today 6", itemID)
  1063. _globalToday ["profession"] = _globalToday ["profession"] or {}
  1064. _localToday ["profession"] = _localToday ["profession"] or {}
  1065. _globalToday ["profession"] [itemID] = (_globalToday ["profession"] [itemID] or 0) + 1
  1066. _localToday ["profession"] [itemID] = (_localToday ["profession"] [itemID] or 0) + 1
  1067. --print ("local global today 6", _localToday ["profession"] [itemID], _globalToday ["profession"] [itemID])
  1068. end
  1069. end
  1070. end
  1071.  
  1072. if (gold and gold > 0) then
  1073. _globalToday ["gold"] = _globalToday ["gold"] or 0
  1074. _localToday ["gold"] = _localToday ["gold"] or 0
  1075. _globalToday ["gold"] = _globalToday ["gold"] + gold
  1076. _localToday ["gold"] = _localToday ["gold"] + gold
  1077. end
  1078. if (isArtifact) then
  1079. _globalToday ["artifact"] = _globalToday ["artifact"] or 0
  1080. _localToday ["artifact"] = _localToday ["artifact"] or 0
  1081. _globalToday ["artifact"] = _globalToday ["artifact"] + artifactPower
  1082. _localToday ["artifact"] = _localToday ["artifact"] + artifactPower
  1083. end
  1084. if (rewardName) then --class hall resource
  1085. _globalToday ["resource"] = _globalToday ["resource"] or 0
  1086. _localToday ["resource"] = _localToday ["resource"] or 0
  1087. _globalToday ["resource"] = _globalToday ["resource"] + numRewardItems
  1088. _localToday ["resource"] = _localToday ["resource"] + numRewardItems
  1089. end
  1090.  
  1091. end
  1092. end
  1093. end
  1094. function WorldQuestTracker:QUEST_LOOT_RECEIVED (event, questID, item, amount, ...)
  1095. --print ("LOOT", questID, item, amount, ...)
  1096. if (QuestMapFrame_IsQuestWorldQuest (questID)) then
  1097. -- local title, questType, texture, factionID, tagID, tagName, worldQuestType, rarity, isElite, tradeskillLineIndex, selected, isSpellTarget, timeLeft, isCriteria, gold, goldFormated, rewardName, rewardTexture, numRewardItems, itemName, itemTexture, itemLevel, quantity, quality, isUsable, itemID, isArtifact, artifactPower, isStackable = WorldQuestTracker:GetQuestFullInfo (questID)
  1098. -- print ("QINFO:", goldFormated, rewardName, numRewardItems, itemName, isArtifact, artifactPower)
  1099. end
  1100. end
  1101.  
  1102. WorldQuestTracker:RegisterEvent ("TAXIMAP_OPENED")
  1103. WorldQuestTracker:RegisterEvent ("TAXIMAP_CLOSED")
  1104. WorldQuestTracker:RegisterEvent ("ZONE_CHANGED_NEW_AREA")
  1105. WorldQuestTracker:RegisterEvent ("QUEST_TURNED_IN")
  1106. WorldQuestTracker:RegisterEvent ("QUEST_LOOT_RECEIVED")
  1107. WorldQuestTracker:RegisterEvent ("PLAYER_STARTED_MOVING")
  1108. WorldQuestTracker:RegisterEvent ("PLAYER_STOPPED_MOVING")
  1109.  
  1110. C_Timer.After (.5, WorldQuestTracker.ZONE_CHANGED_NEW_AREA)
  1111. C_Timer.After (.5, WorldQuestTracker.UpdateArrowFrequence)
  1112. C_Timer.After (5, WorldQuestTracker.UpdateArrowFrequence)
  1113. C_Timer.After (10, WorldQuestTracker.UpdateArrowFrequence)
  1114. end
  1115.  
  1116. local onStartClickAnimation = function (self)
  1117. self:GetParent():Show()
  1118. end
  1119. local onEndClickAnimation = function (self)
  1120. self:GetParent():Hide()
  1121. end
  1122.  
  1123. --o mapa � uma zona de broken isles?
  1124. function WorldQuestTracker.IsBrokenIslesZone (mapID)
  1125. return BROKEN_ISLES_ZONES [mapID]
  1126. end
  1127.  
  1128. ----------------------------------------------------------------------------------------------------------------------------------------------------------------
  1129. --> addon wide functions
  1130.  
  1131. --onenter das squares no world map
  1132. local questButton_OnEnter = function (self)
  1133. if (self.questID) then
  1134. WorldQuestTracker.CurrentHoverQuest = self.questID
  1135. self.UpdateTooltip = TaskPOI_OnEnter
  1136. TaskPOI_OnEnter (self)
  1137.  
  1138. --if (self.texture:GetTexture() == [[Interface\AddOns\WorldQuestTracker\media\icon_artifactpower_blueT]]) then
  1139.  
  1140. --end
  1141.  
  1142. end
  1143. end
  1144. local questButton_OnLeave = function (self)
  1145. TaskPOI_OnLeave (self)
  1146. WorldQuestTracker.CurrentHoverQuest = nil
  1147. end
  1148.  
  1149. --ao clicar no bot�o de uma quest na zona ou no world map, colocar para trackear ela
  1150. -- �nclick ~onclick ~click
  1151. local questButton_OnClick = function (self, button)
  1152.  
  1153. if (not self.questID) then
  1154. return
  1155. end
  1156. if (not HaveQuestData (self.questID)) then
  1157. WorldQuestTracker:Msg (L["S_ERROR_NOTLOADEDYET"])
  1158. return
  1159. end
  1160. local timeLeft = C_TaskQuest.GetQuestTimeLeftMinutes (self.questID)
  1161. if (not timeLeft or timeLeft <= 0) then
  1162. WorldQuestTracker:Msg (L["S_ERROR_NOTIMELEFT"])
  1163. end
  1164.  
  1165. --chat link
  1166. if (WorldQuestTracker.CanLinkToChat (self, button)) then
  1167. return
  1168. end
  1169.  
  1170. --was middle button and have WQGF installed
  1171. if (WorldQuestGroupFinderAddon and button == "MiddleButton") then
  1172.  
  1173. WorldQuestGroupFinder.HandleBlockClick (self.questID)
  1174.  
  1175. return
  1176.  
  1177. elseif (button == "MiddleButton") then
  1178.  
  1179. --PVEFrame_ShowFrame("GroupFinderFrame", LFGListPVEStub);
  1180.  
  1181. --local activityID, categoryID, filters, questName = LFGListUtil_GetQuestCategoryData (self.questID)
  1182. --LFGListCategorySelection_SelectCategory (LFGListFrame.CategorySelection, categoryID, filters)
  1183.  
  1184. --LFGListFrame.CategorySelection.FindGroupButton:Click()
  1185.  
  1186. --LFGListCategorySelection_StartFindGroup (LFGListFrame.CategorySelection, questName, self.questID)
  1187.  
  1188. --[[
  1189. local f = CreateFrame ("button", "testebutton", UIParent, "UIPanelButtonTemplate")
  1190. f:SetSize (100, 100)
  1191. f:SetPoint ("center", 0, 0)
  1192. f:Show()
  1193. f:SetScript ("OnClick", function()
  1194. PVEFrame_ShowFrame ("GroupFinderFrame", LFGListPVEStub);
  1195. local activityID, categoryID, filters, questName = LFGListUtil_GetQuestCategoryData (self.questID)
  1196. --LFGListCategorySelection_SelectCategory (LFGListFrame.CategorySelection, categoryID, filters)
  1197. --LFGListFrame.CategorySelection.FindGroupButton:Click()
  1198.  
  1199. --local baseFilters = LFGListFrame.CategorySelection:GetParent().baseFilters;
  1200. --local searchPanel = LFGListFrame.CategorySelection:GetParent().SearchPanel;
  1201.  
  1202. --print (baseFilters, searchPanel)
  1203.  
  1204. --LFGListSearchPanel_SetCategory (searchPanel, 1, LFGListFrame.selectedFilters, baseFilters);
  1205.  
  1206. C_LFGList.Search (1, questName, 0, 4, {})
  1207.  
  1208. --LFGListSearchPanel_UpdateResultList (LFGListFrame);
  1209. --LFGListSearchPanel_UpdateResults (LFGListFrame);
  1210.  
  1211. end)
  1212. --]]
  1213.  
  1214. --print (activityID, categoryID, filters, questName)
  1215.  
  1216. --LFGListFrame_BeginFindQuestGroup (LFGListFrame, self.questID);
  1217. --LFGListUtil_FindQuestGroup (self.questID)
  1218.  
  1219. end
  1220.  
  1221. --isn't using the tracker
  1222. if (not WorldQuestTracker.db.profile.use_tracker or IsShiftKeyDown()) then
  1223. TaskPOI_OnClick (self, button)
  1224.  
  1225. if (self.IsZoneQuestButton) then
  1226. WorldQuestTracker.UpdateZoneWidgets()
  1227. else
  1228. WorldQuestTracker.CanShowWorldMapWidgets (true)
  1229. end
  1230. return
  1231. end
  1232.  
  1233. --> add the quest to the tracker
  1234. WorldQuestTracker.OnQuestClicked (self, button)
  1235.  
  1236. --animations and sounds
  1237. if (WorldQuestTracker.IsQuestBeingTracked (self.questID)) then
  1238. if (self.trackingGlowBorder) then
  1239. self.trackingGlowBorder:Show()
  1240. end
  1241. else
  1242. if (self.trackingGlowBorder) then
  1243. self.trackingGlowBorder:Hide()
  1244. end
  1245. end
  1246.  
  1247. --shutdown animation and sound for now
  1248. --if (true) then return end
  1249.  
  1250. if (WorldQuestTracker.IsQuestBeingTracked (self.questID)) then
  1251. if (self.onEndTrackAnimation:IsPlaying()) then
  1252. self.onEndTrackAnimation:Stop()
  1253. end
  1254. self.onStartTrackAnimation:Play()
  1255.  
  1256. if (WorldQuestTracker.db.profile.sound_enabled) then
  1257. if (math.random (5) == 1) then
  1258. PlaySoundFile ("Interface\\AddOns\\WorldQuestTracker\\media\\quest_added_to_tracker1.mp3")
  1259. else
  1260. PlaySoundFile ("Interface\\AddOns\\WorldQuestTracker\\media\\quest_added_to_tracker2.mp3")
  1261. end
  1262. end
  1263. else
  1264. if (self.onStartTrackAnimation) then
  1265. if (self.onStartTrackAnimation:IsPlaying()) then
  1266. self.onStartTrackAnimation:Stop()
  1267. end
  1268. self.onEndTrackAnimation:Play()
  1269. end
  1270. end
  1271.  
  1272. if (not self.IsWorldQuestButton) then
  1273. WorldQuestTracker.WorldWidgets_NeedFullRefresh = true
  1274. end
  1275. end
  1276.  
  1277. --/dump WorldQuestTrackerAddon.GetCurrentZoneType()
  1278. function WorldQuestTracker.GetCurrentZoneType()
  1279. if (is_broken_isles_map [GetCurrentMapAreaID()]) then
  1280. return "zone"
  1281. elseif (WorldMapFrame.mapID == 1007 or GetCurrentMapAreaID() == 1007) then
  1282. return "world"
  1283. end
  1284. end
  1285.  
  1286. --verifica se pode mostrar os widgets de broken isles
  1287. function WorldQuestTracker.CanShowWorldMapWidgets (noFade)
  1288. if (WorldMapFrame.mapID == 1007 or GetCurrentMapAreaID() == 1007) then
  1289. if (noFade) then
  1290. WorldQuestTracker.UpdateWorldQuestsOnWorldMap()
  1291. else
  1292. WorldQuestTracker.UpdateWorldQuestsOnWorldMap (false, true)
  1293. end
  1294. else
  1295. WorldQuestTracker.HideWorldQuestsOnWorldMap()
  1296. end
  1297. end
  1298. --verifica se pode trocar o mapa e mostrar broken isles ao inves do mapa solicitado
  1299. function WorldQuestTracker.CanShowBrokenIsles()
  1300. if (UnitLevel ("player") < 110) then
  1301. return
  1302. elseif (not IsQuestFlaggedCompleted (WORLD_QUESTS_AVAILABLE_QUEST_ID)) then
  1303. return
  1304. end
  1305. return WorldQuestTracker.db.profile.enable_doubletap and not InCombatLockdown() and GetCurrentMapAreaID() ~= MAPID_BROKENISLES and (C_Garrison.IsPlayerInGarrison (LE_GARRISON_TYPE_7_0) or GetCurrentMapAreaID() == WorldQuestTracker.MAPID_DALARAN)
  1306. end
  1307.  
  1308. --todo: replace this with real animations
  1309. local zone_widget_rotation = 0
  1310. local animFrame, t = CreateFrame ("frame"), 0
  1311. local tickAnimation = function (self, deltaTime)
  1312. t = t + deltaTime
  1313. local squareAlphaAmount = Lerp (.7, .95, abs (sin (t*10)))
  1314. --print (squareAlphaAmount)
  1315. local roundAlphaAmount = Lerp (.745, .90, abs (sin (t*30)))
  1316.  
  1317. for mapId, configTable in pairs (WorldQuestTracker.mapTables) do
  1318. for index, button in ipairs (configTable.widgets) do
  1319. if (button.trackingGlowBorder:IsShown()) then
  1320. button.trackingGlowBorder:SetAlpha (squareAlphaAmount)
  1321. end
  1322. end
  1323. end
  1324.  
  1325. for index, button in ipairs (WorldWidgetPool) do
  1326. if (button.IsTrackingGlow:IsShown()) then
  1327. button.IsTrackingGlow:SetAlpha (roundAlphaAmount)
  1328. button.IsTrackingGlow:SetRotation (zone_widget_rotation)
  1329. end
  1330. end
  1331. zone_widget_rotation = (zone_widget_rotation + (deltaTime * 1.25)) % 360
  1332. end
  1333.  
  1334. function WorldQuestTracker.GetAllWorldQuests_Ids()
  1335. local allQuests, dataUnavaliable = {}, false
  1336. for mapId, configTable in pairs (WorldQuestTracker.mapTables) do
  1337. --local taskInfo = GetQuestsForPlayerByMapID (mapId, 1007)
  1338. local taskInfo = GetQuestsForPlayerByMapID (mapId)
  1339. if (taskInfo and #taskInfo > 0) then
  1340. for i, info in ipairs (taskInfo) do
  1341. local questID = info.questId
  1342. if (HaveQuestData (questID)) then
  1343. local isWorldQuest = QuestMapFrame_IsQuestWorldQuest (questID)
  1344. if (isWorldQuest) then
  1345. allQuests [questID] = true
  1346. C_TaskQuest.RequestPreloadRewardData (questID)
  1347. end
  1348. else
  1349. dataUnavaliable = true
  1350. end
  1351. end
  1352. else
  1353. dataUnavaliable = true
  1354. end
  1355. end
  1356.  
  1357. return allQuests, dataUnavaliable
  1358. end
  1359.  
  1360. --http://richard.warburton.it
  1361. local function comma_value (n)
  1362. if (not n) then return "0" end
  1363. n = floor (n)
  1364. if (n == 0) then
  1365. return "0"
  1366. end
  1367. local left,num,right = string.match (n,'^([^%d]*%d)(%d*)(.-)$')
  1368. return left..(num:reverse():gsub('(%d%d%d)','%1,'):reverse())..right
  1369. end
  1370.  
  1371. local symbol_1K, symbol_10K, symbol_1B
  1372. if (GetLocale() == "koKR") then
  1373. symbol_1K, symbol_10K, symbol_1B = "천", "만", "억"
  1374. elseif (GetLocale() == "zhCN") then
  1375. symbol_1K, symbol_10K, symbol_1B = "千", "万", "亿"
  1376. elseif (GetLocale() == "zhTW") then
  1377. symbol_1K, symbol_10K, symbol_1B = "千", "萬", "億"
  1378. end
  1379.  
  1380. if (symbol_1K) then
  1381. function WorldQuestTracker.ToK (numero)
  1382. if (numero > 99999999) then
  1383. --return format ("%.2f", numero/100000000) .. symbol_1B
  1384. return format ("%.2f", numero/100000000) .. symbol_1B
  1385. elseif (numero > 999999) then
  1386. --print ("--", numero, format ("%d", numero/10000))
  1387. return format ("%d", numero/10000) .. symbol_10K
  1388. elseif (numero > 99999) then
  1389. return floor (numero/10000) .. symbol_10K
  1390. elseif (numero > 9999) then
  1391. return format ("%.1f", (numero/10000)) .. symbol_10K
  1392. elseif (numero > 999) then
  1393. return format ("%.1f", (numero/1000)) .. symbol_1K
  1394. end
  1395. return format ("%.1f", numero)
  1396. end
  1397. else
  1398. function WorldQuestTracker.ToK (numero)
  1399. if (numero > 999999) then
  1400. return format ("%.0f", numero/1000000) .. "M"
  1401. elseif (numero > 99999) then
  1402. return floor (numero/1000) .. "K"
  1403. elseif (numero > 999) then
  1404. return format ("%.1f", (numero/1000)) .. "K"
  1405. end
  1406. return format ("%.1f", numero)
  1407. end
  1408. end
  1409.  
  1410. ----------------------------------------------------------------------------------------------------------------------------------------------------------------
  1411. --> quest info
  1412.  
  1413. local anime_square = function (self, deltaTime)
  1414. if (self.nextTick < 0) then
  1415. self.animeIndex = self.animeIndex + 1
  1416. if (self.animeIndex > 24) then
  1417. self.animeIndex = 1
  1418. end
  1419. self.rareBorder:SetTexture ([[Interface\AddOns\WorldQuestTracker\media\border_blue_stopmotionT]])
  1420. local line = math.ceil (self.animeIndex / 8)
  1421. local x = ( self.animeIndex - ( (line-1) * 8 ) ) / 8
  1422. self.rareBorder:SetTexCoord (x-0.125, x, 0.125 * (line-1), 0.125 * line)
  1423.  
  1424. self.nextTick = .05
  1425. else
  1426. self.nextTick = self.nextTick - deltaTime
  1427. end
  1428. end
  1429.  
  1430. function WorldQuestTracker.GetBorderByQuestType (self, rarity, worldQuestType)
  1431. if (worldQuestType == LE_QUEST_TAG_TYPE_PVP) then
  1432. --return "border_zone_browT"
  1433. return "border_zone_redT"
  1434. elseif (worldQuestType == LE_QUEST_TAG_TYPE_PET_BATTLE) then
  1435. return "border_zone_greenT"
  1436. elseif (worldQuestType == LE_QUEST_TAG_TYPE_PROFESSION) then
  1437. return "border_zone_browT"
  1438. elseif (rarity == LE_WORLD_QUEST_QUALITY_COMMON) then
  1439. if (worldQuestType == LE_QUEST_TAG_TYPE_INVASION) then
  1440. return "border_zone_legionT"
  1441. else
  1442. return "border_zone_whiteT"
  1443. end
  1444. elseif (rarity == LE_WORLD_QUEST_QUALITY_RARE) then
  1445. return "border_zone_blueT"
  1446. elseif (rarity == LE_WORLD_QUEST_QUALITY_EPIC) then
  1447. return "border_zone_pinkT"
  1448. end
  1449. end
  1450.  
  1451. --atualiza a borda nas squares do world map e no mapa da zona ~border
  1452. function WorldQuestTracker.UpdateBorder (self, rarity, worldQuestType, mapID)
  1453. if (self.isWorldMapWidget) then
  1454. self.commonBorder:Hide()
  1455. self.rareBorder:Hide()
  1456. self.epicBorder:Hide()
  1457. self.invasionBorder:Hide()
  1458.  
  1459. if (WorldQuestTracker.IsQuestBeingTracked (self.questID)) then
  1460. self.borderAnimation:Show()
  1461. --AutoCastShine_AutoCastStart (self.borderAnimation, 1, .7, 0)
  1462. self.trackingBorder:Show()
  1463. else
  1464. self.borderAnimation:Hide()
  1465. self.trackingBorder:Hide()
  1466. end
  1467.  
  1468. self.shineAnimation:Hide()
  1469. AnimatedShine_Stop (self)
  1470.  
  1471. local coords = WorldQuestTracker.GetBorderCoords (rarity)
  1472. if (rarity == LE_WORLD_QUEST_QUALITY_COMMON and worldQuestType ~= LE_QUEST_TAG_TYPE_INVASION) then
  1473. if (self.isArtifact) then
  1474. self.commonBorder:Show()
  1475. --self.squareBorder:SetTexCoord (unpack (coords))
  1476. --self.squareBorder:SetVertexColor (230/255, 204/255, 128/255)
  1477. --self.squareBorder:SetVertexColor (1, 1, 1)
  1478. else
  1479. self.commonBorder:Show()
  1480. --self.squareBorder:SetTexCoord (unpack (coords))
  1481. --self.squareBorder:SetVertexColor (1, 1, 1)
  1482. end
  1483.  
  1484. if (worldQuestType == LE_QUEST_TAG_TYPE_PVP) then
  1485. self.commonBorder:SetVertexColor (1, .7, .2)
  1486.  
  1487. elseif (worldQuestType == LE_QUEST_TAG_TYPE_PET_BATTLE) then
  1488. self.commonBorder:SetVertexColor (.4, 1, .4)
  1489.  
  1490. elseif (worldQuestType == LE_QUEST_TAG_TYPE_PROFESSION) then
  1491.  
  1492. else
  1493. self.commonBorder:SetVertexColor (1, 1, 1)
  1494. end
  1495.  
  1496. elseif (rarity == LE_WORLD_QUEST_QUALITY_RARE) then
  1497. --self.squareBorder:SetTexCoord (unpack (coords))
  1498. --self.squareBorder:SetVertexColor (1, 1, 1)
  1499. self.rareBorder:Show()
  1500. --self.nextTick = .1
  1501. --self.animeIndex = 1
  1502. --self:SetScript ("OnUpdate", anime_square)
  1503.  
  1504. --AutoCastShine_AutoCastStart (self.borderAnimation, .3, .3, 1)
  1505.  
  1506. --AnimatedShine_Start (self, 1, 1, 0);
  1507.  
  1508. elseif (rarity == LE_WORLD_QUEST_QUALITY_EPIC) then
  1509. --self.squareBorder:SetTexCoord (unpack (coords))
  1510. --self.squareBorder:SetVertexColor (1, 1, 1)
  1511. self.epicBorder:Show()
  1512.  
  1513. self.shineAnimation:Show()
  1514. --self.borderAnimation:Show()
  1515. --AutoCastShine_AutoCastStart (self.borderAnimation, .3, .3, 1)
  1516. AnimatedShine_Start (self, 1, 1, 1);
  1517.  
  1518. elseif (worldQuestType == LE_QUEST_TAG_TYPE_INVASION) then
  1519. self.invasionBorder:Show()
  1520.  
  1521. end
  1522.  
  1523. else
  1524. local borderTextureFile = WorldQuestTracker.GetBorderByQuestType (self, rarity, worldQuestType)
  1525. self.circleBorder:Show()
  1526. self.circleBorder:SetTexture ("Interface\\AddOns\\WorldQuestTracker\\media\\" .. borderTextureFile)
  1527.  
  1528. if (rarity == LE_WORLD_QUEST_QUALITY_COMMON) then
  1529. --self.bgFlag:SetTexture ([[Interface\AddOns\WorldQuestTracker\media\icon_flag_commonT]])
  1530. self.bgFlag:Hide()
  1531. --self.glassTransparence:Hide()
  1532. self.blackGradient:SetWidth (40)
  1533. self.flagText:SetPoint ("top", self.bgFlag, "top", 0, -2)
  1534.  
  1535. elseif (rarity == LE_WORLD_QUEST_QUALITY_RARE) then
  1536.  
  1537. if (mapID ~= suramar_mapId) then
  1538.  
  1539. self.rareSerpent:Show()
  1540. self.rareSerpent:SetSize (48, 52)
  1541. --self.rareSerpent:SetAtlas ("worldquest-questmarker-dragon")
  1542. self.rareSerpent:SetTexture ([[Interface\AddOns\WorldQuestTracker\media\rare_dragon_curveT]])
  1543. self.rareGlow:Show()
  1544. self.rareGlow:SetVertexColor (0, 0.36863, 0.74902)
  1545. self.rareGlow:SetSize (48, 52)
  1546. self.rareGlow:SetTexture ([[Interface\AddOns\WorldQuestTracker\media\rare_dragonT]])
  1547.  
  1548. --se estiver sendo trackeada, trocar o banner
  1549. if (WorldQuestTracker.IsQuestBeingTracked (self.questID)) then
  1550. self.bgFlag:SetTexture ([[Interface\AddOns\WorldQuestTracker\media\icon_flag_criteriamatchT]])
  1551. else
  1552. self.bgFlag:SetTexture ([[Interface\AddOns\WorldQuestTracker\media\icon_flagT]])
  1553. end
  1554.  
  1555. self.bgFlag:Show()
  1556. self.flagText:SetPoint ("top", self.bgFlag, "top", 0, -3)
  1557. --self.glassTransparence:Show()
  1558. end
  1559.  
  1560. elseif (rarity == LE_WORLD_QUEST_QUALITY_EPIC) then
  1561. self.rareSerpent:Show()
  1562. self.rareSerpent:SetSize (48, 52)
  1563. --self.rareSerpent:SetAtlas ("worldquest-questmarker-dragon")
  1564. self.rareSerpent:SetTexture ([[Interface\AddOns\WorldQuestTracker\media\rare_dragon_curveT]])
  1565. self.rareGlow:Show()
  1566. self.rareGlow:SetVertexColor (0.58431, 0.07059, 0.78039)
  1567. self.rareGlow:SetSize (48, 52)
  1568. self.rareGlow:SetTexture ([[Interface\AddOns\WorldQuestTracker\media\rare_dragonT]])
  1569.  
  1570. --se estiver sendo trackeada, trocar o banner
  1571. if (WorldQuestTracker.IsQuestBeingTracked (self.questID)) then
  1572. self.bgFlag:SetTexture ([[Interface\AddOns\WorldQuestTracker\media\icon_flag_criteriamatchT]])
  1573. else
  1574. self.bgFlag:SetTexture ([[Interface\AddOns\WorldQuestTracker\media\icon_flagT]])
  1575. end
  1576.  
  1577. self.bgFlag:Show()
  1578. self.flagText:SetPoint ("top", self.bgFlag, "top", 0, -3)
  1579. --self.glassTransparence:Show()
  1580. end
  1581.  
  1582. end
  1583.  
  1584. end
  1585.  
  1586. --pega o nome da zona
  1587. function WorldQuestTracker.GetZoneName (mapID)
  1588. if (not mapID) then
  1589. return ""
  1590. end
  1591. return GetMapNameByID (mapID)
  1592. end
  1593.  
  1594. function WorldQuestTracker.SetIconTexture (texture, file, coords, color)
  1595. if (file) then
  1596. texture:SetTexture (file)
  1597. end
  1598. if (coords) then
  1599. texture:SetTexCoord (unpack (coords))
  1600. end
  1601. if (color) then
  1602. texture:SetVertexColor (unpack (color))
  1603. end
  1604.  
  1605. --TQueue:AddToQueue (texture, file, coords, color)
  1606. end
  1607.  
  1608. --seta a cor do blip do tempo de acordo com o tempo restante da quert
  1609. function WorldQuestTracker.SetTimeBlipColor (self, timeLeft)
  1610.  
  1611. local bracket_low = 30
  1612. local bracket_medium = 90
  1613. local bracket_high = 240
  1614.  
  1615. local timePriority = WorldQuestTracker.db.profile.sort_time_priority
  1616. if (timePriority) then
  1617. if (timePriority == 4) then
  1618. bracket_low = 120 --2hrs
  1619. bracket_medium = 180 --3hrs
  1620. bracket_high = 240 --4hrs
  1621. elseif (timePriority == 8) then
  1622. bracket_low = 180 --3hrs
  1623. bracket_medium = 360 --6hrs
  1624. bracket_high = 480 --8hrs
  1625. elseif (timePriority == 12) then
  1626. bracket_low = 240 --4hrs
  1627. bracket_medium = 480 --8hrs
  1628. bracket_high = 720 --12hrs
  1629. elseif (timePriority == 16) then
  1630. bracket_low = 480 --8hrs
  1631. bracket_medium = 720 --12hrs
  1632. bracket_high = 960 --16hrs
  1633. elseif (timePriority == 24) then
  1634. bracket_low = 480 --8hrs
  1635. bracket_medium = 720 --12hrs
  1636. bracket_high = 1440 --24hrs
  1637. end
  1638. end
  1639.  
  1640. if (timeLeft < bracket_low) then
  1641. self.timeBlipRed:Show()
  1642. --TQueue:AddToQueue (self.timeBlipRed, false, false, false)
  1643. --blip:SetTexture ([[Interface\COMMON\Indicator-Red]])
  1644. --blip:SetVertexColor (1, 1, 1)
  1645. --blip:SetAlpha (1)
  1646. elseif (timeLeft < bracket_medium) then
  1647. self.timeBlipOrange:Show()
  1648. --TQueue:AddToQueue (self.timeBlipOrange, false, false, false)
  1649. --blip:SetTexture ([[Interface\COMMON\Indicator-Yellow]])
  1650. --blip:SetVertexColor (1, .7, 0)
  1651. --blip:SetAlpha (.9)
  1652. elseif (timeLeft < bracket_high) then
  1653. self.timeBlipYellow:Show()
  1654. --TQueue:AddToQueue (self.timeBlipYellow, false, false, false)
  1655. --blip:SetTexture ([[Interface\COMMON\Indicator-Yellow]])
  1656. --blip:SetVertexColor (1, 1, 1)
  1657. --blip:SetAlpha (.8)
  1658. else
  1659. self.timeBlipGreen:Show()
  1660. --TQueue:AddToQueue (self.timeBlipGreen, false, false, false)
  1661. --blip:SetTexture ([[Interface\COMMON\Indicator-Green]])
  1662. --blip:SetVertexColor (1, 1, 1)
  1663. --blip:SetAlpha (.6)
  1664. end
  1665. end
  1666.  
  1667. --verifica se o item � um item de artefato e pega a quantidade de poder dele
  1668. local GameTooltipFrame = CreateFrame ("GameTooltip", "WorldQuestTrackerScanTooltip", nil, "GameTooltipTemplate")
  1669. local GameTooltipFrameTextLeft1 = _G ["WorldQuestTrackerScanTooltipTextLeft2"]
  1670. local GameTooltipFrameTextLeft2 = _G ["WorldQuestTrackerScanTooltipTextLeft3"]
  1671. local GameTooltipFrameTextLeft3 = _G ["WorldQuestTrackerScanTooltipTextLeft4"]
  1672. local GameTooltipFrameTextLeft4 = _G ["WorldQuestTrackerScanTooltipTextLeft5"]
  1673.  
  1674. --GameTooltip_ShowCompareItem(GameTooltip);
  1675. --EmbeddedItemTooltip_SetItemByQuestReward(self, questLogIndex, questID)
  1676. function WorldQuestTracker.RewardRealItemLevel (questID)
  1677. GameTooltipFrame:SetOwner (WorldFrame, "ANCHOR_NONE")
  1678. --GameTooltipFrame:SetHyperlink (itemLink)
  1679. GameTooltipFrame:SetQuestLogItem ("reward", 1, questID)
  1680.  
  1681. local Text = GameTooltipFrameTextLeft1:GetText() or GameTooltipFrameTextLeft2:GetText() or ""
  1682. local itemLevel = tonumber (Text:match ("%d+"))
  1683.  
  1684. return itemLevel or 1
  1685. end
  1686.  
  1687. -- �rtifact ~artifact
  1688.  
  1689. function WorldQuestTracker.RewardIsArtifactPowerAsian (itemLink) -- thanks @yuk6196 on curseforge
  1690.  
  1691. GameTooltipFrame:SetOwner (WorldFrame, "ANCHOR_NONE")
  1692. GameTooltipFrame:SetHyperlink (itemLink)
  1693. local text = GameTooltipFrameTextLeft1:GetText()
  1694.  
  1695. if (text and text:match ("|cFFE6CC80")) then
  1696. local power = GameTooltipFrameTextLeft3:GetText()
  1697. if (power) then
  1698. local n = tonumber (power:gsub ("%p", ""):match ("%d+"))
  1699. if (power:find (SECOND_NUMBER)) then
  1700. n = n * 10000
  1701. elseif (power:find (THIRD_NUMBER)) then
  1702. n = n * 100000000
  1703. elseif (power:find (FOURTH_NUMBER)) then
  1704. n = n * 1000000000000
  1705. end
  1706. return true, n or 0
  1707. end
  1708. end
  1709.  
  1710. local text2 = GameTooltipFrameTextLeft2:GetText()
  1711. if (text2 and text2:match ("|cFFE6CC80")) then
  1712. local power = GameTooltipFrameTextLeft4:GetText()
  1713. if (power) then
  1714. local n = tonumber (power:gsub ("%p", ""):match ("%d+"))
  1715. if (power:find (SECOND_NUMBER)) then
  1716. n = n * 10000
  1717. elseif (power:find (THIRD_NUMBER)) then
  1718. n = n * 100000000
  1719. elseif (power:find (FOURTH_NUMBER)) then
  1720. n = n * 1000000000000
  1721. end
  1722. return true, n or 0
  1723. end
  1724. end
  1725. end
  1726.  
  1727. function WorldQuestTracker.RewardIsArtifactPowerGerman (itemLink) -- thanks @Superanuki on curseforge
  1728.  
  1729. local w1, w2, w3, w4 = "Millionen", "Million", "%d+,%d+", "([^,]+),([^,]+)" --works for German
  1730.  
  1731. if (WorldQuestTracker.GameLocale == "ptBR") then
  1732. w1, w2, w3, w4 = "milh", "milh", "%d+.%d+", "([^,]+).([^,]+)"
  1733. elseif (WorldQuestTracker.GameLocale == "frFR") then
  1734. w1, w2, w3, w4 = "million", "million", "%d+,%d+", "([^,]+),([^,]+)"
  1735. end
  1736.  
  1737. GameTooltipFrame:SetOwner (WorldFrame, "ANCHOR_NONE")
  1738. GameTooltipFrame:SetHyperlink (itemLink)
  1739. local text = GameTooltipFrameTextLeft1:GetText()
  1740.  
  1741. if (text and text:match ("|cFFE6CC80")) then
  1742. local power = GameTooltipFrameTextLeft3:GetText()
  1743. if (power) then
  1744. if (power:find (w1) or power:find (w2)) then
  1745.  
  1746. local n=power:match(w3)
  1747. if n then
  1748. local one,two=n:match(w4) n=one.."."..two
  1749. end
  1750. n = tonumber (n)
  1751. if (not n) then
  1752. n = power:match (" %d+ ") --thanks @Arwarld_ on curseforge - ticket #427
  1753. n = tonumber (n)
  1754. n=n..".0"
  1755. n = tonumber (n)
  1756. end
  1757.  
  1758. if (n) then
  1759. n = n * 1000000
  1760. return true, n or 0
  1761. end
  1762. end
  1763.  
  1764. if (WorldQuestTracker.GameLocale == "frFR") then
  1765. power = power:gsub ("%s", ""):gsub ("%p", ""):match ("%d+")
  1766. else
  1767. power = power:gsub ("%p", ""):match ("%d+")
  1768. end
  1769.  
  1770. power = tonumber (power)
  1771. return true, power or 0
  1772. end
  1773. end
  1774.  
  1775. local text2 = GameTooltipFrameTextLeft2:GetText()
  1776. if (text2 and text2:match ("|cFFE6CC80")) then
  1777. local power = GameTooltipFrameTextLeft4:GetText()
  1778. if (power) then
  1779.  
  1780. if (power:find (w1) or power:find (w2)) then
  1781. local n=power:match(w3)
  1782.  
  1783. if n then
  1784. local one,two=n:match(w4) n=one.."."..two
  1785. end
  1786. n = tonumber (n)
  1787. if (not n) then
  1788. n = power:match (" %d+ ")
  1789. n = tonumber (n)
  1790. n=n..".0"
  1791. n = tonumber (n)
  1792. end
  1793.  
  1794. if (n) then
  1795. n = n * 1000000
  1796. return true, n or 0
  1797. end
  1798. end
  1799.  
  1800. if (WorldQuestTracker.GameLocale == "frFR") then
  1801. power = power:gsub ("%s", ""):gsub ("%p", ""):match ("%d+")
  1802. else
  1803. power = power:gsub ("%p", ""):match ("%d+")
  1804. end
  1805.  
  1806. power = tonumber (power)
  1807. return true, power or 0
  1808. end
  1809. end
  1810. end
  1811.  
  1812. function WorldQuestTracker.RewardIsArtifactPower (itemLink)
  1813.  
  1814. --if (WorldQuestTracker.GameLocale == "koKR") then
  1815. if (WorldQuestTracker.GameLocale == "koKR" or WorldQuestTracker.GameLocale == "zhTW" or WorldQuestTracker.GameLocale == "zhCN") then
  1816. return WorldQuestTracker.RewardIsArtifactPowerAsian (itemLink)
  1817.  
  1818. elseif (WorldQuestTracker.GameLocale == "deDE" or WorldQuestTracker.GameLocale == "ptBR" or WorldQuestTracker.GameLocale == "frFR") then
  1819. return WorldQuestTracker.RewardIsArtifactPowerGerman (itemLink)
  1820. end
  1821.  
  1822. GameTooltipFrame:SetOwner (WorldFrame, "ANCHOR_NONE")
  1823. GameTooltipFrame:SetHyperlink (itemLink)
  1824.  
  1825. local text = GameTooltipFrameTextLeft1:GetText()
  1826. if (text and text:match ("|cFFE6CC80")) then
  1827. local power = GameTooltipFrameTextLeft3:GetText()
  1828. if (power) then
  1829.  
  1830. if (power:find (SECOND_NUMBER)) then
  1831. local n = power:match (" %d+%.%d+ ")
  1832. n = tonumber (n)
  1833. if (not n) then
  1834. n = power:match (" %d+ ")
  1835. n = tonumber (n)
  1836. end
  1837. if (n) then
  1838. n = n * 1000000
  1839. return true, n or 0
  1840. end
  1841. end
  1842.  
  1843. if (WorldQuestTracker.GameLocale == "frFR") then
  1844. power = power:gsub ("%s", ""):gsub ("%p", ""):match ("%d+")
  1845. else
  1846. power = power:gsub ("%p", ""):match ("%d+")
  1847. end
  1848.  
  1849. power = tonumber (power)
  1850. return true, power or 0
  1851. end
  1852. end
  1853.  
  1854. local text2 = GameTooltipFrameTextLeft2:GetText() --thanks @Prejudice182 on curseforge
  1855. if (text2 and text2:match ("|cFFE6CC80")) then
  1856. local power = GameTooltipFrameTextLeft4:GetText()
  1857. if (power) then
  1858.  
  1859. if (power:find (SECOND_NUMBER)) then
  1860. local n = power:match (" %d+%.%d+ ")
  1861. n = tonumber (n)
  1862. if (not n) then
  1863. n = power:match (" %d+ ")
  1864. n = tonumber (n)
  1865. end
  1866. if (n) then
  1867. n = n * 1000000
  1868. return true, n or 0
  1869. end
  1870. end
  1871.  
  1872. if (WorldQuestTracker.GameLocale == "frFR") then
  1873. power = power:gsub ("%s", ""):gsub ("%p", ""):match ("%d+")
  1874. else
  1875. power = power:gsub ("%p", ""):match ("%d+")
  1876. end
  1877. power = tonumber (power)
  1878. return true, power or 0
  1879. end
  1880. end
  1881. end
  1882.  
  1883. --pega a quantidade de gold da quest
  1884.  
  1885. function WorldQuestTracker.GetQuestReward_Gold (questID)
  1886. local gold = GetQuestLogRewardMoney (questID) or 0
  1887. local formated
  1888. if (gold > 10000000) then
  1889. formated = gold / 10000 --remove os zeros
  1890. formated = string.format ("%.1fK", formated / 1000)
  1891. else
  1892. formated = floor (gold / 10000)
  1893. end
  1894. return gold, formated
  1895. end
  1896.  
  1897. --pega a quantidade de recursos para a order hall
  1898. function WorldQuestTracker.GetQuestReward_Resource (questID)
  1899. local numQuestCurrencies = GetNumQuestLogRewardCurrencies (questID)
  1900. if (numQuestCurrencies == 2) then
  1901. for i = 1, numQuestCurrencies do
  1902. local name, texture, numItems = GetQuestLogRewardCurrencyInfo (i, questID)
  1903. --legion invasion quest
  1904. if (texture and
  1905. (
  1906. (type (texture) == "number" and texture == 132775) or
  1907. (type (texture) == "string" and (texture:find ("inv_datacrystal01") or texture:find ("inv_misc_summonable_boss_token")))
  1908. )
  1909. ) then -- [[Interface\Icons\inv_datacrystal01]]
  1910. else
  1911. return name, texture, numItems
  1912. end
  1913. end
  1914. else
  1915. for i = 1, numQuestCurrencies do
  1916. local name, texture, numItems = GetQuestLogRewardCurrencyInfo (i, questID)
  1917. return name, texture, numItems
  1918. end
  1919. end
  1920. end
  1921.  
  1922. local ItemTooltipScan = CreateFrame ("GameTooltip", "WQTItemTooltipScan", UIParent, "EmbeddedItemTooltip")
  1923. ItemTooltipScan.texts = {
  1924. _G ["WQTItemTooltipScanTooltipTextLeft1"],
  1925. _G ["WQTItemTooltipScanTooltipTextLeft2"],
  1926. _G ["WQTItemTooltipScanTooltipTextLeft3"],
  1927. _G ["WQTItemTooltipScanTooltipTextLeft4"],
  1928. }
  1929. ItemTooltipScan.patern = ITEM_LEVEL:gsub ("%%d", "(%%d+)") --from LibItemUpgradeInfo-1.0
  1930.  
  1931. WorldQuestTracker.EquipIcons = {
  1932. ["INVTYPE_HEAD"] = "Interface\\ICONS\\" .. "INV_Helmet_29",
  1933. ["INVTYPE_NECK" ] = "Interface\\ICONS\\" .. "INV_Jewelry_Necklace_07",
  1934. ["INVTYPE_SHOULDER"] = "Interface\\ICONS\\" .. "INV_Shoulder_25",
  1935. --["INVTYPE_ROBE"] ="INV_Chest_Chain_10", --INVTYPE_CHEST
  1936. ["INVTYPE_ROBE"] = "Interface\\ICONS\\" .. "INV_Chest_Cloth_08", --INVTYPE_CHEST
  1937. ["INVTYPE_WAIST"] = "Interface\\ICONS\\" .. "INV_Belt_15",
  1938. ["INVTYPE_LEGS"] = "Interface\\ICONS\\" .. "INV_Pants_08",
  1939. ["INVTYPE_FEET"] = "Interface\\ICONS\\" .. "INV_Boots_Cloth_03",
  1940. ["INVTYPE_WRIST"] = "Interface\\ICONS\\" .. "INV_Bracer_07",
  1941. ["INVTYPE_HAND"] = "Interface\\ICONS\\" .. "INV_Gauntlets_17",
  1942. ["INVTYPE_FINGER"] = "Interface\\ICONS\\" .. "INV_Jewelry_Ring_22",
  1943. --["INVTYPE_TRINKET"] = "Interface\\ICONS\\" .. "INV_Wand_1h_430NightElf_C_01", --"INV_Trinket_HonorHold",
  1944. --["INVTYPE_TRINKET"] = "Interface\\ICONS\\" .. "INV_Jewelry_StormPikeTrinket_01", --"INV_Trinket_HonorHold",
  1945. ["INVTYPE_TRINKET"] = "Interface\\ICONS\\" .. "INV_Jewelry_Talisman_07", --"INV_Trinket_HonorHold",
  1946. --["INVTYPE_TRINKET"] = [[Interface\AddOns\WorldQuestTracker\media\icon_trinketT]],
  1947. ["INVTYPE_CLOAK"] = "Interface\\ICONS\\" .. "INV_Misc_Cape_19", --INVTYPE_BACK
  1948. --["Relic"] = "Interface\\ICONS\\" .. "INV_Artifact_XP05",
  1949. --["Relic"] = "Interface\\ICONS\\" .. "INV_Enchant_VoidSphere",
  1950. ["Relic"] = "Interface\\ICONS\\" .. "inv_misc_enchantedpearlE",
  1951. }
  1952.  
  1953. --[[
  1954.  
  1955. --]]
  1956.  
  1957. --pega o premio item da quest
  1958. function WorldQuestTracker.GetQuestReward_Item (questID)
  1959. if (not HaveQuestData (questID)) then
  1960. return
  1961. end
  1962. local numQuestRewards = GetNumQuestLogRewards (questID)
  1963. if (numQuestRewards > 0) then
  1964. local itemName, itemTexture, quantity, quality, isUsable, itemID = GetQuestLogRewardInfo (1, questID)
  1965. if (itemID) then
  1966. local itemName, itemLink, itemRarity, itemLevel, itemMinLevel, itemType, itemSubType, itemStackCount, itemEquipLoc, itemTexture, itemSellPrice, itemClassID, itemSubClassID = GetItemInfo (itemID)
  1967.  
  1968. if (itemName) then
  1969. EmbeddedItemTooltip_SetItemByQuestReward (ItemTooltipScan, 1, questID)
  1970. for i = 1, 4 do
  1971. local text = ItemTooltipScan.texts [i]:GetText()
  1972. if (text and text ~= "") then
  1973. local ilvl = tonumber (text:match (ItemTooltipScan.patern))
  1974. if (ilvl) then
  1975. itemLevel = ilvl
  1976. break
  1977. end
  1978. end
  1979. end
  1980.  
  1981. local icon = WorldQuestTracker.EquipIcons [itemEquipLoc]
  1982. if (not icon and itemClassID == 3 and itemSubClassID == 11) then
  1983. icon = WorldQuestTracker.EquipIcons ["Relic"]
  1984. end
  1985.  
  1986. if (icon and not WorldQuestTracker.db.profile.use_old_icons) then
  1987. itemTexture = icon
  1988. end
  1989.  
  1990. local isArtifact, artifactPower = WorldQuestTracker.RewardIsArtifactPower (itemLink)
  1991. local hasUpgrade = WorldQuestTracker.RewardRealItemLevel (questID)
  1992. itemLevel = itemLevel > hasUpgrade and itemLevel or hasUpgrade
  1993.  
  1994. if (isArtifact) then
  1995. return itemName, itemTexture, itemLevel, quantity, quality, isUsable, itemID, true, artifactPower, itemStackCount > 1, itemStackCount
  1996. else
  1997. return itemName, itemTexture, itemLevel, quantity, quality, isUsable, itemID, false, 0, itemStackCount > 1, itemStackCount
  1998. end
  1999. else
  2000. --ainda n�o possui info do item
  2001. return
  2002. end
  2003. else
  2004. --ainda n�o possui info do item
  2005. return
  2006. end
  2007. end
  2008. end
  2009.  
  2010. --formata o tempo restante que a quest tem
  2011. local D_HOURS = "%dH"
  2012. local D_DAYS = "%dD"
  2013. function WorldQuestTracker.GetQuest_TimeLeft (questID, formated)
  2014. local timeLeftMinutes = GetQuestTimeLeftMinutes (questID)
  2015. if (formated) then
  2016. local timeString
  2017. if ( timeLeftMinutes <= WORLD_QUESTS_TIME_CRITICAL_MINUTES ) then
  2018. timeString = SecondsToTime (timeLeftMinutes * 60)
  2019. elseif timeLeftMinutes <= 60 + WORLD_QUESTS_TIME_CRITICAL_MINUTES then
  2020. timeString = SecondsToTime ((timeLeftMinutes - WORLD_QUESTS_TIME_CRITICAL_MINUTES) * 60)
  2021. elseif timeLeftMinutes < 24 * 60 + WORLD_QUESTS_TIME_CRITICAL_MINUTES then
  2022. timeString = D_HOURS:format(math.floor(timeLeftMinutes - WORLD_QUESTS_TIME_CRITICAL_MINUTES) / 60)
  2023. else
  2024. timeString = D_DAYS:format(math.floor(timeLeftMinutes - WORLD_QUESTS_TIME_CRITICAL_MINUTES) / 1440)
  2025. end
  2026.  
  2027. return timeString
  2028. else
  2029. return timeLeftMinutes
  2030. end
  2031. end
  2032.  
  2033. --pega os dados da quest
  2034. function WorldQuestTracker.GetQuest_Info (questID)
  2035. if (not HaveQuestData (questID)) then
  2036. return
  2037. end
  2038. local title, factionID = GetQuestInfoByQuestID (questID)
  2039. local tagID, tagName, worldQuestType, rarity, isElite, tradeskillLineIndex = GetQuestTagInfo (questID)
  2040. return title, factionID, tagID, tagName, worldQuestType, rarity, isElite, tradeskillLineIndex
  2041. end
  2042.  
  2043. --pega o icone para as quest que dao goild
  2044. local goldCoords = {0, 1, 0, 1}
  2045. function WorldQuestTracker.GetGoldIcon()
  2046. return [[Interface\GossipFrame\auctioneerGossipIcon]], goldCoords
  2047. end
  2048.  
  2049. --pega o icone para as quests que dao poder de artefato
  2050. function WorldQuestTracker.GetArtifactPowerIcon (artifactPower, rounded)
  2051. if (true or artifactPower >= 250) then --for�ando sempre o mesmo icone
  2052. if (rounded) then
  2053. return [[Interface\AddOns\WorldQuestTracker\media\icon_artifactpower_red_roundT]]
  2054. else
  2055. return [[Interface\AddOns\WorldQuestTracker\media\icon_artifactpower_redT]]
  2056. end
  2057. elseif (artifactPower >= 120) then
  2058. if (rounded) then
  2059. return [[Interface\AddOns\WorldQuestTracker\media\icon_artifactpower_yellow_roundT]]
  2060. else
  2061. return [[Interface\AddOns\WorldQuestTracker\media\icon_artifactpower_yellowT]]
  2062. end
  2063. else
  2064. if (rounded) then
  2065. return [[Interface\AddOns\WorldQuestTracker\media\icon_artifactpower_blue_roundT]]
  2066. else
  2067. return [[Interface\AddOns\WorldQuestTracker\media\icon_artifactpower_blueT]]
  2068. end
  2069. end
  2070. end
  2071.  
  2072. --pega os coordenadas para a textura da borda
  2073. -- n�o � mais usado!
  2074. local rarity_border_common = {150/512, 206/512, 158/512, 214/512}
  2075. local rarity_border_rare = {10/512, 66/512, 158/512, 214/512}
  2076. local rarity_border_epic = {80/512, 136/512, 158/512, 214/512}
  2077. function WorldQuestTracker.GetBorderCoords (rarity)
  2078. if (rarity == LE_WORLD_QUEST_QUALITY_COMMON) then
  2079. return rarity_border_common
  2080. elseif (rarity == LE_WORLD_QUEST_QUALITY_RARE) then
  2081. return rarity_border_rare
  2082. elseif (rarity == LE_WORLD_QUEST_QUALITY_EPIC) then
  2083. return rarity_border_epic
  2084. end
  2085. end
  2086.  
  2087. --pega a lista de quests que o jogador tem dispon�vel
  2088. function WorldQuestTracker.SavedQuestList_GetList()
  2089. return WorldQuestTracker.dbChr.ActiveQuests
  2090. end
  2091. -- ~saved ~pool ~data ~allquests �ll
  2092. local map_seasons = {}
  2093. function WorldQuestTracker.SavedQuestList_IsNew (questID)
  2094. if (WorldQuestTracker.MapSeason == 0) then
  2095. --o mapa esta carregando e n�o mandou o primeiro evento ainda
  2096. return false
  2097. end
  2098.  
  2099. local ActiveQuests = WorldQuestTracker.SavedQuestList_GetList()
  2100.  
  2101. if (ActiveQuests [questID]) then --a quest esta armazenada
  2102. if (map_seasons [questID] == WorldQuestTracker.MapSeason) then
  2103. --a quest j� esta na lista por�m foi adicionada nesta season do mapa
  2104. return true
  2105. else
  2106. --apenas retornar que n�o � nova
  2107. return false
  2108. end
  2109. else --a quest n�o esta na lista
  2110. local timeLeft = WorldQuestTracker.GetQuest_TimeLeft (questID)
  2111. if (timeLeft and timeLeft > 0) then
  2112. --adicionar a quest a lista de quets
  2113. ActiveQuests [questID] = time() + (timeLeft*60)
  2114. map_seasons [questID] = WorldQuestTracker.MapSeason
  2115. --retornar que a quest � nova
  2116. return true
  2117. else
  2118. --o tempo da quest expirou.
  2119. return false
  2120. end
  2121. end
  2122. end
  2123.  
  2124. function WorldQuestTracker.SavedQuestList_CleanUp()
  2125. local ActiveQuests = WorldQuestTracker.SavedQuestList_GetList()
  2126. local now = time()
  2127. for questID, expireAt in pairs (ActiveQuests) do
  2128. if (expireAt < now) then
  2129. ActiveQuests [questID] = nil
  2130. end
  2131. end
  2132. end
  2133.  
  2134. ------------
  2135.  
  2136. function WorldQuestTracker.AllCharactersQuests_Add (questID, timeLeft, iconTexture, iconText)
  2137. local guid = UnitGUID ("player")
  2138. local t = WorldQuestTracker.db.profile.quests_all_characters [guid]
  2139. if (not t) then
  2140. t = {}
  2141. WorldQuestTracker.db.profile.quests_all_characters [guid] = t
  2142. end
  2143.  
  2144. local questInfo = t [questID]
  2145. if (not questInfo) then
  2146. questInfo = {}
  2147. t [questID] = questInfo
  2148. end
  2149.  
  2150. questInfo.expireAt = time() + (timeLeft*60) --timeLeft = minutes left
  2151. questInfo.rewardTexture = iconTexture or ""
  2152. questInfo.rewardAmount = iconText or ""
  2153. end
  2154.  
  2155. function WorldQuestTracker.AllCharactersQuests_Remove (questID)
  2156. local guid = UnitGUID ("player")
  2157. local t = WorldQuestTracker.db.profile.quests_all_characters [guid]
  2158.  
  2159. if (t) then
  2160. t [questID] = nil
  2161. end
  2162. end
  2163.  
  2164. function WorldQuestTracker.AllCharactersQuests_CleanUp()
  2165. local guid = UnitGUID ("player")
  2166. local t = WorldQuestTracker.db.profile.quests_all_characters [guid]
  2167.  
  2168. if (t) then
  2169. local now = time()
  2170. for questID, questInfo in pairs (t) do
  2171. if (questInfo.expireAt < now) then
  2172. t [questID] = nil
  2173. end
  2174. end
  2175. end
  2176. end
  2177.  
  2178. ----------------------------------------------------------------------------------------------------------------------------------------------------------------
  2179. --> build up our standing frame
  2180.  
  2181. --point of interest frame ~poiframe ~frame ~start
  2182. local worldFramePOIs = CreateFrame ("frame", "WorldQuestTrackerWorldMapPOI", WorldMapFrame)
  2183. worldFramePOIs:SetAllPoints()
  2184. worldFramePOIs:SetFrameLevel (301)
  2185. local fadeInAnimation = worldFramePOIs:CreateAnimationGroup()
  2186. local step1 = fadeInAnimation:CreateAnimation ("Alpha")
  2187. step1:SetOrder (1)
  2188. step1:SetFromAlpha (0)
  2189. step1:SetToAlpha (1)
  2190. step1:SetDuration (0.3)
  2191. worldFramePOIs.fadeInAnimation = fadeInAnimation
  2192. fadeInAnimation:SetScript ("OnFinished", function()
  2193. worldFramePOIs:SetAlpha (1)
  2194. end)
  2195.  
  2196. ----------------------------------------------------------------------------------------------------------------------------------------------------------------
  2197. --> world map frame hooks
  2198. -- ~bar ~showbar ~statusbar ~worldmapevent ~event
  2199. function WorldQuestTracker.RefreshStatusBar()
  2200. if (WorldQuestTracker.DoubleTapFrame and not InCombatLockdown()) then
  2201. if (GetCurrentMapAreaID() == MAPID_BROKENISLES or is_broken_isles_map [GetCurrentMapAreaID()]) then
  2202. WorldQuestTracker.DoubleTapFrame:Show()
  2203. else
  2204. WorldQuestTracker.DoubleTapFrame:Hide()
  2205. end
  2206. end
  2207. end
  2208.  
  2209. WorldMapFrame:HookScript ("OnEvent", function (self, event)
  2210. if (event == "WORLD_MAP_UPDATE") then
  2211. if (WorldQuestTracker.CurrentMapID ~= self.mapID) then
  2212. if (WorldQuestTracker.LastWorldMapClick+0.017 > GetTime()) then
  2213. WorldQuestTracker.CurrentMapID = self.mapID
  2214. end
  2215. end
  2216. WorldQuestTracker.RefreshStatusBar()
  2217.  
  2218. if (WorldQuestTracker.QuestSummaryShown and not WorldQuestTracker.CanShowZoneSummaryFrame()) then
  2219. WorldQuestTracker.ClearZoneSummaryButtons()
  2220. end
  2221.  
  2222. if (WorldQuestTracker.CanShowZoneSummaryFrame()) then -- and not InCombatLockdown()
  2223. WorldMapFrame.UIElementsFrame.BountyBoard:ClearAllPoints()
  2224. WorldMapFrame.UIElementsFrame.BountyBoard:SetPoint ("bottomright", WorldMapFrame.UIElementsFrame, "bottomright", -18, 15)
  2225. end
  2226.  
  2227. --se for um mapa qualquer e n�o for o world map -> esconder os widget do world map
  2228. --fazer a mesma coisa para os widgets das zonas
  2229. end
  2230. end)
  2231.  
  2232. --OnTick
  2233. local OnUpdateDelay = .5
  2234. local ActionButton = WorldMapFrame.UIElementsFrame.ActionButton
  2235.  
  2236. WorldMapFrame:HookScript ("OnUpdate", function (self, deltaTime)
  2237.  
  2238. if (ActionButton and ActionButton:IsShown()) then
  2239. if (ActionButton.SpellButton.Cooldown:GetCooldownDuration() and ActionButton.SpellButton.Cooldown:GetCooldownDuration() > 0) then
  2240. ActionButton:SetAlpha (.2)
  2241. else
  2242. ActionButton:SetAlpha (1)
  2243. end
  2244. end
  2245.  
  2246. if (WorldQuestTracker.CanShowZoneSummaryFrame()) then
  2247. WorldMapFrame.UIElementsFrame.BountyBoard:ClearAllPoints()
  2248. WorldMapFrame.UIElementsFrame.BountyBoard:SetPoint ("bottomright", WorldMapFrame.UIElementsFrame, "bottomright", -18, 15)
  2249.  
  2250. if (ActionButton:IsShown()) then
  2251. if (not InCombatLockdown()) then
  2252. WorldMapFrame.UIElementsFrame.ActionButton:ClearAllPoints()
  2253. --WorldMapFrame.UIElementsFrame.ActionButton:SetPoint ("bottomleft", WorldQuestTrackerSummaryHeader, "topleft")
  2254. --WorldMapFrame.UIElementsFrame.ActionButton:SetPoint ("right", WorldMapFrame.UIElementsFrame.BountyBoard, "left", 0, -12) --problemas com protected
  2255. WorldMapFrame.UIElementsFrame.ActionButton:SetPoint ("bottomright", WorldMapFrame.UIElementsFrame, "bottomright", -268, 15)
  2256. else
  2257. ActionButton:SetAlpha (0)
  2258. end
  2259. end
  2260.  
  2261. end
  2262. if (WorldQuestTracker.HaveZoneSummaryHover) then
  2263. WorldMapTooltip:ClearAllPoints()
  2264. WorldMapTooltip:SetPoint ("bottomleft", WorldQuestTracker.HaveZoneSummaryHover, "bottomright", 2, 0) -- + diff
  2265. end
  2266.  
  2267. if (OnUpdateDelay < 0) then
  2268. if (WorldQuestTracker.db.profile.map_lock and (GetCurrentMapContinent() == 8 or WorldQuestTracker.WorldQuestButton_Click+30 > GetTime())) then
  2269. if (WorldQuestTracker.CanChangeMap) then
  2270. WorldQuestTracker.CanChangeMap = nil
  2271. WorldQuestTracker.LastMapID = GetCurrentMapAreaID()
  2272. else
  2273. if (WorldQuestTracker.LastMapID ~= GetCurrentMapAreaID() and WorldQuestTracker.LastMapID and not InCombatLockdown()) then
  2274. SetMapByID (WorldQuestTracker.LastMapID)
  2275. WorldQuestTracker.UpdateZoneWidgets()
  2276. end
  2277. end
  2278. end
  2279.  
  2280. if (WorldQuestTracker.WorldMapFrameReference) then
  2281. if (WorldQuestTrackerAddon.GetCurrentZoneType() == "world") then
  2282. if (not WorldQuestTracker.WorldMapFrameReference:IsShown()) then
  2283. WorldQuestTracker.UpdateWorldQuestsOnWorldMap (true)
  2284. end
  2285. else
  2286. if (WorldQuestTracker.WorldMapFrameReference:IsShown()) then
  2287. WorldQuestTracker.HideWorldQuestsOnWorldMap()
  2288. end
  2289. end
  2290. end
  2291.  
  2292. OnUpdateDelay = .5
  2293. else
  2294. OnUpdateDelay = OnUpdateDelay - deltaTime
  2295. end
  2296. end)
  2297.  
  2298. local currentMap
  2299. local deny_auto_switch = function()
  2300. WorldQuestTracker.NoAutoSwitchToWorldMap = true
  2301. currentMap = GetCurrentMapAreaID()
  2302. end
  2303.  
  2304. --apos o click, verifica se pode mostrar os widgets e permitir que o mapa seja alterado no proximo tick
  2305. local allow_map_change = function (...)
  2306. if (currentMap == GetCurrentMapAreaID()) then
  2307. WorldQuestTracker.CanShowWorldMapWidgets (true)
  2308. else
  2309. WorldQuestTracker.CanShowWorldMapWidgets (false)
  2310. end
  2311. WorldQuestTracker.CanChangeMap = true
  2312. WorldQuestTracker.LastMapID = GetCurrentMapAreaID()
  2313. WorldQuestTracker.UpdateZoneWidgets()
  2314.  
  2315. if (WorldQuestTracker.LastMapID ~= MAPID_BROKENISLES and WorldQuestTracker.IsPlayingLoadAnimation()) then
  2316. WorldQuestTracker.StopLoadingAnimation()
  2317. end
  2318. end
  2319.  
  2320. WorldMapButton:HookScript ("PreClick", deny_auto_switch)
  2321. WorldMapButton:HookScript ("PostClick", allow_map_change)
  2322.  
  2323. hooksecurefunc ("WorldMap_CreatePOI", function (index, isObjectIcon, atlasIcon)
  2324. local POI = _G [ "WorldMapFramePOI"..index]
  2325. if (POI) then
  2326. POI:HookScript ("PreClick", deny_auto_switch)
  2327. POI:HookScript ("PostClick", allow_map_change)
  2328. end
  2329. end)
  2330.  
  2331. --troca a fun��o de click dos bot�es de quest no mapa da zona
  2332. hooksecurefunc ("WorldMap_GetOrCreateTaskPOI", function (index)
  2333. local button = _G ["WorldMapFrameTaskPOI" .. index]
  2334. if (button:GetScript ("OnClick") ~= questButton_OnClick) then
  2335. --button:SetScript ("OnClick", questButton_OnClick)
  2336. tinsert (WorldQuestTracker.AllTaskPOIs, button)
  2337. end
  2338. end)
  2339.  
  2340. ----------------------------------------------------------------------------------------------------------------------------------------------------------------
  2341. --> zone map widgets
  2342.  
  2343. local clear_widget = function (self)
  2344. self.Glow:Hide()
  2345. self.highlight:Hide()
  2346. self.IsTrackingGlow:Hide()
  2347. self.IsTrackingRareGlow:Hide()
  2348. self.SelectedGlow:Hide()
  2349. self.CriteriaMatchGlow:Hide()
  2350. self.SpellTargetGlow:Hide()
  2351. self.rareSerpent:Hide()
  2352. self.rareGlow:Hide()
  2353. self.blackBackground:Hide()
  2354. self.circleBorder:Hide()
  2355. self.squareBorder:Hide()
  2356. self.timeBlipRed:Hide()
  2357. self.timeBlipOrange:Hide()
  2358. self.timeBlipYellow:Hide()
  2359. self.timeBlipGreen:Hide()
  2360. self.bgFlag:Hide()
  2361. self.blackGradient:Hide()
  2362. self.flagText:Hide()
  2363. self.criteriaIndicator:Hide()
  2364. self.criteriaIndicatorGlow:Hide()
  2365. self.questTypeBlip:Hide()
  2366. self.partySharedBlip:Hide()
  2367. self.flagCriteriaMatchGlow:Hide()
  2368. end
  2369.  
  2370. -- ~zoneicon
  2371. function WorldQuestTracker.CreateZoneWidget (index, name, parent) --~zone
  2372. local button = CreateFrame ("button", name .. index, parent)
  2373. button:SetSize (20, 20)
  2374.  
  2375. button:SetScript ("OnEnter", TaskPOI_OnEnter)
  2376. button:SetScript ("OnLeave", TaskPOI_OnLeave)
  2377. button:SetScript ("OnClick", questButton_OnClick)
  2378.  
  2379. button:RegisterForClicks ("LeftButtonDown", "MiddleButtonDown", "RightButtonDown")
  2380.  
  2381. local supportFrame = CreateFrame ("frame", nil, button)
  2382. supportFrame:SetPoint ("center")
  2383. supportFrame:SetSize (20, 20)
  2384. button.SupportFrame = supportFrame
  2385.  
  2386. button.UpdateTooltip = TaskPOI_OnEnter
  2387. button.worldQuest = true
  2388. button.ClearWidget = clear_widget
  2389.  
  2390. button.Texture = supportFrame:CreateTexture (button:GetName() .. "Texture", "BACKGROUND")
  2391. button.Texture:SetPoint ("center", button, "center")
  2392. button.Texture:SetMask ([[Interface\CharacterFrame\TempPortraitAlphaMask]])
  2393.  
  2394. button.Glow = supportFrame:CreateTexture(button:GetName() .. "Glow", "BACKGROUND", -6)
  2395. button.Glow:SetSize (50, 50)
  2396. button.Glow:SetPoint ("center", button, "center")
  2397. button.Glow:SetTexture ([[Interface/WorldMap/UI-QuestPoi-IconGlow]])
  2398. button.Glow:SetBlendMode ("ADD")
  2399. button.Glow:Hide()
  2400.  
  2401. button.highlight = supportFrame:CreateTexture (nil, "highlight")
  2402. button.highlight:SetTexture ([[Interface\AddOns\WorldQuestTracker\media\highlight_circleT]])
  2403. button.highlight:SetPoint ("center")
  2404. button.highlight:SetSize (16, 16)
  2405.  
  2406. button.IsTrackingGlow = supportFrame:CreateTexture(button:GetName() .. "IsTrackingGlow", "BACKGROUND", -6)
  2407. button.IsTrackingGlow:SetSize (44, 44)
  2408. button.IsTrackingGlow:SetPoint ("center", button, "center")
  2409. button.IsTrackingGlow:SetTexture ([[Interface\AddOns\WorldQuestTracker\media\glow_yellow_roundT]])
  2410. button.IsTrackingGlow:SetBlendMode ("ADD")
  2411. button.IsTrackingGlow:SetAlpha (1)
  2412. button.IsTrackingGlow:Hide()
  2413. button.IsTrackingGlow:SetDesaturated (nil)
  2414. --testing another texture
  2415. button.IsTrackingGlow:SetTexture ([[Interface\Calendar\EventNotificationGlow]])
  2416. button.IsTrackingGlow:SetSize (36, 36)
  2417.  
  2418. button.IsTrackingRareGlow = supportFrame:CreateTexture(button:GetName() .. "IsTrackingRareGlow", "BACKGROUND", -6)
  2419. button.IsTrackingRareGlow:SetSize (44, 44)
  2420. button.IsTrackingRareGlow:SetPoint ("center", button, "center")
  2421. button.IsTrackingRareGlow:SetTexture ([[Interface\AddOns\WorldQuestTracker\media\rare_dragon_TrackingT]])
  2422. --button.IsTrackingRareGlow:SetBlendMode ("ADD")
  2423. button.IsTrackingRareGlow:Hide()
  2424.  
  2425. button.Shadow = supportFrame:CreateTexture(button:GetName() .. "Shadow", "BACKGROUND", -8)
  2426. button.Shadow:SetSize (24, 24)
  2427. button.Shadow:SetPoint ("center", button, "center")
  2428. button.Shadow:SetTexture ([[Interface\AddOns\WorldQuestTracker\media\glow_yellow_roundT]])
  2429. button.Shadow:SetTexture ([[Interface\PETBATTLES\BattleBar-AbilityBadge-Neutral]])
  2430. button.Shadow:SetAlpha (1)
  2431.  
  2432. local onStartTrackAnimation = DF:CreateAnimationHub (button.IsTrackingGlow, onStartClickAnimation)
  2433. WorldQuestTracker:CreateAnimation (onStartTrackAnimation, "Scale", 1, .10, .9, .9, 1.1, 1.1)
  2434. WorldQuestTracker:CreateAnimation (onStartTrackAnimation, "Scale", 2, .10, 1.2, 1.2, 1, 1)
  2435.  
  2436. local onEndTrackAnimation = DF:CreateAnimationHub (button.IsTrackingGlow, onStartClickAnimation, onEndClickAnimation)
  2437. WorldQuestTracker:CreateAnimation (onEndTrackAnimation, "Scale", 1, .5, 1, 1, .1, .1)
  2438. button.onStartTrackAnimation = onStartTrackAnimation
  2439. button.onEndTrackAnimation = onEndTrackAnimation
  2440.  
  2441. button.SelectedGlow = supportFrame:CreateTexture (button:GetName() .. "SelectedGlow", "OVERLAY", 2)
  2442. button.SelectedGlow:SetBlendMode ("ADD")
  2443. button.SelectedGlow:SetPoint ("center", button, "center")
  2444.  
  2445. button.CriteriaMatchGlow = supportFrame:CreateTexture(button:GetName() .. "CriteriaMatchGlow", "BACKGROUND", -1)
  2446. button.CriteriaMatchGlow:SetAlpha (.6)
  2447. button.CriteriaMatchGlow:SetBlendMode ("ADD")
  2448. button.CriteriaMatchGlow:SetPoint ("center", button, "center")
  2449. local w, h = button.CriteriaMatchGlow:GetSize()
  2450. button.CriteriaMatchGlow:SetAlpha (1)
  2451. button.flagCriteriaMatchGlow = supportFrame:CreateTexture (nil, "background")
  2452. button.flagCriteriaMatchGlow:SetTexture ([[Interface\AddOns\WorldQuestTracker\media\icon_flag_criteriamatchT]])
  2453. button.flagCriteriaMatchGlow:SetPoint ("top", button, "bottom", 0, 3)
  2454. button.flagCriteriaMatchGlow:SetSize (64, 32)
  2455.  
  2456. button.SpellTargetGlow = supportFrame:CreateTexture(button:GetName() .. "SpellTargetGlow", "OVERLAY", 1)
  2457. button.SpellTargetGlow:SetAtlas ("worldquest-questmarker-abilityhighlight", true)
  2458. button.SpellTargetGlow:SetAlpha (.6)
  2459. button.SpellTargetGlow:SetBlendMode ("ADD")
  2460. button.SpellTargetGlow:SetPoint ("center", button, "center")
  2461.  
  2462. button.rareSerpent = supportFrame:CreateTexture (button:GetName() .. "RareSerpent", "OVERLAY")
  2463. button.rareSerpent:SetWidth (34 * 1.1)
  2464. button.rareSerpent:SetHeight (34 * 1.1)
  2465. button.rareSerpent:SetPoint ("CENTER", 1, -2)
  2466.  
  2467. -- � a sombra da serpente no fundo, pode ser na cor azul ou roxa
  2468. button.rareGlow = supportFrame:CreateTexture (nil, "background")
  2469. --button.rareGlow:SetTexture ([[Interface\AddOns\WorldQuestTracker\media\rare_dragonT]])
  2470. button.rareGlow:SetPoint ("CENTER", 1, -2)
  2471. button.rareGlow:SetSize (48, 48)
  2472. button.rareGlow:SetAlpha (.85)
  2473.  
  2474. --fundo preto
  2475. button.blackBackground = supportFrame:CreateTexture (nil, "background")
  2476. button.blackBackground:SetPoint ("center")
  2477. button.blackBackground:Hide()
  2478.  
  2479. --borda circular - nao da scala por causa do set point!
  2480. button.circleBorder = supportFrame:CreateTexture (nil, "OVERLAY")
  2481. button.circleBorder:SetPoint ("topleft", supportFrame, "topleft", -1, 1)
  2482. button.circleBorder:SetPoint ("bottomright", supportFrame, "bottomright", 1, -1)
  2483. button.circleBorder:SetTexture ([[Interface\AddOns\WorldQuestTracker\media\border_zone_browT]])
  2484. button.circleBorder:SetTexCoord (0, 1, 0, 1)
  2485. --problema das quests de profiss�o com verde era a circleBorder
  2486.  
  2487. button.glassTransparence = supportFrame:CreateTexture (nil, "OVERLAY", 1)
  2488. button.glassTransparence:SetTexture ([[Interface\AddOns\WorldQuestTracker\media\icon_transparency_overlay]])
  2489. button.glassTransparence:SetPoint ("topleft", button, "topleft", -1, 1)
  2490. button.glassTransparence:SetPoint ("bottomright", button, "bottomright", 1, -1)
  2491. button.glassTransparence:SetAlpha (.5)
  2492. button.glassTransparence:Hide()
  2493.  
  2494. --borda quadrada
  2495. button.squareBorder = supportFrame:CreateTexture (nil, "OVERLAY", 1)
  2496. button.squareBorder:SetTexture ([[Interface\AddOns\WorldQuestTracker\media\border_whiteT]])
  2497. button.squareBorder:SetPoint ("topleft", button, "topleft", -1, 1)
  2498. button.squareBorder:SetPoint ("bottomright", button, "bottomright", 1, -1)
  2499.  
  2500. --blip do tempo restante
  2501. button.timeBlipRed = supportFrame:CreateTexture (nil, "OVERLAY")
  2502. button.timeBlipRed:SetPoint ("bottomright", button, "bottomright", 4, -4)
  2503. button.timeBlipRed:SetSize (WORLDMAP_SQUARE_TIMEBLIP_SIZE, WORLDMAP_SQUARE_TIMEBLIP_SIZE)
  2504. button.timeBlipRed:SetTexture ([[Interface\COMMON\Indicator-Red]])
  2505. button.timeBlipRed:SetVertexColor (1, 1, 1)
  2506. button.timeBlipRed:SetAlpha (1)
  2507.  
  2508. button.timeBlipOrange = supportFrame:CreateTexture (nil, "OVERLAY")
  2509. button.timeBlipOrange:SetPoint ("bottomright", button, "bottomright", 4, -4)
  2510. button.timeBlipOrange:SetSize (WORLDMAP_SQUARE_TIMEBLIP_SIZE, WORLDMAP_SQUARE_TIMEBLIP_SIZE)
  2511. button.timeBlipOrange:SetTexture ([[Interface\COMMON\Indicator-Yellow]])
  2512. button.timeBlipOrange:SetVertexColor (1, .7, 0)
  2513. button.timeBlipOrange:SetAlpha (.9)
  2514.  
  2515. button.timeBlipYellow = supportFrame:CreateTexture (nil, "OVERLAY")
  2516. button.timeBlipYellow:SetPoint ("bottomright", button, "bottomright", 4, -4)
  2517. button.timeBlipYellow:SetSize (WORLDMAP_SQUARE_TIMEBLIP_SIZE, WORLDMAP_SQUARE_TIMEBLIP_SIZE)
  2518. button.timeBlipYellow:SetTexture ([[Interface\COMMON\Indicator-Yellow]])
  2519. button.timeBlipYellow:SetVertexColor (1, 1, 1)
  2520. button.timeBlipYellow:SetAlpha (.8)
  2521.  
  2522. button.timeBlipGreen = supportFrame:CreateTexture (nil, "OVERLAY")
  2523. button.timeBlipGreen:SetPoint ("bottomright", button, "bottomright", 4, -4)
  2524. button.timeBlipGreen:SetSize (WORLDMAP_SQUARE_TIMEBLIP_SIZE, WORLDMAP_SQUARE_TIMEBLIP_SIZE)
  2525. button.timeBlipGreen:SetTexture ([[Interface\COMMON\Indicator-Green]])
  2526. button.timeBlipGreen:SetVertexColor (1, 1, 1)
  2527. button.timeBlipGreen:SetAlpha (.6)
  2528.  
  2529. --blip do indicador de tipo da quest (zone)
  2530. button.questTypeBlip = supportFrame:CreateTexture (nil, "OVERLAY", 2)
  2531. button.questTypeBlip:SetPoint ("topright", button, "topright", 3, 1)
  2532. button.questTypeBlip:SetSize (10, 10)
  2533. button.questTypeBlip:SetAlpha (.8)
  2534.  
  2535. --blip do indicador de party share
  2536. button.partySharedBlip = supportFrame:CreateTexture (nil, "OVERLAY", 2)
  2537. button.partySharedBlip:SetPoint ("topleft", button, "topleft", -3, 1)
  2538. button.partySharedBlip:SetSize (10, 10)
  2539. button.partySharedBlip:SetTexture ([[Interface\AddOns\WorldQuestTracker\media\icon_party_sharedT]])
  2540.  
  2541. --faixa com o tempo
  2542. button.bgFlag = supportFrame:CreateTexture (nil, "OVERLAY", 5)
  2543. button.bgFlag:SetTexture ([[Interface\AddOns\WorldQuestTracker\media\icon_flagT]])
  2544. button.bgFlag:SetPoint ("top", button, "bottom", 0, 3)
  2545. button.bgFlag:SetSize (64, 64)
  2546.  
  2547. button.blackGradient = supportFrame:CreateTexture (nil, "OVERLAY")
  2548. button.blackGradient:SetTexture ([[Interface\AddOns\WorldQuestTracker\media\background_blackgradientT]])
  2549. button.blackGradient:SetPoint ("top", button.bgFlag, "top", 0, -1)
  2550. button.blackGradient:SetSize (32, 10)
  2551. button.blackGradient:SetAlpha (.7)
  2552.  
  2553. --string da flag
  2554. button.flagText = supportFrame:CreateFontString (nil, "OVERLAY", "GameFontNormal")
  2555. button.flagText:SetText ("13m")
  2556. button.flagText:SetPoint ("top", button.bgFlag, "top", 0, -2)
  2557. DF:SetFontSize (button.flagText, 8)
  2558.  
  2559. local criteriaFrame = CreateFrame ("frame", nil, supportFrame)
  2560. local criteriaIndicator = criteriaFrame:CreateTexture (nil, "OVERLAY", 4)
  2561. criteriaIndicator:SetPoint ("bottomleft", button, "bottomleft", -2, -2)
  2562. criteriaIndicator:SetSize (23*.3, 37*.3)
  2563. criteriaIndicator:SetAlpha (.8)
  2564. criteriaIndicator:SetTexture ([[Interface\AdventureMap\AdventureMap]])
  2565. criteriaIndicator:SetTexCoord (901/1024, 924/1024, 251/1024, 288/1024)
  2566. criteriaIndicator:Hide()
  2567. local criteriaIndicatorGlow = criteriaFrame:CreateTexture (nil, "OVERLAY", 3)
  2568. criteriaIndicatorGlow:SetPoint ("center", criteriaIndicator, "center")
  2569. criteriaIndicatorGlow:SetSize (13, 13)
  2570. criteriaIndicatorGlow:SetTexture ([[Interface\AddOns\WorldQuestTracker\media\criteriaIndicatorGlowT]])
  2571. criteriaIndicatorGlow:SetTexCoord (0, 1, 0, 1)
  2572. criteriaIndicatorGlow:Hide()
  2573.  
  2574. local criteriaAnimation = DF:CreateAnimationHub (criteriaFrame)
  2575. DF:CreateAnimation (criteriaAnimation, "Scale", 1, .15, 1, 1, 1.1, 1.1)
  2576. DF:CreateAnimation (criteriaAnimation, "Scale", 2, .15, 1.2, 1.2, 1, 1)
  2577. button.CriteriaAnimation = criteriaAnimation
  2578.  
  2579. button.Shadow:SetDrawLayer ("BACKGROUND", -8)
  2580. button.blackBackground:SetDrawLayer ("BACKGROUND", -7)
  2581. button.IsTrackingGlow:SetDrawLayer ("BACKGROUND", -6)
  2582. button.Glow:SetDrawLayer ("BACKGROUND", -6)
  2583. button.Texture:SetDrawLayer ("BACKGROUND", -5)
  2584. button.glassTransparence:SetDrawLayer ("BACKGROUND", -4)
  2585.  
  2586. button.IsTrackingRareGlow:SetDrawLayer ("overlay", 0)
  2587. button.circleBorder:SetDrawLayer ("overlay", 1)
  2588. button.squareBorder:SetDrawLayer ("overlay", 1)
  2589. button.rareSerpent:SetDrawLayer ("overlay", 3)
  2590. button.bgFlag:SetDrawLayer ("overlay", 4)
  2591. button.blackGradient:SetDrawLayer ("overlay", 5)
  2592. button.flagText:SetDrawLayer ("overlay", 6)
  2593. criteriaIndicator:SetDrawLayer ("overlay", 6)
  2594. criteriaIndicatorGlow:SetDrawLayer ("overlay", 7)
  2595. button.timeBlipRed:SetDrawLayer ("overlay", 7)
  2596. button.timeBlipOrange:SetDrawLayer ("overlay", 7)
  2597. button.timeBlipYellow:SetDrawLayer ("overlay", 7)
  2598. button.timeBlipGreen:SetDrawLayer ("overlay", 7)
  2599. button.questTypeBlip:SetDrawLayer ("overlay", 7)
  2600. button.partySharedBlip:SetDrawLayer ("overlay", 7)
  2601.  
  2602. button.criteriaIndicator = criteriaIndicator
  2603. button.criteriaIndicatorGlow = criteriaIndicatorGlow
  2604.  
  2605. button.bgFlag:Hide()
  2606.  
  2607. return button
  2608. end
  2609.  
  2610. --cria os widgets no mapa da zona
  2611. function WorldQuestTracker.GetOrCreateZoneWidget (info, index)
  2612. local taskPOI = WorldWidgetPool [index]
  2613.  
  2614. if (not taskPOI) then
  2615. taskPOI = WorldQuestTracker.CreateZoneWidget (index, "WorldQuestTrackerZonePOIWidget", WorldMapPOIFrame)
  2616. taskPOI.IsZoneQuestButton = true
  2617. WorldWidgetPool [index] = taskPOI
  2618. end
  2619.  
  2620. return taskPOI
  2621. end
  2622.  
  2623. --esconde todos os widgets de zona
  2624. function WorldQuestTracker.HideZoneWidgets()
  2625. for i = 1, #WorldWidgetPool do
  2626. WorldWidgetPool [i]:Hide()
  2627. end
  2628. end
  2629.  
  2630. --C_Timer.After (2, function()
  2631. -- function WorldMap_DoesWorldQuestInfoPassFilters (info, ignoreTypeFilters, ignoreTimeRequirement)
  2632. -- print (info, ignoreTypeFilters, ignoreTimeRequirement)
  2633. -- return true
  2634. -- end
  2635. --end)
  2636.  
  2637. --atualiza as quest do mapa da zona ~updatezone ~zoneupdate
  2638. function WorldQuestTracker.UpdateZoneWidgets()
  2639.  
  2640. local mapID = GetCurrentMapAreaID()
  2641.  
  2642. if (mapID == MAPID_BROKENISLES or mapID ~= WorldQuestTracker.LastMapID) then
  2643. return WorldQuestTracker.HideZoneWidgets()
  2644. elseif (not WorldQuestTracker.IsBrokenIslesZone (mapID)) then
  2645. return WorldQuestTracker.HideZoneWidgets()
  2646. end
  2647.  
  2648. WorldQuestTracker.RefreshStatusBar()
  2649.  
  2650. WorldQuestTracker.lastZoneWidgetsUpdate = GetTime()
  2651.  
  2652. --local taskInfo = GetQuestsForPlayerByMapID (mapID, 1007)
  2653. local taskInfo
  2654. if (mapID == 1014) then
  2655. --taskInfo = GetQuestsForPlayerByMapID (mapID, 1007)
  2656. taskInfo = GetQuestsForPlayerByMapID (mapID) --fix from @legowxelab2z8 from curse
  2657. else
  2658. taskInfo = GetQuestsForPlayerByMapID (mapID, mapID)
  2659. end
  2660.  
  2661. local index = 1
  2662.  
  2663. --parar a anima��o de loading
  2664. if (WorldQuestTracker.IsPlayingLoadAnimation()) then
  2665. WorldQuestTracker.StopLoadingAnimation()
  2666. end
  2667.  
  2668. local filters = WorldQuestTracker.db.profile.filters
  2669. local forceShowBrokenShore = WorldQuestTracker.db.profile.filter_force_show_brokenshore
  2670.  
  2671. wipe (WorldQuestTracker.Cache_ShownQuestOnZoneMap)
  2672. wipe (WorldQuestTracker.Cache_ShownWidgetsOnZoneMap)
  2673. local total_Gold, total_Resources, total_APower = 0, 0, 0
  2674. local scale = WorldQuestTracker.db.profile.zonemap_widgets.scale
  2675.  
  2676. if (taskInfo and #taskInfo > 0) then
  2677. for i, info in ipairs (taskInfo) do
  2678. local questID = info.questId
  2679. if (HaveQuestData (questID)) then
  2680. local isWorldQuest = QuestMapFrame_IsQuestWorldQuest (questID)
  2681. if (isWorldQuest) then
  2682.  
  2683. local isSuppressed = WorldMap_IsWorldQuestSuppressed (questID)
  2684. local passFilters = WorldMap_DoesWorldQuestInfoPassFilters (info, true, true) --blizzard filters
  2685. local timeLeft = WorldQuestTracker.GetQuest_TimeLeft (questID)
  2686.  
  2687. if (not isSuppressed and passFilters and timeLeft > 3) then
  2688. C_TaskQuest.RequestPreloadRewardData (questID)
  2689.  
  2690. local tagID, tagName, worldQuestType, rarity, isElite, tradeskillLineIndex, allowDisplayPastCritical = GetQuestTagInfo (questID) -- allowDisplayPastCritical 7.2
  2691.  
  2692. ------ adicionados para fazer o filtro
  2693. --gold
  2694. local gold, goldFormated = WorldQuestTracker.GetQuestReward_Gold (questID)
  2695. --class hall resource
  2696. local rewardName, rewardTexture, numRewardItems = WorldQuestTracker.GetQuestReward_Resource (questID)
  2697. --item
  2698. local itemName, itemTexture, itemLevel, quantity, quality, isUsable, itemID, isArtifact, artifactPower, isStackable, stackAmount = WorldQuestTracker.GetQuestReward_Item (questID)
  2699. ------
  2700.  
  2701. local filter, order = WorldQuestTracker.GetQuestFilterTypeAndOrder (worldQuestType, gold, rewardName, itemName, isArtifact, stackAmount, numRewardItems, rewardTexture)
  2702.  
  2703. -- ~legion
  2704. -- worldQuestType == LE_QUEST_TAG_TYPE_INVASION
  2705. -- LE_QUEST_TAG_TYPE_RAID
  2706. --
  2707.  
  2708. local passFilter = filters [filter]
  2709. if (not passFilter) then
  2710. if (rarity == LE_WORLD_QUEST_QUALITY_EPIC) then
  2711. passFilter = true
  2712. elseif (WorldQuestTracker.db.profile.filter_always_show_faction_objectives) then
  2713. local isCriteria = WorldMapFrame.UIElementsFrame.BountyBoard:IsWorldQuestCriteriaForSelectedBounty (questID)
  2714. if (isCriteria) then
  2715. passFilter = true
  2716. end
  2717. end
  2718. elseif (WorldQuestTracker.db.profile.zone_only_tracked) then
  2719. if (not WorldQuestTracker.IsQuestBeingTracked (questID)) then
  2720. passFilter = false
  2721. end
  2722. end
  2723.  
  2724. if (passFilter or (forceShowBrokenShore and mapID == 1021)) then
  2725. local widget = WorldQuestTracker.GetOrCreateZoneWidget (info, index)
  2726.  
  2727. local selected = questID == GetSuperTrackedQuestID()
  2728. local isCriteria = WorldMapFrame.UIElementsFrame.BountyBoard:IsWorldQuestCriteriaForSelectedBounty (questID)
  2729. local isSpellTarget = SpellCanTargetQuest() and IsQuestIDValidSpellTarget (questID)
  2730.  
  2731. widget.mapID = mapID
  2732. widget.questID = questID
  2733. widget.numObjectives = info.numObjectives
  2734. widget.Order = order or 1
  2735.  
  2736. local inProgress
  2737. WorldQuestTracker.SetupWorldQuestButton (widget, worldQuestType, rarity, isElite, tradeskillLineIndex, inProgress, selected, isCriteria, isSpellTarget, mapID)
  2738. WorldMapPOIFrame_AnchorPOI (widget, info.x, info.y, WORLD_MAP_POI_FRAME_LEVEL_OFFSETS.WORLD_QUEST)
  2739.  
  2740. tinsert (WorldQuestTracker.Cache_ShownQuestOnZoneMap, questID)
  2741. tinsert (WorldQuestTracker.Cache_ShownWidgetsOnZoneMap, widget)
  2742.  
  2743. widget.SupportFrame:SetScale (scale)
  2744. --widget.circleBorder:SetScale (1.3)
  2745.  
  2746. if (gold) then
  2747. total_Gold = total_Gold + gold
  2748. end
  2749. if (numRewardItems) then
  2750. total_Resources = total_Resources + numRewardItems
  2751. end
  2752. if (isArtifact) then
  2753. total_APower = total_APower + artifactPower
  2754. end
  2755.  
  2756. if (WorldQuestTracker.Temp_HideZoneWidgets > GetTime()) then
  2757. widget:Hide()
  2758. for _, button in ipairs (WorldQuestTracker.AllTaskPOIs) do
  2759. if (button.questID == questID) then
  2760. button:Show()
  2761. end
  2762. end
  2763. else
  2764. widget:Show()
  2765. for _, button in ipairs (WorldQuestTracker.AllTaskPOIs) do
  2766. if (button.questID == questID) then
  2767. button:Hide()
  2768. end
  2769. end
  2770. end
  2771.  
  2772. index = index + 1
  2773. else
  2774. --precisa hidar o widget da UI default
  2775. for i = 1, #WorldQuestTracker.AllTaskPOIs do
  2776. if (WorldQuestTracker.AllTaskPOIs [i].questID == questID) then
  2777. --print ("achou o botao")
  2778. WorldQuestTracker.AllTaskPOIs [i]:Hide()
  2779. end
  2780. end
  2781. end
  2782. end
  2783. end
  2784. else
  2785. WorldQuestTracker.ScheduleZoneMapUpdate()
  2786. end
  2787. end
  2788. else
  2789. WorldQuestTracker.ScheduleZoneMapUpdate (3)
  2790. end
  2791.  
  2792. for i = index, #WorldWidgetPool do
  2793. WorldWidgetPool [i]:Hide()
  2794. end
  2795.  
  2796. if (WorldQuestTracker.WorldMap_GoldIndicator) then
  2797. WorldQuestTracker.WorldMap_GoldIndicator.text = floor (total_Gold / 10000)
  2798. if (total_Resources >= 1000) then
  2799. WorldQuestTracker.WorldMap_ResourceIndicator.text = WorldQuestTracker.ToK (total_Resources)
  2800. else
  2801. WorldQuestTracker.WorldMap_ResourceIndicator.text = total_Resources
  2802. end
  2803. if (total_APower >= 1000) then
  2804. WorldQuestTracker.WorldMap_APowerIndicator.text = WorldQuestTracker.ToK (total_APower)
  2805. else
  2806. WorldQuestTracker.WorldMap_APowerIndicator.text = total_APower
  2807. end
  2808. WorldQuestTracker.WorldMap_APowerIndicator.Amount = total_APower
  2809. end
  2810.  
  2811. WorldQuestTracker.UpdateZoneSummaryFrame()
  2812.  
  2813. end
  2814.  
  2815. WorldMapActionButtonPressed = function()
  2816. WorldQuestTracker.Temp_HideZoneWidgets = GetTime() + 5
  2817. WorldQuestTracker.UpdateZoneWidgets()
  2818. WorldQuestTracker.ScheduleZoneMapUpdate (6)
  2819. end
  2820. hooksecurefunc ("ClickWorldMapActionButton", function()
  2821. WorldMapActionButtonPressed()
  2822. end)
  2823.  
  2824. --atualiza o widget da quest no mapa da zona ~setupzone ~updatezone ~zoneupdate
  2825. function WorldQuestTracker.SetupWorldQuestButton (self, worldQuestType, rarity, isElite, tradeskillLineIndex, inProgress, selected, isCriteria, isSpellTarget, mapID)
  2826. local questID = self.questID
  2827. if (not questID) then
  2828. return
  2829. end
  2830.  
  2831. self.worldQuestType = worldQuestType
  2832. self.rarity = rarity
  2833. self.isElite = isElite
  2834. self.tradeskillLineIndex = tradeskillLineIndex
  2835. self.inProgress = inProgress
  2836. self.selected = selected
  2837. self.isCriteria = isCriteria
  2838. self.isSpellTarget = isSpellTarget
  2839.  
  2840. self.isArtifact = nil
  2841. self.circleBorder:Hide()
  2842. self.squareBorder:Hide()
  2843. self.flagText:SetText ("")
  2844. self.Glow:Hide()
  2845. self.SelectedGlow:Hide()
  2846. self.CriteriaMatchGlow:Hide()
  2847. self.SpellTargetGlow:Hide()
  2848. self.IsTrackingGlow:Hide()
  2849. self.IsTrackingRareGlow:Hide()
  2850. self.rareSerpent:Hide()
  2851. self.rareGlow:Hide()
  2852. self.blackBackground:Hide()
  2853. -- self.criteriaIndicator:Hide()
  2854. -- self.criteriaIndicatorGlow:Hide()
  2855. self.flagCriteriaMatchGlow:Hide()
  2856. self.questTypeBlip:Hide()
  2857. self.partySharedBlip:Hide()
  2858.  
  2859. self.isSelected = selected
  2860. self.isCriteria = isCriteria
  2861. self.isSpellTarget = isSpellTarget
  2862.  
  2863. self.flagText:Show()
  2864. self.timeBlipRed:Hide()
  2865. self.timeBlipOrange:Hide()
  2866. self.timeBlipYellow:Hide()
  2867. self.timeBlipGreen:Hide()
  2868. self.blackGradient:Show()
  2869.  
  2870. self.Texture:SetMask ([[Interface\CharacterFrame\TempPortraitAlphaMask]])
  2871.  
  2872. if (HaveQuestData (questID)) then
  2873. local title, factionID, tagID, tagName, worldQuestType, rarity, isElite, tradeskillLineIndex = WorldQuestTracker.GetQuest_Info (questID)
  2874.  
  2875. if (self.isCriteria) then
  2876. if (not self.criteriaIndicator:IsShown()) then
  2877. self.CriteriaAnimation:Play()
  2878. end
  2879. --self.flagCriteriaMatchGlow:Show()
  2880. self.criteriaIndicator:Show()
  2881. self.criteriaIndicatorGlow:Show()
  2882. else
  2883. self.flagCriteriaMatchGlow:Hide()
  2884. self.criteriaIndicator:Hide()
  2885. self.criteriaIndicatorGlow:Hide()
  2886. end
  2887.  
  2888. if (not WorldQuestTracker.db.profile.use_tracker) then
  2889. if (WorldQuestTracker.IsQuestOnObjectiveTracker (questID)) then
  2890. if (rarity == LE_WORLD_QUEST_QUALITY_RARE or rarity == LE_WORLD_QUEST_QUALITY_EPIC) then
  2891. self.IsTrackingRareGlow:Show()
  2892. end
  2893. self.IsTrackingGlow:Show()
  2894. end
  2895. else
  2896. if (WorldQuestTracker.IsQuestBeingTracked (questID)) then
  2897. if (rarity == LE_WORLD_QUEST_QUALITY_RARE or rarity == LE_WORLD_QUEST_QUALITY_EPIC) then
  2898. if (mapID ~= suramar_mapId) then
  2899. self.IsTrackingRareGlow:Show()
  2900. end
  2901. end
  2902. self.IsTrackingGlow:Show()
  2903. end
  2904. end
  2905.  
  2906. if (worldQuestType == LE_QUEST_TAG_TYPE_PVP) then
  2907. self.questTypeBlip:Show()
  2908. self.questTypeBlip:SetTexture ([[Interface\PVPFrame\Icon-Combat]])
  2909. self.questTypeBlip:SetTexCoord (0, 1, 0, 1)
  2910. self.questTypeBlip:SetAlpha (1)
  2911. --self.questTypeBlip:SetTexture ([[Interface\PVPFrame\Icons\prestige-icon-2]])
  2912. --self.questTypeBlip:SetTexture ([[Interface\PvPRankBadges\PvPRank01]])
  2913. elseif (worldQuestType == LE_QUEST_TAG_TYPE_PET_BATTLE) then
  2914. self.questTypeBlip:Show()
  2915. self.questTypeBlip:SetTexture ([[Interface\MINIMAP\ObjectIconsAtlas]])
  2916. --self.questTypeBlip:SetTexCoord (172/512, 201/512, 273/512, 301/512)
  2917. self.questTypeBlip:SetTexCoord (376/512, 403/512, 239/512, 265/512) -- left right top botton
  2918. self.questTypeBlip:SetAlpha (1)
  2919.  
  2920. elseif (worldQuestType == LE_QUEST_TAG_TYPE_PROFESSION) then
  2921.  
  2922. elseif (worldQuestType == LE_QUEST_TAG_TYPE_DUNGEON) then
  2923.  
  2924. else
  2925. self.questTypeBlip:Hide()
  2926. end
  2927.  
  2928. --shared quest (zone)
  2929. if (WorldQuestTracker.IsPartyQuest (questID)) then
  2930. self.partySharedBlip:Show()
  2931. end
  2932.  
  2933. -- tempo restante
  2934. local timeLeft = WorldQuestTracker.GetQuest_TimeLeft (questID)
  2935. if (timeLeft and timeLeft > 0) then
  2936. WorldQuestTracker.SetTimeBlipColor (self, timeLeft)
  2937. local okay = false
  2938.  
  2939. -- gold
  2940. local goldReward, goldFormated = WorldQuestTracker.GetQuestReward_Gold (questID)
  2941. if (goldReward > 0) then
  2942. local texture = WorldQuestTracker.GetGoldIcon()
  2943.  
  2944. WorldQuestTracker.SetIconTexture (self.Texture, texture, false, false)
  2945.  
  2946. --self.Texture:SetTexCoord (0, 1, 0, 1)
  2947. self.Texture:SetSize (16, 16)
  2948. self.IconTexture = texture
  2949. self.IconText = goldFormated
  2950. self.flagText:SetText (goldFormated)
  2951. self.circleBorder:Show()
  2952. self.QuestType = QUESTTYPE_GOLD
  2953.  
  2954. WorldQuestTracker.UpdateBorder (self, rarity, worldQuestType, mapID)
  2955. okay = true
  2956. end
  2957.  
  2958. -- poder de artefato
  2959. local artifactXP = GetQuestLogRewardArtifactXP(questID)
  2960. if ( artifactXP > 0 ) then
  2961. --seta icone de poder de artefato
  2962. --return
  2963. end
  2964.  
  2965. -- class hall resource
  2966. local name, texture, numRewardItems = WorldQuestTracker.GetQuestReward_Resource (questID)
  2967. if (name and not okay) then
  2968. if (texture) then
  2969. self.Texture:SetTexture (texture)
  2970. --self.Texture:SetTexCoord (0, 1, 0, 1)
  2971. --self.squareBorder:Show()
  2972. self.circleBorder:Show()
  2973. self.Texture:SetSize (16, 16)
  2974. self.IconTexture = texture
  2975. self.IconText = numRewardItems
  2976. self.QuestType = QUESTTYPE_RESOURCE
  2977.  
  2978. if (numRewardItems >= 1000) then
  2979. self.flagText:SetText (format ("%.1fK", numRewardItems/1000))
  2980. --self.flagText:SetText (comma_value (numRewardItems))
  2981. else
  2982. self.flagText:SetText (numRewardItems)
  2983. end
  2984.  
  2985. WorldQuestTracker.UpdateBorder (self, rarity, worldQuestType, mapID)
  2986.  
  2987. if (self:GetHighlightTexture()) then
  2988. self:GetHighlightTexture():SetTexture ([[Interface\Store\store-item-highlight]])
  2989. self:GetHighlightTexture():SetTexCoord (0, 1, 0, 1)
  2990. end
  2991. okay = true
  2992. end
  2993. end
  2994.  
  2995. -- items
  2996. local itemName, itemTexture, itemLevel, quantity, quality, isUsable, itemID, isArtifact, artifactPower, isStackable = WorldQuestTracker.GetQuestReward_Item (questID)
  2997. if (itemName) then
  2998. if (isArtifact) then
  2999. local texture = WorldQuestTracker.GetArtifactPowerIcon (artifactPower, true) --
  3000. self.Texture:SetSize (16, 16)
  3001. self.Texture:SetMask (nil)
  3002. self.Texture:SetTexture (texture)
  3003.  
  3004. local research_nameLoc, research_timeleftString, research_timeLeft, research_elapsedTime = WorldQuestTracker:GetNextResearchNoteTime()
  3005. if (research_timeLeft and research_timeLeft > 60) then
  3006. research_timeLeft = research_timeLeft / 60 --convert in minutes
  3007. end
  3008.  
  3009. if (research_timeLeft and research_timeLeft < timeLeft) then
  3010. self.Texture:SetTexture ([[Interface\AddOns\WorldQuestTracker\media\icon_artifactpower_blue_roundT]])
  3011. else
  3012. self.Texture:SetTexture (texture)
  3013. end
  3014.  
  3015. --if (artifactPower >= 1000) then
  3016. -- self.flagText:SetText (format ("%.1fK", artifactPower/1000))
  3017. --self.flagText:SetText (comma_value (artifactPower))
  3018. --else
  3019. -- self.flagText:SetText (artifactPower)
  3020. --end
  3021.  
  3022. if (artifactPower >= 1000) then
  3023. if (artifactPower > 999999) then -- 1M
  3024. self.flagText:SetText (WorldQuestTracker.ToK (artifactPower))
  3025. elseif (artifactPower > 9999) then
  3026. self.flagText:SetText (WorldQuestTracker.ToK (artifactPower))
  3027. else
  3028. self.flagText:SetText (format ("%.1fK", artifactPower/1000))
  3029. end
  3030. else
  3031. self.flagText:SetText (artifactPower)
  3032. end
  3033.  
  3034. self.isArtifact = true
  3035. self.IconTexture = texture
  3036. self.IconText = artifactPower
  3037. self.QuestType = QUESTTYPE_ARTIFACTPOWER
  3038. else
  3039. self.Texture:SetSize (16, 16)
  3040. self.Texture:SetTexture (itemTexture) -- 1387639 slice of bacon
  3041. --self.Texture:SetTexCoord (0, 1, 0, 1)
  3042. if (itemLevel > 600 and itemLevel < 780) then
  3043. itemLevel = 810
  3044. end
  3045.  
  3046. local color = ""
  3047. if (quality == 4 or quality == 3) then
  3048. color = WorldQuestTracker.RarityColors [quality]
  3049. end
  3050.  
  3051. self.flagText:SetText ((isStackable and quantity and quantity >= 1 and quantity or false) or (itemLevel and itemLevel > 5 and (color) .. itemLevel) or "")
  3052. -- /run local f=CreateFrame("frame");f:SetPoint("center");f:SetSize(100,100);local t=f:CreateTexture(nil,"overlay");t:SetSize(100,100);t:SetPoint("center");t:SetTexture(1387639)
  3053.  
  3054. self.IconTexture = itemTexture
  3055. self.IconText = self.flagText:GetText()
  3056. self.QuestType = QUESTTYPE_ITEM
  3057. end
  3058.  
  3059. if (self:GetHighlightTexture()) then
  3060. self:GetHighlightTexture():SetTexture ([[Interface\Store\store-item-highlight]])
  3061. self:GetHighlightTexture():SetTexCoord (0, 1, 0, 1)
  3062. end
  3063.  
  3064. --self.squareBorder:Show()
  3065. self.circleBorder:Show()
  3066.  
  3067. WorldQuestTracker.UpdateBorder (self, rarity, worldQuestType, mapID)
  3068. okay = true
  3069. end
  3070.  
  3071. if (not okay) then
  3072. WorldQuestTracker.ScheduleZoneMapUpdate()
  3073. end
  3074. end
  3075.  
  3076. else
  3077. WorldQuestTracker.ScheduleZoneMapUpdate()
  3078. end
  3079. end
  3080.  
  3081. --agenda uma atualiza��o se algum dado de alguma quest n�o estiver dispon�vel ainda
  3082. local do_zonemap_update = function()
  3083. WorldQuestTracker.UpdateZoneWidgets()
  3084. end
  3085. function WorldQuestTracker.ScheduleZoneMapUpdate (seconds)
  3086. if (WorldQuestTracker.ScheduledZoneUpdate and not WorldQuestTracker.ScheduledZoneUpdate._cancelled) then
  3087. WorldQuestTracker.ScheduledZoneUpdate:Cancel()
  3088. end
  3089. WorldQuestTracker.ScheduledZoneUpdate = C_Timer.NewTimer (seconds or 1, do_zonemap_update)
  3090. end
  3091.  
  3092. ----------------------------------------------------------------------------------------------------------------------------------------------------------------
  3093. --> map automatization
  3094.  
  3095. --muda o mapa para o world map de broken isles
  3096. hooksecurefunc ("WorldMap_UpdateQuestBonusObjectives", function (self, event)
  3097. if (WorldMapFrame:IsShown() and not WorldQuestTracker.NoAutoSwitchToWorldMap) then
  3098. if (WorldQuestTracker.CanShowBrokenIsles()) then
  3099. SetMapByID (MAPID_BROKENISLES)
  3100. WorldQuestTracker.CanChangeMap = true
  3101. WorldQuestTracker.UpdateWorldQuestsOnWorldMap (false, false)
  3102. end
  3103. end
  3104.  
  3105. --depois de ter executa o update, vamos hidar todos os widgets default e criar os nossos
  3106. if (GetCurrentMapAreaID() ~= MAPID_BROKENISLES) then
  3107. --roda nosso custom update e cria nossos proprios widgets
  3108. WorldQuestTracker.UpdateZoneWidgets()
  3109. end
  3110. end)
  3111.  
  3112. --update tick
  3113. --desativa toda a atualiza��o das quests no codigo da interface
  3114. --esta causando problemas com protected, mesmo colocando pra ser uma fun��o aleatoria
  3115. --_G ["WorldMap_UpdateQuestBonusObjectives"] = math.random
  3116. function oie ()
  3117. if (WorldQuestTracker.lastZoneWidgetsUpdate + 20 < GetTime()) then
  3118. WorldQuestTracker.UpdateZoneWidgets()
  3119. end
  3120. end
  3121.  
  3122. --WorldQuestTracker.db.profile.AlertTutorialStep = nil
  3123. -- ~tutorial
  3124. local re_ShowTutorialAlert = function()
  3125. WorldQuestTracker ["ShowTutorialAlert"]()
  3126. end
  3127. local hook_AlertCloseButton = function (self)
  3128. re_ShowTutorialAlert()
  3129. end
  3130. local wait_ShowTutorialAlert = function()
  3131. WorldQuestTracker.TutorialAlertOnHold = nil
  3132. WorldQuestTracker.ShowTutorialAlert()
  3133. end
  3134. function WorldQuestTracker.ShowTutorialAlert()
  3135. if (not WorldQuestTracker.db.profile.GotTutorial) then
  3136. return
  3137. end
  3138.  
  3139. WorldQuestTracker.db.profile.AlertTutorialStep = WorldQuestTracker.db.profile.AlertTutorialStep or 1
  3140.  
  3141. --WorldQuestTracker.db.profile.AlertTutorialStep = 2
  3142.  
  3143. if (WorldQuestTracker.db.profile.AlertTutorialStep == 1) then
  3144.  
  3145. if (WorldQuestTracker.TutorialAlertOnHold) then
  3146. return
  3147. end
  3148.  
  3149. if (not WorldMapFrame:IsShown() or not IsQuestFlaggedCompleted (WORLD_QUESTS_AVAILABLE_QUEST_ID or 1) or InCombatLockdown()) then
  3150. C_Timer.After (10, wait_ShowTutorialAlert)
  3151. WorldQuestTracker.TutorialAlertOnHold = true
  3152. return
  3153. end
  3154.  
  3155. WorldQuestTrackerGoToBIButton:Click()
  3156.  
  3157. local alert = CreateFrame ("frame", "WorldQuestTrackerTutorialAlert1", worldFramePOIs, "MicroButtonAlertTemplate")
  3158. alert:SetFrameLevel (302)
  3159. alert.label = L["S_TUTORIAL_CLICKTOTRACK"]
  3160. alert.Text:SetSpacing (4)
  3161. MicroButtonAlert_SetText (alert, alert.label)
  3162. alert:SetPoint ("topleft", worldFramePOIs, "topleft", 64, -270)
  3163. alert.CloseButton:HookScript ("OnClick", hook_AlertCloseButton)
  3164. alert:Show()
  3165.  
  3166. WorldQuestTracker.db.profile.AlertTutorialStep = WorldQuestTracker.db.profile.AlertTutorialStep + 1
  3167.  
  3168. elseif (WorldQuestTracker.db.profile.AlertTutorialStep == 2) then
  3169. local alert = CreateFrame ("frame", "WorldQuestTrackerTutorialAlert2", worldFramePOIs, "MicroButtonAlertTemplate")
  3170. alert:SetFrameLevel (302)
  3171. alert.label = L["S_TUTORIAL_PARTY"]
  3172. alert.Text:SetSpacing (4)
  3173. MicroButtonAlert_SetText (alert, alert.label)
  3174. alert:SetPoint ("topleft", worldFramePOIs, "topleft", 269, -397)
  3175. alert.CloseButton:HookScript ("OnClick", hook_AlertCloseButton)
  3176. alert.Arrow:ClearAllPoints()
  3177. alert.Arrow:SetPoint ("topleft", alert, "bottomleft", 10, 0)
  3178. alert:Show()
  3179.  
  3180. WorldQuestTracker.db.profile.AlertTutorialStep = WorldQuestTracker.db.profile.AlertTutorialStep + 1
  3181.  
  3182. elseif (WorldQuestTracker.db.profile.AlertTutorialStep == 3) then
  3183. local alert = CreateFrame ("frame", "WorldQuestTrackerTutorialAlert3", worldFramePOIs, "MicroButtonAlertTemplate")
  3184. alert:SetFrameLevel (302)
  3185. alert.label = L["S_TUTORIAL_WORLDMAPBUTTON"]
  3186. alert.Text:SetSpacing (4)
  3187. MicroButtonAlert_SetText (alert, alert.label)
  3188. alert:SetPoint ("topleft", worldFramePOIs, "topleft", 522, -403)
  3189. alert.CloseButton:HookScript ("OnClick", hook_AlertCloseButton)
  3190. alert:Show()
  3191.  
  3192. WorldQuestTracker.db.profile.AlertTutorialStep = WorldQuestTracker.db.profile.AlertTutorialStep + 1
  3193.  
  3194. elseif (WorldQuestTracker.db.profile.AlertTutorialStep == 4) then
  3195. local alert = CreateFrame ("frame", "WorldQuestTrackerTutorialAlert4", worldFramePOIs, "MicroButtonAlertTemplate")
  3196. alert:SetFrameLevel (302)
  3197. alert.label = "Click on Summary to see statistics and a saved list of quests on other characters."
  3198. alert.Text:SetSpacing (4)
  3199. MicroButtonAlert_SetText (alert, alert.label)
  3200. alert:SetPoint ("topleft", worldFramePOIs, "topleft", 0, -393)
  3201. alert.Arrow:ClearAllPoints()
  3202. alert.Arrow:SetPoint ("topleft", alert, "bottomleft", 10, 0)
  3203. alert.CloseButton:HookScript ("OnClick", hook_AlertCloseButton)
  3204. alert:Show()
  3205.  
  3206. WorldQuestTracker.db.profile.AlertTutorialStep = WorldQuestTracker.db.profile.AlertTutorialStep + 1
  3207.  
  3208. end
  3209. end
  3210.  
  3211. --ao abrir ou fechar o mapa ~toggle
  3212. hooksecurefunc ("ToggleWorldMap", function (self)
  3213. if (true) then
  3214. --return
  3215. end
  3216.  
  3217. WorldMapFrame.currentStandingZone = GetCurrentMapAreaID()
  3218.  
  3219. if (GameCooltipFrame1 and GameCooltipFrame2) then
  3220. GameCooltipFrame1:SetParent (UIParent)
  3221. GameCooltipFrame2:SetParent (UIParent)
  3222. end
  3223.  
  3224. if (WorldMapFrame:IsShown()) then
  3225. animFrame:SetScript ("OnUpdate", tickAnimation)
  3226. WorldQuestTracker.MapSeason = WorldQuestTracker.MapSeason + 1
  3227. WorldQuestTracker.MapOpenedAt = GetTime()
  3228. else
  3229. animFrame:SetScript ("OnUpdate", nil)
  3230. for mapId, configTable in pairs (WorldQuestTracker.mapTables) do --WorldQuestTracker.SetIconTexture
  3231. for i, f in ipairs (configTable.widgets) do
  3232. --f:Hide()
  3233. end
  3234. end
  3235. end
  3236.  
  3237. --verifica duplo click
  3238. if (WorldQuestTracker.lastMapTap+0.3 > GetTime() and not InCombatLockdown() and WorldQuestTracker.CanShowBrokenIsles()) then
  3239.  
  3240. --SetMapToCurrentZone()
  3241. SetMapByID (GetCurrentMapAreaID())
  3242.  
  3243. if (not WorldMapFrame:IsShown()) then
  3244. WorldQuestTracker.NoAutoSwitchToWorldMap = true
  3245. WorldMapFrame.mapID = GetCurrentMapAreaID()
  3246. WorldQuestTracker.LastMapID = GetCurrentMapAreaID()
  3247. WorldQuestTracker.CanChangeMap = true
  3248. ToggleWorldMap()
  3249. WorldQuestTracker.CanShowWorldMapWidgets()
  3250. else
  3251. if (WorldQuestTracker.LastMapID ~= GetCurrentMapAreaID()) then
  3252. WorldQuestTracker.NoAutoSwitchToWorldMap = true
  3253. WorldMapFrame.mapID = GetCurrentMapAreaID()
  3254. WorldQuestTracker.LastMapID = GetCurrentMapAreaID()
  3255. WorldQuestTracker.CanChangeMap = true
  3256. ToggleWorldMap()
  3257. WorldQuestTracker.CanShowWorldMapWidgets()
  3258. end
  3259. end
  3260. return
  3261. end
  3262. WorldQuestTracker.lastMapTap = GetTime()
  3263.  
  3264. WorldQuestTracker.LastMapID = WorldMapFrame.mapID
  3265.  
  3266. if (WorldMapFrame:IsShown()) then
  3267. --� a primeira vez que � mostrado?
  3268.  
  3269. if (not WorldMapFrame.firstRun and not InCombatLockdown()) then
  3270. local currentMapId = WorldMapFrame.mapID
  3271. SetMapByID (1015)
  3272. SetMapByID (1018)
  3273. SetMapByID (1024)
  3274. SetMapByID (1017)
  3275. SetMapByID (1033)
  3276. SetMapByID (1096)
  3277. SetMapByID (currentMapId)
  3278. WorldMapFrame.firstRun = true
  3279.  
  3280. --[[
  3281. C_Timer.After (1, function()
  3282. for bountyButton, _ in pairs (WorldMapFrame.UIElementsFrame.BountyBoard.bountyTabPool.activeObjects) do
  3283. bountyButton:HookScript ("OnClick", function()
  3284. if (GetCurrentMapAreaID() == MAPID_BROKENISLES) then
  3285. WorldQuestTracker.UpdateWorldQuestsOnWorldMap (false, false, false, true)
  3286. end
  3287. end)
  3288. end
  3289. end)
  3290. --]]
  3291.  
  3292. --> some addon is adding these words on the global namespace.
  3293. --> I trully believe that it's not intended at all, so let's just clear.
  3294. --> it is messing with the framework.
  3295. _G ["left"] = nil
  3296. _G ["right"] = nil
  3297. _G ["topleft"] = nil
  3298. _G ["topright"] = nil
  3299.  
  3300. local CooltipOnTop_WhenFullScreen = function()
  3301. if (not WorldMapFrame_InWindowedMode()) then
  3302. GameCooltipFrame1:SetParent (WorldMapFrame)
  3303. GameCooltipFrame1:SetFrameLevel (4000)
  3304. GameCooltipFrame2:SetParent (WorldMapFrame)
  3305. GameCooltipFrame2:SetFrameLevel (4000)
  3306. end
  3307. end
  3308.  
  3309. function WorldQuestTracker.OpenSharePanel()
  3310. if (WorldQuestTrackerSharePanel) then
  3311. WorldQuestTrackerSharePanel:Show()
  3312. return
  3313. end
  3314.  
  3315. local f = DF:CreateSimplePanel (UIParent, 460, 90, L["S_SHAREPANEL_TITLE"], "WorldQuestTrackerSharePanel")
  3316. f:SetFrameStrata ("TOOLTIP")
  3317. f:SetPoint ("center", WorldMapScrollFrame, "center")
  3318.  
  3319. DF:CreateBorder (f)
  3320.  
  3321. local text1 = DF:CreateLabel (f, L["S_SHAREPANEL_THANKS"])
  3322. text1:SetPoint ("center", f, "center", 0, -0)
  3323. text1:SetJustifyH ("center")
  3324.  
  3325. local LinkBox = DF:CreateTextEntry (f, function()end, 380, 20, "ExportLinkBox", _, _, DF:GetTemplate ("dropdown", "OPTIONS_DROPDOWN_TEMPLATE"))
  3326. LinkBox:SetPoint ("center", f, "center", 0, -30)
  3327.  
  3328. f:SetScript ("OnShow", function()
  3329. LinkBox:SetText ([[https://mods.curse.com/addons/wow/world-quest-tracker]])
  3330. C_Timer.After (1, function()
  3331. LinkBox:SetFocus (true)
  3332. LinkBox:HighlightText()
  3333. end)
  3334. end)
  3335.  
  3336. f:Hide()
  3337. f:Show()
  3338. end
  3339.  
  3340. --go to broken isles button ~worldquestbutton ~worldmapbutton ~worldbutton
  3341. local WorldQuestButton = CreateFrame ("button", "WorldQuestTrackerGoToBIButton", WorldMapFrame.UIElementsFrame)
  3342. WorldQuestButton:SetSize (64, 32)
  3343. WorldQuestButton:SetPoint ("right", WorldMapFrame.UIElementsFrame.CloseQuestPanelButton, "left", -2, 0)
  3344. WorldQuestButton.Background = WorldQuestButton:CreateTexture (nil, "background")
  3345. WorldQuestButton.Background:SetSize (64, 32)
  3346. WorldQuestButton.Background:SetAtlas ("MapCornerShadow-Right")
  3347. WorldQuestButton.Background:SetPoint ("bottomright", 2, -1)
  3348. WorldQuestButton:SetNormalTexture ([[Interface\AddOns\WorldQuestTracker\media\world_quest_button]])
  3349. WorldQuestButton:GetNormalTexture():SetTexCoord (0, 1, 0, .5)
  3350. WorldQuestButton:SetPushedTexture ([[Interface\AddOns\WorldQuestTracker\media\world_quest_button_pushed]])
  3351. WorldQuestButton:GetPushedTexture():SetTexCoord (0, 1, 0, .5)
  3352.  
  3353. WorldQuestButton.Highlight = WorldQuestButton:CreateTexture (nil, "highlight")
  3354. WorldQuestButton.Highlight:SetTexture ([[Interface\Buttons\UI-Common-MouseHilight]])
  3355. WorldQuestButton.Highlight:SetBlendMode ("ADD")
  3356. WorldQuestButton.Highlight:SetSize (64*1.5, 32*1.5)
  3357. WorldQuestButton.Highlight:SetPoint ("center")
  3358.  
  3359. WorldQuestButton:SetScript ("OnClick", function()
  3360. SetMapByID (MAPID_BROKENISLES)
  3361. PlaySound ("igMainMenuOptionCheckBoxOn")
  3362. WorldQuestTracker.WorldQuestButton_Click = GetTime()
  3363. end)
  3364. WorldQuestButton:HookScript ("PreClick", deny_auto_switch)
  3365. WorldQuestButton:HookScript ("PostClick", allow_map_change)
  3366.  
  3367. -- �ptionsfunc ~optionsfunc
  3368. local options_on_click = function (_, _, option, value, value2, mouseButton)
  3369.  
  3370. if (option == "world_map_config") then
  3371. WorldQuestTracker.db.profile.worldmap_widgets [value] = value2
  3372. if (value == "textsize") then
  3373. WorldQuestTracker.SetTextSize ("WorldMap", value2)
  3374. elseif (value == "scale") then
  3375. if (WorldQuestTrackerAddon.GetCurrentZoneType() == "world") then
  3376. WorldQuestTracker.UpdateWorldQuestsOnWorldMap()
  3377. end
  3378. elseif (value == "disable_world_map_widgets") then
  3379. WorldQuestTracker.db.profile.disable_world_map_widgets = value2
  3380. if (WorldQuestTrackerAddon.GetCurrentZoneType() == "world") then
  3381. WorldQuestTracker.UpdateWorldQuestsOnWorldMap()
  3382. GameCooltip:Close()
  3383. end
  3384. end
  3385. return
  3386.  
  3387. elseif (option == "zone_map_config") then
  3388. WorldQuestTracker.db.profile.zonemap_widgets [value] = value2
  3389. if (WorldQuestTrackerAddon.GetCurrentZoneType() == "zone") then
  3390. WorldQuestTracker.UpdateZoneWidgets()
  3391. end
  3392. return
  3393. end
  3394.  
  3395. if (option:find ("tomtom")) then
  3396. local option = option:gsub ("tomtom%-", "")
  3397. WorldQuestTracker.db.profile.tomtom [option] = value
  3398. GameCooltip:Hide()
  3399.  
  3400. if (option == "enabled") then
  3401. if (value) then
  3402. --adiciona todas as quests to tracker no tomtom
  3403. for i = #WorldQuestTracker.QuestTrackList, 1, -1 do
  3404. local quest = WorldQuestTracker.QuestTrackList [i]
  3405. local questID = quest.questID
  3406. local mapID = quest.mapID
  3407. WorldQuestTracker.AddQuestTomTom (questID, mapID, true)
  3408. end
  3409. WorldQuestTracker.RemoveAllQuestsFromTracker()
  3410. else
  3411. --desligou o tracker do tomtom
  3412. for questID, t in pairs (WorldQuestTracker.db.profile.tomtom.uids) do
  3413. if (type (questID) == "number" and QuestMapFrame_IsQuestWorldQuest (questID)) then
  3414. --procura o bot�o da quest
  3415. for _, widget in ipairs (all_widgets) do
  3416. if (widget.questID == questID) then
  3417. WorldQuestTracker.AddQuestToTracker (widget)
  3418. TomTom:RemoveWaypoint (t)
  3419. break
  3420. end
  3421. end
  3422. end
  3423. end
  3424. wipe (WorldQuestTracker.db.profile.tomtom.uids)
  3425. WorldQuestTracker.UpdateWorldQuestsOnWorldMap (true, false, false, true)
  3426. end
  3427. end
  3428.  
  3429. return
  3430. end
  3431.  
  3432. if (option == "share_addon") then
  3433. WorldQuestTracker.OpenSharePanel()
  3434. GameCooltip:Hide()
  3435. return
  3436.  
  3437. elseif (option == "tracker_scale") then
  3438. WorldQuestTracker.db.profile [option] = value
  3439. WorldQuestTracker.UpdateTrackerScale()
  3440.  
  3441. elseif (option == "clear_quest_cache") then
  3442. if (WorldQuestTrackerAddon.GetCurrentZoneType() == "world") then
  3443. WorldQuestTracker.UpdateWorldQuestsOnWorldMap (true, true, false, true)
  3444. else
  3445.  
  3446. end
  3447.  
  3448. elseif (option == "arrow_update_speed") then
  3449. WorldQuestTracker.db.profile.arrow_update_frequence = value
  3450. WorldQuestTracker.UpdateArrowFrequence()
  3451. GameCooltip:Hide()
  3452. return
  3453.  
  3454. elseif (option == "untrack_quests") then
  3455. WorldQuestTracker.RemoveAllQuestsFromTracker()
  3456.  
  3457. if (TomTom and IsAddOnLoaded ("TomTom")) then
  3458. for questID, t in pairs (WorldQuestTracker.db.profile.tomtom.uids) do
  3459. TomTom:RemoveWaypoint (t)
  3460. end
  3461. wipe (WorldQuestTracker.db.profile.tomtom.uids)
  3462. end
  3463.  
  3464. GameCooltip:Hide()
  3465. return
  3466.  
  3467. elseif (option == "use_quest_summary") then
  3468. WorldQuestTracker.db.profile [option] = value
  3469. if (WorldQuestTrackerAddon.GetCurrentZoneType() == "zone") then
  3470. WorldQuestTracker.UpdateZoneWidgets()
  3471. end
  3472. else
  3473. WorldQuestTracker.db.profile [option] = value
  3474. if (option == "bar_anchor") then
  3475. WorldQuestTracker:SetStatusBarAnchor()
  3476.  
  3477. elseif (option == "use_old_icons") then
  3478. if (WorldQuestTrackerAddon.GetCurrentZoneType() == "world") then
  3479. WorldQuestTracker.UpdateWorldQuestsOnWorldMap (true, true, false, true)
  3480. else
  3481. WorldQuestTracker.UpdateZoneWidgets()
  3482. end
  3483. end
  3484. end
  3485.  
  3486. if (option == "zone_only_tracked") then
  3487. if (WorldQuestTrackerAddon.GetCurrentZoneType() == "zone") then
  3488. WorldQuestTracker.UpdateZoneWidgets()
  3489. end
  3490. end
  3491.  
  3492. if (option == "tracker_is_locked") then
  3493. --> s� aparece esta op��o quando o tracker esta m�vel
  3494. if (WorldQuestTracker.db.profile.tracker_is_movable) then
  3495. if (value) then
  3496. --> o tracker agora esta trancado - desliga o mouse
  3497. WorldQuestTrackerScreenPanel:EnableMouse (false)
  3498. --LibWindow.MakeDraggable (WorldQuestTrackerScreenPanel)
  3499. else
  3500. --> o tracker agora est� movel - liga o mouse
  3501. WorldQuestTrackerScreenPanel:EnableMouse (true)
  3502. LibWindow.MakeDraggable (WorldQuestTrackerScreenPanel)
  3503. end
  3504. end
  3505. end
  3506.  
  3507. if (option == "tracker_is_movable") then
  3508.  
  3509. if (not LibWindow) then
  3510. print ("|cFFFFAA00World Quest Tracker|r: libwindow not found, did you just updated the addon? try reopening the client.|r")
  3511. end
  3512.  
  3513. if (value) then
  3514. --> o tracker agora � m�vel
  3515. --verificar a op��o se esta locked
  3516. if (LibWindow and not WorldQuestTrackerScreenPanel.RegisteredForLibWindow) then
  3517. LibWindow.RestorePosition (WorldQuestTrackerScreenPanel)
  3518. WorldQuestTrackerScreenPanel.RegisteredForLibWindow = true
  3519. end
  3520.  
  3521. WorldQuestTracker.RefreshAnchor()
  3522. if (not WorldQuestTracker.db.profile.tracker_is_locked) then
  3523. WorldQuestTrackerScreenPanel:EnableMouse (true)
  3524. LibWindow.MakeDraggable (WorldQuestTrackerScreenPanel)
  3525. end
  3526. else
  3527. --> o tracker agora auto alinha com o objective tracker
  3528. WorldQuestTracker.RefreshAnchor()
  3529. WorldQuestTrackerScreenPanel:EnableMouse (false)
  3530. end
  3531. end
  3532.  
  3533. if (option ~= "show_timeleft" and option ~= "alpha_time_priority" and option ~= "force_sort_by_timeleft") then
  3534. GameCooltip:ExecFunc (WorldQuestTrackerOptionsButton)
  3535. else
  3536. --> se for do painel de tempo, dar refresh no world map
  3537. if (WorldQuestTrackerAddon.GetCurrentZoneType() == "world") then
  3538. WorldQuestTracker.UpdateWorldQuestsOnWorldMap (true, true, false, true)
  3539. end
  3540. GameCooltip:Close()
  3541. end
  3542. end
  3543.  
  3544. --avisar sobre duplo tap
  3545. -- ~bar ~statusbar
  3546. WorldQuestTracker.DoubleTapFrame = CreateFrame ("frame", "WorldQuestTrackerDoubleTapFrame", worldFramePOIs)
  3547. WorldQuestTracker.DoubleTapFrame:SetHeight (18)
  3548.  
  3549. -- ~point
  3550.  
  3551. --background
  3552. local doubleTapBackground = WorldQuestTracker.DoubleTapFrame:CreateTexture (nil, "overlay")
  3553. doubleTapBackground:SetTexture ([[Interface\ACHIEVEMENTFRAME\UI-Achievement-HorizontalShadow]])
  3554. doubleTapBackground:SetTexCoord (0, .5, 0, 1)
  3555. doubleTapBackground:SetHeight (18)
  3556.  
  3557. function WorldQuestTracker:SetStatusBarAnchor (anchor)
  3558. anchor = anchor or WorldQuestTracker.db.profile.bar_anchor
  3559. WorldQuestTracker.db.profile.bar_anchor = anchor
  3560.  
  3561. if (anchor == "bottom") then
  3562. WorldQuestTracker.DoubleTapFrame:ClearAllPoints()
  3563. WorldQuestTracker.DoubleTapFrame:SetPoint ("bottomleft", WorldMapScrollFrame, "bottomleft", 0, 0)
  3564. WorldQuestTracker.DoubleTapFrame:SetPoint ("bottomright", WorldMapScrollFrame, "bottomright", 0, 0)
  3565. doubleTapBackground:ClearAllPoints()
  3566. doubleTapBackground:SetPoint ("bottomleft", WorldQuestTracker.DoubleTapFrame, "bottomleft", 0, 0)
  3567. doubleTapBackground:SetPoint ("bottomright", WorldQuestButton, "bottomleft", 0, 0)
  3568.  
  3569. elseif (anchor == "top") then
  3570. --top position
  3571. WorldQuestTracker.DoubleTapFrame:ClearAllPoints()
  3572. WorldQuestTracker.DoubleTapFrame:SetPoint ("topleft", WorldMapScrollFrame, "topleft", 0, 0)
  3573. WorldQuestTracker.DoubleTapFrame:SetPoint ("topright", WorldMapScrollFrame, "topright", 0, 0)
  3574. doubleTapBackground:ClearAllPoints()
  3575. doubleTapBackground:SetPoint ("topleft", WorldQuestTracker.DoubleTapFrame, "topleft", 0, 0)
  3576. doubleTapBackground:SetPoint ("topright", WorldQuestTracker.DoubleTapFrame, "topright", 0, 0)
  3577. end
  3578. end
  3579.  
  3580. WorldQuestTracker:SetStatusBarAnchor()
  3581.  
  3582. ---------------------------------------------------------
  3583.  
  3584. -- ~shipment ready
  3585.  
  3586. --WorldQuestTracker:GetNextResearchNoteTime()
  3587. --local nameLoc, timeleftString, timeLeft, elapsedTime, shipmentsReady = WorldQuestTracker:GetNextResearchNoteTime()
  3588. local shipmentsReadyFrame = CreateFrame ("frame", "WorldQuestTrackerShipmentsReadyFrame", WorldMapFrame.UIElementsFrame)
  3589. shipmentsReadyFrame:SetPoint ("center", WorldQuestTracker.DoubleTapFrame, "center", 0, 0)
  3590. shipmentsReadyFrame:SetPoint ("bottom", WorldQuestTracker.DoubleTapFrame, "top", 0, 10)
  3591. shipmentsReadyFrame:SetSize (280, 20)
  3592. shipmentsReadyFrame.LastAnimation = 0
  3593.  
  3594. local shipmentsReadyBackground = shipmentsReadyFrame:CreateTexture (nil, "border")
  3595. shipmentsReadyBackground:SetPoint ("left", shipmentsReadyFrame, "left", -20, 0)
  3596. shipmentsReadyBackground:SetPoint ("right", shipmentsReadyFrame, "right", 20, 0)
  3597. shipmentsReadyBackground:SetHeight (40)
  3598. shipmentsReadyBackground:SetTexture ([[Interface\ACHIEVEMENTFRAME\UI-Achievement-Alert-Background-Mini]])
  3599.  
  3600. local shipmentsReadyTexture = shipmentsReadyFrame:CreateTexture (nil, "artwork")
  3601. shipmentsReadyTexture:SetPoint ("left", shipmentsReadyFrame, "left")
  3602. shipmentsReadyTexture:SetTexture (237446)
  3603. shipmentsReadyTexture:SetSize (20, 20)
  3604. shipmentsReadyTexture:SetMask ([[Interface\CharacterFrame\TempPortraitAlphaMask]])
  3605. local shipmentsReadyText = shipmentsReadyFrame:CreateFontString (nil, "artwork", "GameFontNormal")
  3606. shipmentsReadyText:SetPoint ("left", shipmentsReadyTexture, "right", 2, 0)
  3607. shipmentsReadyFrame.Texture = shipmentsReadyTexture
  3608. shipmentsReadyFrame.Text = shipmentsReadyText
  3609. shipmentsReadyFrame:Hide()
  3610.  
  3611. local smallFlash = shipmentsReadyFrame:CreateTexture (nil, "overlay")
  3612. smallFlash:SetTexture ([[Interface\ACHIEVEMENTFRAME\UI-Achievement-Alert-Glow]])
  3613. smallFlash:SetTexCoord (400/512, 470/512, 0, 70/256)
  3614. smallFlash:SetSize (50, 34)
  3615. smallFlash:SetBlendMode ("ADD")
  3616. smallFlash:SetAlpha (.3)
  3617. smallFlash:SetPoint ("left", shipmentsReadyFrame, "left", -30, 0)
  3618.  
  3619. local shipmentAnimation = DF:CreateAnimationHub (smallFlash, function() smallFlash:Show() end, function() smallFlash:Hide() end)
  3620. local shipmentAnim1 = DF:CreateAnimation (shipmentAnimation, "translation", 1, .33, 30, 0)
  3621.  
  3622. local shipmentAnimation2 = DF:CreateAnimationHub (shipmentsReadyFrame)
  3623. local shipmentAnim1 = DF:CreateAnimation (shipmentAnimation2, "scale", 1, .1, 1, 1, 1.1, 1.1)
  3624. local shipmentAnim2 = DF:CreateAnimation (shipmentAnimation2, "scale", 2, .1, 1.1, 1.1, 1, 1)
  3625.  
  3626. function WorldQuestTracker.ShowResearchNoteReady (name)
  3627. shipmentsReadyFrame:Show()
  3628. name = name or "Artifact Research Notes"
  3629. shipmentsReadyFrame.Text:SetText (name .. " " .. (READY or "") .. "!")
  3630. shipmentsReadyFrame:SetWidth (shipmentsReadyFrame.Text:GetStringWidth() + 20)
  3631. if (not shipmentAnimation:IsPlaying() and shipmentsReadyFrame.LastAnimation+30 < GetTime()) then
  3632. shipmentAnimation2:Play()
  3633. shipmentAnimation:Play()
  3634. shipmentsReadyFrame.LastAnimation = GetTime()
  3635. end
  3636. end
  3637. function WorldQuestTracker.HideResearchNoteReady()
  3638. shipmentsReadyFrame:Hide()
  3639. end
  3640.  
  3641. ---------------------------------------------------------
  3642.  
  3643. local SummaryFrame = CreateFrame ("frame", "WorldQuestTrackerSummaryPanel", WorldQuestTrackerWorldMapPOI)
  3644. SummaryFrame:SetPoint ("topleft", WorldMapPOIFrame, "topleft", 0, 0)
  3645. SummaryFrame:SetPoint ("bottomright", WorldMapPOIFrame, "bottomright", 0, 0)
  3646. SummaryFrame:SetBackdrop ({bgFile = "Interface\\Tooltips\\UI-Tooltip-Background", tile = true, tileSize = 16, edgeFile = [[Interface\Buttons\WHITE8X8]], edgeSize = 1})
  3647. SummaryFrame:SetBackdropColor (0, 0, 0, 1)
  3648. SummaryFrame:SetBackdropBorderColor (0, 0, 0, 1)
  3649. SummaryFrame:SetFrameLevel (3500)
  3650. SummaryFrame:EnableMouse (true)
  3651. SummaryFrame:Hide()
  3652.  
  3653. SummaryFrame.RightBorder = SummaryFrame:CreateTexture (nil, "overlay")
  3654. SummaryFrame.RightBorder:SetTexture ([[Interface\ACHIEVEMENTFRAME\UI-Achievement-HorizontalShadow]])
  3655. SummaryFrame.RightBorder:SetTexCoord (1, 0, 0, 1)
  3656. SummaryFrame.RightBorder:SetPoint ("topright")
  3657. SummaryFrame.RightBorder:SetPoint ("bottomright")
  3658. SummaryFrame.RightBorder:SetPoint ("topleft")
  3659. SummaryFrame.RightBorder:SetPoint ("bottomleft")
  3660. SummaryFrame.RightBorder:SetWidth (125)
  3661. SummaryFrame.RightBorder:SetDesaturated (true)
  3662. SummaryFrame.RightBorder:SetDrawLayer ("background", -7)
  3663.  
  3664. local SummaryFrameUp = CreateFrame ("frame", "WorldQuestTrackerSummaryUpPanel", WorldQuestTrackerWorldMapPOI)
  3665. SummaryFrameUp:SetPoint ("topleft", WorldMapPOIFrame, "topleft", 0, 0)
  3666. SummaryFrameUp:SetPoint ("bottomright", WorldMapPOIFrame, "bottomright", 0, 0)
  3667. SummaryFrameUp:SetFrameLevel (3501)
  3668. SummaryFrameUp:Hide()
  3669.  
  3670. local SummaryFrameDown = CreateFrame ("frame", "WorldQuestTrackerSummaryDownPanel", WorldQuestTrackerWorldMapPOI)
  3671. SummaryFrameDown:SetPoint ("topleft", WorldMapPOIFrame, "topleft", 0, 0)
  3672. SummaryFrameDown:SetPoint ("bottomright", WorldMapPOIFrame, "bottomright", 0, 0)
  3673. SummaryFrameDown:SetFrameLevel (3499)
  3674. SummaryFrameDown:SetBackdrop ({bgFile = "Interface\\Tooltips\\UI-Tooltip-Background", tile = true, tileSize = 16, edgeFile = [[Interface\Buttons\WHITE8X8]], edgeSize = 1})
  3675. SummaryFrameDown:SetBackdropColor (0, 0, 0, 1)
  3676. SummaryFrameDown:SetBackdropBorderColor (0, 0, 0, 1)
  3677. SummaryFrameDown:Hide()
  3678.  
  3679. local CloseSummaryPanel = CreateFrame ("button", "WorldQuestTrackerCloseSummaryButton", SummaryFrameUp)
  3680. CloseSummaryPanel:SetSize (64, 32)
  3681. CloseSummaryPanel:SetPoint ("right", WorldMapFrame.UIElementsFrame.CloseQuestPanelButton, "left", -2, 0)
  3682. CloseSummaryPanel.Background = CloseSummaryPanel:CreateTexture (nil, "background")
  3683. CloseSummaryPanel.Background:SetSize (64, 32)
  3684. CloseSummaryPanel.Background:SetAtlas ("MapCornerShadow-Right")
  3685. CloseSummaryPanel.Background:SetPoint ("bottomright", 2, -1)
  3686. CloseSummaryPanel:SetNormalTexture ([[Interface\AddOns\WorldQuestTracker\media\close_summary_button]])
  3687. CloseSummaryPanel:GetNormalTexture():SetTexCoord (0, 1, 0, .5)
  3688. CloseSummaryPanel:SetPushedTexture ([[Interface\AddOns\WorldQuestTracker\media\close_summary_button_pushed]])
  3689. CloseSummaryPanel:GetPushedTexture():SetTexCoord (0, 1, 0, .5)
  3690.  
  3691. CloseSummaryPanel.Highlight = CloseSummaryPanel:CreateTexture (nil, "highlight")
  3692. CloseSummaryPanel.Highlight:SetTexture ([[Interface\Buttons\UI-Common-MouseHilight]])
  3693. CloseSummaryPanel.Highlight:SetBlendMode ("ADD")
  3694. CloseSummaryPanel.Highlight:SetSize (64*1.5, 32*1.5)
  3695. CloseSummaryPanel.Highlight:SetPoint ("center")
  3696.  
  3697. CloseSummaryPanel:SetScript ("OnClick", function()
  3698. SummaryFrame.HideAnimation:Play()
  3699. SummaryFrameUp.HideAnimation:Play()
  3700. SummaryFrameDown.HideAnimation:Play()
  3701. end)
  3702.  
  3703. SummaryFrame:SetScript ("OnMouseDown", function (self, button)
  3704. if (button == "RightButton") then
  3705. --SummaryFrame:Hide()
  3706. --SummaryFrameUp:Hide()
  3707. SummaryFrame.HideAnimation:Play()
  3708. SummaryFrameUp.HideAnimation:Play()
  3709. SummaryFrameDown.HideAnimation:Play()
  3710. end
  3711. end)
  3712.  
  3713. local x = 10
  3714.  
  3715. local TitleTemplate = DF:GetTemplate ("font", "WQT_SUMMARY_TITLE")
  3716.  
  3717. local accountLifeTime_Texture = DF:CreateImage (SummaryFrameUp, [[Interface\BUTTONS\AdventureGuideMicrobuttonAlert]], 16, 16, "artwork", {5/32, 27/32, 5/32, 27/32})
  3718. accountLifeTime_Texture:SetPoint (x, -10)
  3719. accountLifeTime_Texture:SetAlpha (.7)
  3720.  
  3721. local characterLifeTime_Texture = DF:CreateImage (SummaryFrameUp, [[Interface\BUTTONS\AdventureGuideMicrobuttonAlert]], 16, 16, "artwork", {5/32, 27/32, 5/32, 27/32})
  3722. characterLifeTime_Texture:SetPoint (x, -97)
  3723. characterLifeTime_Texture:SetAlpha (.7)
  3724.  
  3725. local graphicTime_Texture = DF:CreateImage (SummaryFrameUp, [[Interface\BUTTONS\AdventureGuideMicrobuttonAlert]], 16, 16, "artwork", {5/32, 27/32, 5/32, 27/32})
  3726. graphicTime_Texture:SetPoint (x, -228)
  3727. graphicTime_Texture:SetAlpha (.7)
  3728.  
  3729. local otherCharacters_Texture = DF:CreateImage (SummaryFrameUp, [[Interface\BUTTONS\AdventureGuideMicrobuttonAlert]], 16, 16, "artwork", {5/32, 27/32, 5/32, 27/32})
  3730. otherCharacters_Texture:SetPoint ("topleft", SummaryFrameUp, "topright", -220, -10)
  3731. otherCharacters_Texture:SetAlpha (.7)
  3732.  
  3733. local accountLifeTime = DF:CreateLabel (SummaryFrameUp, L["S_SUMMARYPANEL_LIFETIMESTATISTICS_ACCOUNT"] .. ":", TitleTemplate)
  3734. accountLifeTime:SetPoint ("left", accountLifeTime_Texture, "right", 2, 1)
  3735. SummaryFrameUp.AccountLifeTime_Gold = DF:CreateLabel (SummaryFrameUp, L["S_QUESTTYPE_GOLD"] .. ": %s")
  3736. SummaryFrameUp.AccountLifeTime_Resources = DF:CreateLabel (SummaryFrameUp, L["S_QUESTTYPE_RESOURCE"] .. ": %s")
  3737. SummaryFrameUp.AccountLifeTime_APower = DF:CreateLabel (SummaryFrameUp, L["S_QUESTTYPE_ARTIFACTPOWER"] .. ": %s")
  3738. SummaryFrameUp.AccountLifeTime_QCompleted = DF:CreateLabel (SummaryFrameUp, L["S_QUESTSCOMPLETED"] .. ": %s")
  3739. SummaryFrameUp.AccountLifeTime_Gold:SetPoint (x, -30)
  3740. SummaryFrameUp.AccountLifeTime_Resources:SetPoint (x, -45)
  3741. SummaryFrameUp.AccountLifeTime_APower:SetPoint (x, -60)
  3742. SummaryFrameUp.AccountLifeTime_QCompleted:SetPoint (x, -75)
  3743.  
  3744. local characterLifeTime = DF:CreateLabel (SummaryFrameUp, L["S_SUMMARYPANEL_LIFETIMESTATISTICS_CHARACTER"] .. ":", TitleTemplate)
  3745. characterLifeTime:SetPoint ("left", characterLifeTime_Texture, "right", 2, 1)
  3746. SummaryFrameUp.CharacterLifeTime_Gold = DF:CreateLabel (SummaryFrameUp, L["S_QUESTTYPE_GOLD"] .. ": %s")
  3747. SummaryFrameUp.CharacterLifeTime_Resources = DF:CreateLabel (SummaryFrameUp, L["S_QUESTTYPE_RESOURCE"] .. ": %s")
  3748. SummaryFrameUp.CharacterLifeTime_APower = DF:CreateLabel (SummaryFrameUp, L["S_QUESTTYPE_ARTIFACTPOWER"] .. ": %s")
  3749. SummaryFrameUp.CharacterLifeTime_QCompleted = DF:CreateLabel (SummaryFrameUp, L["S_QUESTSCOMPLETED"] .. ": %s")
  3750. SummaryFrameUp.CharacterLifeTime_Gold:SetPoint (x, -120)
  3751. SummaryFrameUp.CharacterLifeTime_Resources:SetPoint (x, -135)
  3752. SummaryFrameUp.CharacterLifeTime_APower:SetPoint (x, -150)
  3753. SummaryFrameUp.CharacterLifeTime_QCompleted:SetPoint (x, -165)
  3754.  
  3755. function WorldQuestTracker.UpdateSummaryFrame()
  3756.  
  3757. local acctLifeTime = WorldQuestTracker.QueryHistory (WQT_QUERYTYPE_REWARD, WQT_QUERYDB_ACCOUNT)
  3758. acctLifeTime = acctLifeTime or {}
  3759. local questsLifeTime = WorldQuestTracker.QueryHistory (WQT_QUERYTYPE_QUEST, WQT_QUERYDB_ACCOUNT)
  3760. questsLifeTime = questsLifeTime or {}
  3761.  
  3762. SummaryFrameUp.AccountLifeTime_Gold.text = format (L["S_QUESTTYPE_GOLD"] .. ": %s", (acctLifeTime.gold or 0) > 0 and GetCoinTextureString (acctLifeTime.gold) or 0)
  3763. SummaryFrameUp.AccountLifeTime_Resources.text = format (L["S_QUESTTYPE_RESOURCE"] .. ": %s", WorldQuestTracker.ToK (acctLifeTime.resource or 0))
  3764. SummaryFrameUp.AccountLifeTime_APower.text = format (L["S_QUESTTYPE_ARTIFACTPOWER"] .. ": %s", WorldQuestTracker.ToK (acctLifeTime.artifact or 0))
  3765. SummaryFrameUp.AccountLifeTime_QCompleted.text = format (L["S_QUESTSCOMPLETED"] .. ": %s", comma_value (questsLifeTime.total or 0))
  3766.  
  3767. local chrLifeTime = WorldQuestTracker.QueryHistory (WQT_QUERYTYPE_REWARD, WQT_QUERYDB_LOCAL)
  3768. chrLifeTime = chrLifeTime or {}
  3769. local questsLifeTime = WorldQuestTracker.QueryHistory (WQT_QUERYTYPE_QUEST, WQT_QUERYDB_LOCAL)
  3770. questsLifeTime = questsLifeTime or {}
  3771.  
  3772. SummaryFrameUp.CharacterLifeTime_Gold.text = format (L["S_QUESTTYPE_GOLD"] .. ": %s", (chrLifeTime.gold or 0) > 0 and GetCoinTextureString (chrLifeTime.gold) or 0)
  3773. SummaryFrameUp.CharacterLifeTime_Resources.text = format (L["S_QUESTTYPE_RESOURCE"] .. ": %s", WorldQuestTracker.ToK (chrLifeTime.resource or 0))
  3774. SummaryFrameUp.CharacterLifeTime_APower.text = format (L["S_QUESTTYPE_ARTIFACTPOWER"] .. ": %s", WorldQuestTracker.ToK (chrLifeTime.artifact or 0))
  3775. SummaryFrameUp.CharacterLifeTime_QCompleted.text = format (L["S_QUESTSCOMPLETED"] .. ": %s", comma_value (questsLifeTime.total or 0))
  3776.  
  3777. end
  3778.  
  3779. ----------
  3780.  
  3781. SummaryFrameUp.ShowAnimation = DF:CreateAnimationHub (SummaryFrameUp,
  3782. function()
  3783. SummaryFrameUp:Show();
  3784. WorldQuestTracker.UpdateSummaryFrame();
  3785. SummaryFrameUp.CharsQuestsScroll:Refresh();
  3786. end,
  3787. function()
  3788. SummaryFrameDown.ShowAnimation:Play();
  3789. end)
  3790. DF:CreateAnimation (SummaryFrameUp.ShowAnimation, "Alpha", 1, .15, 0, 1)
  3791.  
  3792. SummaryFrame.ShowAnimation = DF:CreateAnimationHub (SummaryFrame,
  3793. function()
  3794. SummaryFrame:Show()
  3795. if (WorldQuestTracker.db.profile.sound_enabled) then
  3796. if (math.random (5) == 1) then
  3797. PlaySoundFile ("Interface\\AddOns\\WorldQuestTracker\\media\\swap_panels1.mp3")
  3798. else
  3799. PlaySoundFile ("Interface\\AddOns\\WorldQuestTracker\\media\\swap_panels2.mp3")
  3800. end
  3801. end
  3802. end,
  3803. function()
  3804. SummaryFrameUp.ShowAnimation:Play()
  3805. end)
  3806. DF:CreateAnimation (SummaryFrame.ShowAnimation, "Scale", 1, .1, .1, 1, 1, 1, "left", 0, 0)
  3807.  
  3808. SummaryFrame.HideAnimation = DF:CreateAnimationHub (SummaryFrame, function()
  3809. PlaySound ("igMainMenuOptionCheckBoxOn")
  3810. end,
  3811. function()
  3812. SummaryFrame:Hide()
  3813. end)
  3814. DF:CreateAnimation (SummaryFrame.HideAnimation, "Scale", 1, .1, 1, 1, .1, 1, "left", 1, 0)
  3815.  
  3816. SummaryFrameUp.HideAnimation = DF:CreateAnimationHub (SummaryFrameUp, _,
  3817. function()
  3818. SummaryFrameUp:Hide()
  3819. end)
  3820. DF:CreateAnimation (SummaryFrameUp.HideAnimation, "Alpha", 1, .1, 1, 0)
  3821.  
  3822. SummaryFrameDown.ShowAnimation = DF:CreateAnimationHub (SummaryFrameDown,
  3823. function()
  3824. SummaryFrameDown:Show()
  3825. end,
  3826. function()
  3827. SummaryFrameDown:SetAlpha (.7)
  3828. end
  3829. )
  3830. DF:CreateAnimation (SummaryFrameDown.ShowAnimation, "Alpha", 1, 3, 0, .7)
  3831.  
  3832. SummaryFrameDown.HideAnimation = DF:CreateAnimationHub (SummaryFrameDown, function()
  3833. SummaryFrameDown.ShowAnimation:Stop()
  3834. end,
  3835. function()
  3836. SummaryFrameDown:Hide()
  3837. end)
  3838. DF:CreateAnimation (SummaryFrameDown.HideAnimation, "Alpha", 1, .1, 1, 0)
  3839. -----------
  3840.  
  3841. local scroll_refresh = function()
  3842.  
  3843. end
  3844.  
  3845. local AllQuests = WorldQuestTracker.db.profile.quests_all_characters
  3846. local formated_quest_table = {}
  3847. local chrGuid = UnitGUID ("player")
  3848. for guid, questTable in pairs (AllQuests or {}) do
  3849. if (guid ~= chrGuid) then
  3850. tinsert (formated_quest_table, {"blank"})
  3851. tinsert (formated_quest_table, {true, guid})
  3852. tinsert (formated_quest_table, {"blank"})
  3853. for questID, questInfo in pairs (questTable or {}) do
  3854. tinsert (formated_quest_table, {questID, questInfo})
  3855. end
  3856. end
  3857. end
  3858.  
  3859. local scroll_line_height = 14
  3860. local scroll_line_amount = 26
  3861. local scroll_width = 195
  3862.  
  3863. local line_onenter = function (self)
  3864. if (self.questID) then
  3865. self.numObjectives = 10
  3866. self.UpdateTooltip = TaskPOI_OnEnter
  3867. TaskPOI_OnEnter (self)
  3868. self:SetBackdropColor (.5, .50, .50, 0.75)
  3869. end
  3870. end
  3871. local line_onleave = function (self)
  3872. TaskPOI_OnLeave (self)
  3873. self:SetBackdropColor (0, 0, 0, 0.2)
  3874. end
  3875. local line_onclick = function()
  3876.  
  3877. end
  3878.  
  3879. local scroll_createline = function (self, index)
  3880. local line = CreateFrame ("button", "$parentLine" .. index, self)
  3881. line:SetPoint ("topleft", self, "topleft", 0, -((index-1)*(scroll_line_height+1)))
  3882. line:SetSize (scroll_width, scroll_line_height)
  3883. line:SetScript ("OnEnter", line_onenter)
  3884. line:SetScript ("OnLeave", line_onleave)
  3885. line:SetScript ("OnClick", line_onclick)
  3886.  
  3887. line:SetBackdrop ({bgFile = [[Interface\Tooltips\UI-Tooltip-Background]], tileSize = 64, tile = true})
  3888. line:SetBackdropColor (0, 0, 0, 0.2)
  3889.  
  3890. local icon = line:CreateTexture ("$parentIcon", "overlay")
  3891. icon:SetSize (scroll_line_height, scroll_line_height)
  3892. local name = line:CreateFontString ("$parentName", "overlay", "GameFontNormal")
  3893. DF:SetFontSize (name, 9)
  3894. icon:SetPoint ("left", line, "left", 2, 0)
  3895. name:SetPoint ("left", icon, "right", 2, 0)
  3896. local timeleft = line:CreateFontString ("$parentTimeLeft", "overlay", "GameFontNormal")
  3897. DF:SetFontSize (timeleft, 9)
  3898. timeleft:SetPoint ("right", line, "right", -2, 0)
  3899. line.icon = icon
  3900. line.name = name
  3901. line.timeleft = timeleft
  3902. name:SetHeight (10)
  3903. name:SetJustifyH ("left")
  3904.  
  3905. return line
  3906. end
  3907.  
  3908. local scroll_refresh = function (self, data, offset, total_lines)
  3909. for i = 1, total_lines do
  3910. local index = i + offset
  3911. local quest = data [index]
  3912.  
  3913. if (quest) then
  3914. local line = self:GetLine (i)
  3915. line:SetAlpha (1)
  3916. line.questID = nil
  3917. if (quest [1] == "blank") then
  3918. line.name:SetText ("")
  3919. line.timeleft:SetText ("")
  3920. line.icon:SetTexture (nil)
  3921.  
  3922. elseif (quest [1] == true) then
  3923. local name, realm, class = WorldQuestTracker.GetCharInfo (quest [2])
  3924. local color = RAID_CLASS_COLORS [class]
  3925. local name = name .. " - " .. realm
  3926. if (color) then
  3927. name = "|c" .. color.colorStr .. name .. "|r"
  3928. end
  3929. line.name:SetText (name)
  3930. line.timeleft:SetText ("")
  3931. line.name:SetWidth (180)
  3932.  
  3933. if (class) then
  3934. line.icon:SetTexture ([[Interface\WORLDSTATEFRAME\Icons-Classes]])
  3935. line.icon:SetTexCoord (unpack (CLASS_ICON_TCOORDS [class]))
  3936. else
  3937. line.icon:SetTexture (nil)
  3938. end
  3939. else
  3940. local questInfo = quest [2]
  3941. local title, factionID, tagID, tagName, worldQuestType, rarity, isElite, tradeskillLineIndex = WorldQuestTracker.GetQuest_Info (quest [1])
  3942.  
  3943. title = title or L["S_UNKNOWNQUEST"]
  3944.  
  3945. local rewardAmount = questInfo.rewardAmount
  3946. if (questInfo.questType == QUESTTYPE_GOLD) then
  3947. rewardAmount = floor (questInfo.rewardAmount / 10000)
  3948. end
  3949. local colorByRarity = ""
  3950.  
  3951. if (rarity == LE_WORLD_QUEST_QUALITY_EPIC) then
  3952. colorByRarity = "FFC845F9"
  3953. elseif (rarity == LE_WORLD_QUEST_QUALITY_RARE) then
  3954. colorByRarity = "FF0091F2"
  3955. else
  3956. colorByRarity = "FFFFFFFF"
  3957. end
  3958.  
  3959. local timeLeft = ((questInfo.expireAt - time()) / 60) --segundos / 60
  3960. local color
  3961. if (timeLeft > 120) then
  3962. color = "FFFFFFFF"
  3963. elseif (timeLeft > 45) then
  3964. color = "FFFFAA22"
  3965. else
  3966. color = "FFFF3322"
  3967. end
  3968. line.name:SetText ("|cFFFFDD00[" .. rewardAmount .. "]|r |c" .. colorByRarity .. title .. "|r")
  3969. line.timeleft:SetText (timeLeft > 0 and "|c" .. color .. SecondsToTime (timeLeft * 60) .. "|r" or "|cFFFF5500" .. L["S_SUMMARYPANEL_EXPIRED"] .. "|r")
  3970. if (type (questInfo.rewardTexture) == "string" and questInfo.rewardTexture:find ("icon_artifactpower")) then
  3971. --for�ando sempre mostrar icone vermelho
  3972. line.icon:SetTexture ([[Interface\AddOns\WorldQuestTracker\media\icon_artifactpower_blueT]])
  3973. else
  3974. line.icon:SetTexture (questInfo.rewardTexture)
  3975. end
  3976.  
  3977. line.icon:SetTexCoord (5/64, 59/64, 5/64, 59/64)
  3978. line.name:SetWidth (100)
  3979.  
  3980. if (timeLeft <= 0) then
  3981. line:SetAlpha (.5)
  3982. end
  3983.  
  3984. line.questID = quest [1]
  3985. end
  3986. end
  3987. end
  3988. end
  3989.  
  3990. local ScrollTitle = DF:CreateLabel (SummaryFrameUp, L["S_SUMMARYPANEL_OTHERCHARACTERS"] .. ":", TitleTemplate)
  3991. ScrollTitle:SetPoint ("left", otherCharacters_Texture, "right", 2, 1)
  3992.  
  3993. local CharsQuestsScroll = DF:CreateScrollBox (SummaryFrameUp, "$parentChrQuestsScroll", scroll_refresh, formated_quest_table, scroll_width, 400, scroll_line_amount, scroll_line_height)
  3994. CharsQuestsScroll:SetPoint ("topright", SummaryFrameUp, "topright", -25, -30)
  3995. for i = 1, scroll_line_amount do
  3996. CharsQuestsScroll:CreateLine (scroll_createline)
  3997. end
  3998. SummaryFrameUp.CharsQuestsScroll = CharsQuestsScroll
  3999. CharsQuestsScroll:SetBackdrop ({bgFile = "Interface\\Tooltips\\UI-Tooltip-Background", tile = true, tileSize = 16})
  4000. CharsQuestsScroll:SetBackdropColor (0, 0, 0, .4)
  4001.  
  4002. -----------
  4003.  
  4004. local GF_LineOnEnter = function (self)
  4005. GameCooltip:Preset (2)
  4006. GameCooltip:SetOption ("TextSize", 10)
  4007. GameCooltip:SetOption ("ButtonsYMod", -2)
  4008. GameCooltip:SetOption ("YSpacingMod", 1)
  4009. GameCooltip:SetOption ("FixedHeight", 95)
  4010.  
  4011. local today = self.data.table
  4012.  
  4013. local t = WQT_QUEST_NAMES_AND_ICONS [WQT_QUESTTYPE_GOLD]
  4014. GameCooltip:AddLine (t.name .. ":", today.gold and today.gold > 0 and GetCoinTextureString (today.gold) or 0, 1, "white", "orange")
  4015. GameCooltip:AddIcon (t.icon, 1, 1, 16, 16)
  4016.  
  4017. local t = WQT_QUEST_NAMES_AND_ICONS [WQT_QUESTTYPE_RESOURCE]
  4018. GameCooltip:AddLine (t.name .. ":", comma_value (today.resource or 0), 1, "white", "orange")
  4019. GameCooltip:AddIcon (t.icon, 1, 1, 14, 14)
  4020.  
  4021. local t = WQT_QUEST_NAMES_AND_ICONS [WQT_QUESTTYPE_APOWER]
  4022. GameCooltip:AddLine (t.name .. ":", comma_value (today.artifact or 0), 1, "white", "orange")
  4023. GameCooltip:AddIcon (t.icon, 1, 1, 16, 16)
  4024.  
  4025. local t = WQT_QUEST_NAMES_AND_ICONS [WQT_QUESTTYPE_TRADE]
  4026. GameCooltip:AddLine (t.name .. ":", comma_value (today.blood or 0), 1, "white", "orange")
  4027. GameCooltip:AddIcon (t.icon, 1, 1, 16, 16, unpack (t.coords))
  4028.  
  4029. GameCooltip:AddLine (L["S_QUESTSCOMPLETED"] .. ":", today.quest or 0, 1, "white", "orange")
  4030. GameCooltip:AddIcon ([[Interface\GossipFrame\AvailableQuestIcon]], 1, 1, 16, 16)
  4031.  
  4032. GameCooltip:ShowCooltip (self)
  4033. end
  4034. local GF_LineOnLeave = function (self)
  4035. GameCooltip:Hide()
  4036. end
  4037.  
  4038. -- ~gframe
  4039. local GoldGraphic = DF:CreateGFrame (SummaryFrameUp, 422, 160, 28, GF_LineOnEnter, GF_LineOnLeave, "GoldGraphic", "WorldQuestTrackerGoldGraphic")
  4040. GoldGraphic:SetPoint ("topleft", 40, -248)
  4041. GoldGraphic:SetBackdrop ({bgFile = "Interface\\Tooltips\\UI-Tooltip-Background", tile = true, tileSize = 16})
  4042. GoldGraphic:SetBackdropColor (0, 0, 0, .6)
  4043.  
  4044. local GoldGraphicTextBg = CreateFrame ("frame", nil, GoldGraphic)
  4045. GoldGraphicTextBg:SetPoint ("topleft", GoldGraphic, "bottomleft", 0, -2)
  4046. GoldGraphicTextBg:SetPoint ("topright", GoldGraphic, "bottomright", 0, -2)
  4047. GoldGraphicTextBg:SetBackdrop ({bgFile = "Interface\\Tooltips\\UI-Tooltip-Background", tile = true, tileSize = 16})
  4048. GoldGraphicTextBg:SetBackdropColor (0, 0, 0, .4)
  4049. GoldGraphicTextBg:SetHeight (20)
  4050. --DF:CreateBorder (GoldGraphic, .4, .2, .05)
  4051.  
  4052. local leftLine = DF:CreateImage (GoldGraphic)
  4053. leftLine:SetColorTexture (1, 1, 1, .35)
  4054. leftLine:SetSize (1, 160)
  4055. leftLine:SetPoint ("topleft", GoldGraphic, "topleft", -1, 0)
  4056. leftLine:SetPoint ("bottomleft", GoldGraphic, "bottomleft", -1, -20)
  4057.  
  4058. local bottomLine = DF:CreateImage (GoldGraphic)
  4059. bottomLine:SetColorTexture (1, 1, 1, .35)
  4060. bottomLine:SetSize (422, 1)
  4061. bottomLine:SetPoint ("bottomleft", GoldGraphic, "bottomleft", -35, -2)
  4062. bottomLine:SetPoint ("bottomright", GoldGraphic, "bottomright", 0, -2)
  4063.  
  4064. GoldGraphic.AmountIndicators = {}
  4065. for i = 0, 5 do
  4066. local text = DF:CreateLabel (GoldGraphic, "")
  4067. text:SetPoint ("topright", GoldGraphic, "topleft", -4, -(i*32) - 2)
  4068. text.align = "right"
  4069. text.textcolor = "silver"
  4070. tinsert (GoldGraphic.AmountIndicators, text)
  4071. local line = DF:CreateImage (GoldGraphic)
  4072. line:SetColorTexture (1, 1, 1, .05)
  4073. line:SetSize (420, 1)
  4074. line:SetPoint (0, -(i*32))
  4075. end
  4076.  
  4077. local GoldGraphicTitle = DF:CreateLabel (SummaryFrameUp, L["S_SUMMARYPANEL_LAST15DAYS"] .. ":", TitleTemplate)
  4078. --GoldGraphicTitle:SetPoint ("bottomleft", GoldGraphic, "topleft", 0, 6)
  4079. GoldGraphicTitle:SetPoint ("left", graphicTime_Texture, "right", 2, 1)
  4080.  
  4081. local GraphicDataToUse = 1
  4082. local OnSelectGraphic = function (_, _, value)
  4083. GraphicDataToUse = value
  4084. SummaryFrameUp.RefreshGraphic()
  4085. end
  4086.  
  4087. local class = select (2, UnitClass ("player"))
  4088. local color = RAID_CLASS_COLORS [class] and RAID_CLASS_COLORS [class].colorStr or "FFFFFFFF"
  4089. local graphic_options = {
  4090. {label = L["S_OVERALL"] .. " [|cFFC0C0C0" .. L["S_MAPBAR_SUMMARYMENU_ACCOUNTWIDE"] .. "|r]", value = 1, onclick = OnSelectGraphic,
  4091. icon = [[Interface\GossipFrame\BankerGossipIcon]], iconsize = {14, 14}}, --texcoord = {3/32, 29/32, 3/32, 29/32}
  4092. {label = L["S_QUESTTYPE_GOLD"] .. " [|cFFC0C0C0" .. L["S_MAPBAR_SUMMARYMENU_ACCOUNTWIDE"] .. "|r]", value = 2, onclick = OnSelectGraphic,
  4093. icon = WQT_QUEST_NAMES_AND_ICONS [WQT_QUESTTYPE_GOLD].icon, iconsize = {14, 14}},
  4094. {label = L["S_QUESTTYPE_RESOURCE"] .. " [|c" .. color .. UnitName ("player") .. "|r]", value = 3, onclick = OnSelectGraphic,
  4095. icon = WQT_QUEST_NAMES_AND_ICONS [WQT_QUESTTYPE_RESOURCE].icon, iconsize = {14, 14}},
  4096. {label = L["S_QUESTTYPE_ARTIFACTPOWER"] .. " [|c" .. color .. UnitName ("player") .. "|r]", value = 4, onclick = OnSelectGraphic,
  4097. icon = WQT_QUEST_NAMES_AND_ICONS [WQT_QUESTTYPE_APOWER].icon, iconsize = {14, 14}}
  4098. }
  4099. local graphic_options_func = function()
  4100. return graphic_options
  4101. end
  4102.  
  4103. local dropdown_diff = DF:CreateDropDown (SummaryFrameUp, graphic_options_func, 1, 180, 20, "dropdown_graphic", _, DF:GetTemplate ("dropdown", "OPTIONS_DROPDOWN_TEMPLATE"))
  4104. dropdown_diff:SetPoint ("left", GoldGraphicTitle, "right", 4, 0)
  4105.  
  4106. local empty_day = {
  4107. ["artifact"] = 0,
  4108. ["resource"] = 0,
  4109. ["quest"] = 0,
  4110. ["gold"] = 0,
  4111. ["blood"] = 0,
  4112. }
  4113.  
  4114. SummaryFrameUp.RefreshGraphic = function()
  4115. GoldGraphic:Reset()
  4116.  
  4117. local twoWeeks
  4118. local dateString
  4119.  
  4120. if (GraphicDataToUse == 1 or GraphicDataToUse == 2) then --account overall
  4121. twoWeeks = WorldQuestTracker.QueryHistory (WQT_QUERYTYPE_PERIOD, WQT_QUERYDB_ACCOUNT, WQT_DATE_2WEEK)
  4122. dateString = WorldQuestTracker.GetDateString (WQT_DATE_2WEEK)
  4123. elseif (GraphicDataToUse == 3 or GraphicDataToUse == 4) then
  4124. twoWeeks = WorldQuestTracker.QueryHistory (WQT_QUERYTYPE_PERIOD, WQT_QUERYDB_LOCAL, WQT_DATE_2WEEK)
  4125. dateString = WorldQuestTracker.GetDateString (WQT_DATE_2WEEK)
  4126. end
  4127.  
  4128. local data = {}
  4129. for i = 1, #dateString do
  4130. local hadTable = false
  4131. twoWeeks = twoWeeks or {}
  4132. for o = 1, #twoWeeks do
  4133. if (twoWeeks[o].day == dateString[i]) then
  4134. if (GraphicDataToUse == 1) then
  4135. local gold = (twoWeeks[o].table.gold and twoWeeks[o].table.gold/10000) or 0
  4136. local resource = twoWeeks[o].table.resource or 0
  4137. local artifact = twoWeeks[o].table.artifact or 0
  4138. local blood = (twoWeeks[o].table.blood and twoWeeks[o].table.blood*300) or 0
  4139.  
  4140. local total = gold + resource + artifact + blood
  4141.  
  4142. data [#data+1] = {value = total or 0, text = dateString[i]:gsub ("^%d%d%d%d", ""), table = twoWeeks[o].table}
  4143. hadTable = true
  4144.  
  4145. elseif (GraphicDataToUse == 2) then
  4146. local gold = (twoWeeks[o].table.gold and twoWeeks[o].table.gold/10000) or 0
  4147. data [#data+1] = {value = gold, text = dateString[i]:gsub ("^%d%d%d%d", ""), table = twoWeeks[o].table}
  4148. hadTable = true
  4149.  
  4150. elseif (GraphicDataToUse == 3) then
  4151. local resource = twoWeeks[o].table.resource or 0
  4152. data [#data+1] = {value = resource, text = dateString[i]:gsub ("^%d%d%d%d", ""), table = twoWeeks[o].table}
  4153. hadTable = true
  4154.  
  4155. elseif (GraphicDataToUse == 4) then
  4156. local artifact = twoWeeks[o].table.artifact or 0
  4157. data [#data+1] = {value = artifact, text = dateString[i]:gsub ("^%d%d%d%d", ""), table = twoWeeks[o].table}
  4158. hadTable = true
  4159. end
  4160. break
  4161. end
  4162. end
  4163. if (not hadTable) then
  4164. data [#data+1] = {value = 0, text = dateString[i]:gsub ("^%d%d%d%d", ""), table = empty_day}
  4165. end
  4166.  
  4167. end
  4168.  
  4169. data = DF.table.reverse (data)
  4170. GoldGraphic:UpdateLines (data)
  4171.  
  4172. for i = 1, 5 do
  4173. local text = GoldGraphic.AmountIndicators [i]
  4174. local percent = 20 * abs (i - 6)
  4175. local total = GoldGraphic.MaxValue / 100 * percent
  4176. text.text = WorldQuestTracker.ToK (total)
  4177. end
  4178.  
  4179. --customize text anchor
  4180. for _, line in ipairs (GoldGraphic._lines) do
  4181. line.timeline:SetPoint ("bottomright", line, "bottomright", -2, -18)
  4182. end
  4183. end
  4184.  
  4185. GoldGraphic:SetScript ("OnShow", function (self)
  4186. SummaryFrameUp.RefreshGraphic()
  4187. end)
  4188.  
  4189. -----------
  4190.  
  4191. local buttons_width = 70
  4192.  
  4193. local setup_button = function (button, name)
  4194. button:SetSize (buttons_width, 16)
  4195.  
  4196. button.Text = button:CreateFontString (nil, "overlay", "GameFontNormal")
  4197. button.Text:SetText (name)
  4198.  
  4199. WorldQuestTracker:SetFontSize (button.Text, 10)
  4200. WorldQuestTracker:SetFontColor (button.Text, "orange")
  4201. button.Text:SetPoint ("center")
  4202.  
  4203. local shadow = button:CreateTexture (nil, "background")
  4204. shadow:SetPoint ("center")
  4205. shadow:SetTexture ([[Interface\AddOns\WorldQuestTracker\media\background_blackgradientT]])
  4206. shadow:SetSize (buttons_width+10, 10)
  4207. shadow:SetAlpha (.3)
  4208. end
  4209.  
  4210. local button_onenter = function (self)
  4211. WorldQuestTracker:SetFontColor (self.Text, "WQT_ORANGE_ON_ENTER")
  4212. end
  4213. local button_onleave = function (self)
  4214. WorldQuestTracker:SetFontColor (self.Text, "orange")
  4215. end
  4216.  
  4217. --reward history / summary
  4218. local rewardButton = CreateFrame ("button", "WorldQuestTrackerRewardHistoryButton", WorldQuestTracker.DoubleTapFrame)
  4219. rewardButton:SetPoint ("bottomleft", WorldQuestTracker.DoubleTapFrame, "bottomleft", 0, 0)
  4220. setup_button (rewardButton, L["S_MAPBAR_SUMMARY"])
  4221. rewardButton:SetScript ("OnClick", function() SummaryFrame.ShowAnimation:Play() end)
  4222.  
  4223. ---------------------------------------------------------
  4224. --options button
  4225. local optionsButton = CreateFrame ("button", "WorldQuestTrackerOptionsButton", WorldQuestTracker.DoubleTapFrame)
  4226. optionsButton:SetPoint ("left", rewardButton, "right", 2, 0)
  4227. setup_button (optionsButton, L["S_MAPBAR_OPTIONS"]) --~options
  4228.  
  4229. ---------------------------------------------------------
  4230.  
  4231. --sort options
  4232. local sortButton = CreateFrame ("button", "WorldQuestTrackerSortButton", WorldQuestTracker.DoubleTapFrame)
  4233. sortButton:SetPoint ("left", optionsButton, "right", 2, 0)
  4234. setup_button (sortButton, L["S_MAPBAR_SORTORDER"])
  4235.  
  4236. -- ~sort
  4237. local change_sort_mode = function (a, b, questType, _, _, mouseButton)
  4238. local currentIndex = WorldQuestTracker.db.profile.sort_order [questType]
  4239. if (currentIndex < WQT_QUESTTYPE_MAX) then
  4240. for type, order in pairs (WorldQuestTracker.db.profile.sort_order) do
  4241. if (WorldQuestTracker.db.profile.sort_order [type] == currentIndex+1) then
  4242. WorldQuestTracker.db.profile.sort_order [type] = currentIndex
  4243. break
  4244. end
  4245. end
  4246.  
  4247. WorldQuestTracker.db.profile.sort_order [questType] = WorldQuestTracker.db.profile.sort_order [questType] + 1
  4248. end
  4249.  
  4250. GameCooltip:ExecFunc (sortButton)
  4251.  
  4252. --atualiza as quests
  4253. if (GetCurrentMapAreaID() == MAPID_BROKENISLES) then
  4254. WorldQuestTracker.UpdateWorldQuestsOnWorldMap (true)
  4255. end
  4256. end
  4257.  
  4258. local change_sort_timeleft_mode = function (_, _, amount)
  4259. if (WorldQuestTracker.db.profile.sort_time_priority == amount) then
  4260. WorldQuestTracker.db.profile.sort_time_priority = false
  4261. else
  4262. WorldQuestTracker.db.profile.sort_time_priority = amount
  4263. end
  4264.  
  4265. GameCooltip:Hide()
  4266.  
  4267. --atualiza as quests
  4268.  
  4269. if (WorldQuestTrackerAddon.GetCurrentZoneType() == "world") then
  4270. WorldQuestTracker.UpdateWorldQuestsOnWorldMap (true)
  4271. elseif (WorldQuestTrackerAddon.GetCurrentZoneType() == "zone") then
  4272. WorldQuestTracker.UpdateZoneWidgets()
  4273. end
  4274. end
  4275.  
  4276. local overlayColor = {.5, .5, .5, 1}
  4277. local BuildSortMenu = function()
  4278. local t = {}
  4279. for type, order in pairs (WorldQuestTracker.db.profile.sort_order) do
  4280. tinsert (t, {type, order})
  4281. end
  4282. table.sort (t, function(a, b) return a[2] > b[2] end)
  4283.  
  4284. GameCooltip:Preset (2)
  4285. GameCooltip:SetOption ("TextSize", 10)
  4286. GameCooltip:SetOption ("FixedWidth", 180)
  4287.  
  4288. for i, questType in ipairs (t) do
  4289. local type = questType [1]
  4290. local info = WQT_QUEST_NAMES_AND_ICONS [type]
  4291. local isEnabled = WorldQuestTracker.db.profile.filters [QUEST_TYPE_TO_FILTER [type]]
  4292. if (isEnabled) then
  4293. GameCooltip:AddLine (info.name)
  4294. GameCooltip:AddIcon (info.icon, 1, 1, 16, 16, unpack (info.coords))
  4295. GameCooltip:AddIcon ([[Interface\BUTTONS\UI-MicroStream-Yellow]], 1, 2, 16, 16, 0, 1, 1, 0, overlayColor, nil, true)
  4296. else
  4297. GameCooltip:AddLine (info.name, _, _, "silver")
  4298. local l, r, t, b = unpack (info.coords)
  4299. GameCooltip:AddIcon (info.icon, 1, 1, 16, 16, l, r, t, b, _, _, true)
  4300. end
  4301.  
  4302. GameCooltip:AddMenu (1, change_sort_mode, type)
  4303. end
  4304.  
  4305. end
  4306.  
  4307. sortButton.CoolTip = {
  4308. Type = "menu",
  4309. BuildFunc = BuildSortMenu, --> called when user mouse over the frame
  4310. OnEnterFunc = function (self)
  4311. sortButton.button_mouse_over = true
  4312. button_onenter (self)
  4313. C_Timer.After (.05, CooltipOnTop_WhenFullScreen)
  4314. end,
  4315. OnLeaveFunc = function (self)
  4316. sortButton.button_mouse_over = false
  4317. button_onleave (self)
  4318. end,
  4319. FixedValue = "none",
  4320. ShowSpeed = 0.05,
  4321. Options = function()
  4322. end
  4323. }
  4324.  
  4325. GameCooltip:CoolTipInject (sortButton, openOnClick)
  4326.  
  4327. ---------------------------------------------------------
  4328.  
  4329. -- ~filter
  4330. local filterButton = CreateFrame ("button", "WorldQuestTrackerFilterButton", WorldQuestTracker.DoubleTapFrame)
  4331. filterButton:SetPoint ("left", sortButton, "right", 2, 0)
  4332. setup_button (filterButton, L["S_MAPBAR_FILTER"])
  4333.  
  4334. local filter_quest_type = function (_, _, questType, _, _, mouseButton)
  4335. WorldQuestTracker.db.profile.filters [questType] = not WorldQuestTracker.db.profile.filters [questType]
  4336.  
  4337. GameCooltip:ExecFunc (filterButton)
  4338.  
  4339. --atualiza as quests
  4340. if (WorldQuestTrackerAddon.GetCurrentZoneType() == "world") then
  4341. WorldQuestTracker.UpdateWorldQuestsOnWorldMap (true)
  4342. elseif (WorldQuestTrackerAddon.GetCurrentZoneType() == "zone") then
  4343. WorldQuestTracker.UpdateZoneWidgets()
  4344. end
  4345. end
  4346.  
  4347. local toggle_faction_objectives = function()
  4348. WorldQuestTracker.db.profile.filter_always_show_faction_objectives = not WorldQuestTracker.db.profile.filter_always_show_faction_objectives
  4349. GameCooltip:ExecFunc (filterButton)
  4350.  
  4351. --atualiza as quests
  4352. if (WorldQuestTrackerAddon.GetCurrentZoneType() == "world") then
  4353. WorldQuestTracker.UpdateWorldQuestsOnWorldMap (true)
  4354. elseif (WorldQuestTrackerAddon.GetCurrentZoneType() == "zone") then
  4355. WorldQuestTracker.UpdateZoneWidgets()
  4356. end
  4357. end
  4358.  
  4359. local toggle_brokenshore_bypass = function()
  4360. WorldQuestTracker.db.profile.filter_force_show_brokenshore = not WorldQuestTracker.db.profile.filter_force_show_brokenshore
  4361. GameCooltip:ExecFunc (filterButton)
  4362. --atualiza as quests
  4363. if (WorldQuestTrackerAddon.GetCurrentZoneType() == "world") then
  4364. WorldQuestTracker.UpdateWorldQuestsOnWorldMap (true)
  4365. elseif (WorldQuestTrackerAddon.GetCurrentZoneType() == "zone") then
  4366. WorldQuestTracker.UpdateZoneWidgets()
  4367. end
  4368. end
  4369.  
  4370. local BuildFilterMenu = function()
  4371. GameCooltip:Preset (2)
  4372. GameCooltip:SetOption ("TextSize", 10)
  4373. GameCooltip:SetOption ("FixedWidth", 180)
  4374. GameCooltip:SetOption ("FixedWidthSub", 200)
  4375. GameCooltip:SetOption ("SubMenuIsTooltip", true)
  4376. GameCooltip:SetOption ("IgnoreArrows", true)
  4377.  
  4378. local t = {}
  4379. for filterType, canShow in pairs (WorldQuestTracker.db.profile.filters) do
  4380. local sortIndex = WorldQuestTracker.db.profile.sort_order [FILTER_TO_QUEST_TYPE [filterType]]
  4381. tinsert (t, {filterType, sortIndex})
  4382. end
  4383. table.sort (t, function(a, b) return a[2] > b[2] end)
  4384.  
  4385. for i, filter in ipairs (t) do
  4386. local filterType = filter [1]
  4387. local info = WQT_QUEST_NAMES_AND_ICONS [FILTER_TO_QUEST_TYPE [filterType]]
  4388. local isEnabled = WorldQuestTracker.db.profile.filters [filterType]
  4389. if (isEnabled) then
  4390. GameCooltip:AddLine (info.name)
  4391. GameCooltip:AddIcon (info.icon, 1, 1, 16, 16, unpack (info.coords))
  4392. GameCooltip:AddIcon ([[Interface\BUTTONS\UI-CheckBox-Check]], 1, 2, 16, 16, 0, 1, 0, 1, overlayColor, nil, true)
  4393. else
  4394. GameCooltip:AddLine (info.name, _, _, "silver")
  4395. local l, r, t, b = unpack (info.coords)
  4396. GameCooltip:AddIcon (info.icon, 1, 1, 16, 16, l, r, t, b, _, _, true)
  4397. end
  4398. GameCooltip:AddMenu (1, filter_quest_type, filterType)
  4399. end
  4400.  
  4401. GameCooltip:AddLine ("$div")
  4402.  
  4403. local l, r, t, b = unpack (WQT_GENERAL_STRINGS_AND_ICONS.criteria.coords)
  4404. l = 0.8731118125
  4405.  
  4406. if (WorldQuestTracker.db.profile.filter_always_show_faction_objectives) then
  4407. GameCooltip:AddLine (L["S_MAPBAR_FILTERMENU_FACTIONOBJECTIVES"])
  4408. GameCooltip:AddLine (L["S_MAPBAR_FILTERMENU_FACTIONOBJECTIVES_DESC"], "", 2)
  4409. GameCooltip:AddIcon (WQT_GENERAL_STRINGS_AND_ICONS.criteria.icon, 1, 1, 23*.54, 37*.40, l, r, t, b)
  4410. GameCooltip:AddIcon ([[Interface\BUTTONS\UI-CheckBox-Check]], 1, 2, 16, 16, 0, 1, 0, 1, overlayColor, nil, true)
  4411. else
  4412. GameCooltip:AddLine (L["S_MAPBAR_FILTERMENU_FACTIONOBJECTIVES"], "", 1, "silver")
  4413. GameCooltip:AddLine (L["S_MAPBAR_FILTERMENU_FACTIONOBJECTIVES_DESC"], "", 2)
  4414. GameCooltip:AddIcon (WQT_GENERAL_STRINGS_AND_ICONS.criteria.icon, 1, 1, 23*.54, 37*.40, l, r, t, b, nil, nil, true)
  4415. end
  4416. GameCooltip:AddMenu (1, toggle_faction_objectives)
  4417. GameCooltip:AddLine ("$div")
  4418.  
  4419. if (WorldQuestTracker.db.profile.filter_force_show_brokenshore) then
  4420. GameCooltip:AddLine ("Ignore Broken Shore")
  4421. GameCooltip:AddLine ("World quets on Broken Shore map will always be shown.", "", 2)
  4422. GameCooltip:AddIcon ([[Interface\ICONS\70_inscription_vantus_rune_tomb]], 1, 1, 23*.54, 37*.40, 0, 1, 0, 1)
  4423. GameCooltip:AddIcon ([[Interface\BUTTONS\UI-CheckBox-Check]], 1, 2, 16, 16, 0, 1, 0, 1, overlayColor, nil, true)
  4424. else
  4425. GameCooltip:AddLine ("Ignore Broken Shore", "", 1, "silver")
  4426. GameCooltip:AddLine ("World quets on Broken Shore map will always be shown.", "", 2)
  4427. GameCooltip:AddIcon (WQT_GENERAL_STRINGS_AND_ICONS.criteria.icon, 1, 1, 23*.54, 37*.40, l, r, t, b, nil, nil, true)
  4428. end
  4429. GameCooltip:AddMenu (1, toggle_brokenshore_bypass)
  4430. end
  4431.  
  4432. filterButton.CoolTip = {
  4433. Type = "menu",
  4434. BuildFunc = BuildFilterMenu, --> called when user mouse over the frame
  4435. OnEnterFunc = function (self)
  4436. filterButton.button_mouse_over = true
  4437. button_onenter (self)
  4438. C_Timer.After (.05, CooltipOnTop_WhenFullScreen)
  4439. end,
  4440. OnLeaveFunc = function (self)
  4441. filterButton.button_mouse_over = false
  4442. button_onleave (self)
  4443. end,
  4444. FixedValue = "none",
  4445. ShowSpeed = 0.05,
  4446. Options = function()
  4447. end,
  4448. }
  4449.  
  4450. GameCooltip:CoolTipInject (filterButton)
  4451.  
  4452. ---------------------------------------------------------
  4453. -- ~time left
  4454.  
  4455. local timeLeftButton = CreateFrame ("button", "WorldQuestTrackerTimeLeftButton", WorldQuestTracker.DoubleTapFrame)
  4456. timeLeftButton:SetPoint ("left", filterButton, "right", 2, 0)
  4457. setup_button (timeLeftButton, L["S_MAPBAR_SORTORDER_TIMELEFTPRIORITY_TITLE"])
  4458.  
  4459.  
  4460. local BuildTimeLeftMenu = function()
  4461. GameCooltip:Preset (2)
  4462. GameCooltip:SetOption ("TextSize", 10)
  4463. GameCooltip:SetOption ("FixedWidth", 180)
  4464. GameCooltip:SetOption ("FixedWidthSub", 200)
  4465. GameCooltip:SetOption ("SubMenuIsTooltip", true)
  4466. GameCooltip:SetOption ("IgnoreArrows", true)
  4467.  
  4468. GameCooltip:AddLine (format (L["S_MAPBAR_SORTORDER_TIMELEFTPRIORITY_OPTION"], 4))
  4469. GameCooltip:AddMenu (1, change_sort_timeleft_mode, 4)
  4470. if (WorldQuestTracker.db.profile.sort_time_priority == 4) then
  4471. GameCooltip:AddIcon ([[Interface\BUTTONS\UI-CheckBox-Check]], 1, 1, 16, 16)
  4472. else
  4473. GameCooltip:AddIcon ([[Interface\BUTTONS\UI-AutoCastableOverlay]], 1, 1, 16, 16, .4, .6, .4, .6)
  4474. end
  4475.  
  4476. GameCooltip:AddLine (format (L["S_MAPBAR_SORTORDER_TIMELEFTPRIORITY_OPTION"], 8), "", 1)
  4477. GameCooltip:AddMenu (1, change_sort_timeleft_mode, 8)
  4478. if (WorldQuestTracker.db.profile.sort_time_priority == 8) then
  4479. GameCooltip:AddIcon ([[Interface\BUTTONS\UI-CheckBox-Check]], 1, 1, 16, 16)
  4480. else
  4481. GameCooltip:AddIcon ([[Interface\BUTTONS\UI-AutoCastableOverlay]], 1, 1, 16, 16, .4, .6, .4, .6)
  4482. end
  4483.  
  4484. GameCooltip:AddLine (format (L["S_MAPBAR_SORTORDER_TIMELEFTPRIORITY_OPTION"], 12), "", 1)
  4485. GameCooltip:AddMenu (1, change_sort_timeleft_mode, 12)
  4486. if (WorldQuestTracker.db.profile.sort_time_priority == 12) then
  4487. GameCooltip:AddIcon ([[Interface\BUTTONS\UI-CheckBox-Check]], 1, 1, 16, 16)
  4488. else
  4489. GameCooltip:AddIcon ([[Interface\BUTTONS\UI-AutoCastableOverlay]], 1, 1, 16, 16, .4, .6, .4, .6)
  4490. end
  4491.  
  4492. GameCooltip:AddLine (format (L["S_MAPBAR_SORTORDER_TIMELEFTPRIORITY_OPTION"], 16), "", 1)
  4493. GameCooltip:AddMenu (1, change_sort_timeleft_mode, 16)
  4494. if (WorldQuestTracker.db.profile.sort_time_priority == 16) then
  4495. GameCooltip:AddIcon ([[Interface\BUTTONS\UI-CheckBox-Check]], 1, 1, 16, 16)
  4496. else
  4497. GameCooltip:AddIcon ([[Interface\BUTTONS\UI-AutoCastableOverlay]], 1, 1, 16, 16, .4, .6, .4, .6)
  4498. end
  4499.  
  4500. GameCooltip:AddLine (format (L["S_MAPBAR_SORTORDER_TIMELEFTPRIORITY_OPTION"], 24), "", 1)
  4501. GameCooltip:AddMenu (1, change_sort_timeleft_mode, 24)
  4502. if (WorldQuestTracker.db.profile.sort_time_priority == 24) then
  4503. GameCooltip:AddIcon ([[Interface\BUTTONS\UI-CheckBox-Check]], 1, 1, 16, 16)
  4504. else
  4505. GameCooltip:AddIcon ([[Interface\BUTTONS\UI-AutoCastableOverlay]], 1, 1, 16, 16, .4, .6, .4, .6)
  4506. end
  4507.  
  4508. GameCooltip:AddLine ("$div", nil, 1, nil, -5, -11)
  4509.  
  4510. GameCooltip:AddLine (L["S_MAPBAR_SORTORDER_TIMELEFTPRIORITY_SHOWTEXT"], "", 1)
  4511. GameCooltip:AddMenu (1, options_on_click, "show_timeleft", not WorldQuestTracker.db.profile.show_timeleft)
  4512. if (WorldQuestTracker.db.profile.show_timeleft) then
  4513. GameCooltip:AddIcon ([[Interface\BUTTONS\UI-CheckBox-Check]], 1, 1, 16, 16)
  4514. else
  4515. GameCooltip:AddIcon ([[Interface\BUTTONS\UI-AutoCastableOverlay]], 1, 1, 16, 16, .4, .6, .4, .6)
  4516. end
  4517.  
  4518. GameCooltip:AddLine (L["S_MAPBAR_SORTORDER_TIMELEFTPRIORITY_FADE"], "", 1)
  4519. GameCooltip:AddMenu (1, options_on_click, "alpha_time_priority", not WorldQuestTracker.db.profile.alpha_time_priority)
  4520. if (WorldQuestTracker.db.profile.alpha_time_priority) then
  4521. GameCooltip:AddIcon ([[Interface\BUTTONS\UI-CheckBox-Check]], 1, 1, 16, 16)
  4522. else
  4523. GameCooltip:AddIcon ([[Interface\BUTTONS\UI-AutoCastableOverlay]], 1, 1, 16, 16, .4, .6, .4, .6)
  4524. end
  4525.  
  4526. GameCooltip:AddLine (L["S_MAPBAR_SORTORDER_TIMELEFTPRIORITY_SORTBYTIME"], "", 1)
  4527. GameCooltip:AddMenu (1, options_on_click, "force_sort_by_timeleft", not WorldQuestTracker.db.profile.force_sort_by_timeleft)
  4528. if (WorldQuestTracker.db.profile.force_sort_by_timeleft) then
  4529. GameCooltip:AddIcon ([[Interface\BUTTONS\UI-CheckBox-Check]], 1, 1, 16, 16)
  4530. else
  4531. GameCooltip:AddIcon ([[Interface\BUTTONS\UI-AutoCastableOverlay]], 1, 1, 16, 16, .4, .6, .4, .6)
  4532. end
  4533.  
  4534. end
  4535.  
  4536. timeLeftButton.CoolTip = {
  4537. Type = "menu",
  4538. BuildFunc = BuildTimeLeftMenu, --> called when user mouse over the frame
  4539. OnEnterFunc = function (self)
  4540. timeLeftButton.button_mouse_over = true
  4541. button_onenter (self)
  4542. C_Timer.After (.05, CooltipOnTop_WhenFullScreen)
  4543. end,
  4544. OnLeaveFunc = function (self)
  4545. timeLeftButton.button_mouse_over = false
  4546. button_onleave (self)
  4547. end,
  4548. FixedValue = "none",
  4549. ShowSpeed = 0.05,
  4550. Options = function()
  4551. end,
  4552. }
  4553.  
  4554. GameCooltip:CoolTipInject (timeLeftButton)
  4555.  
  4556. ---------------------------------------------------------
  4557.  
  4558. function WorldQuestTracker.ShowHistoryTooltip (self)
  4559. local _
  4560. GameCooltip:Preset (2)
  4561. GameCooltip:SetOption ("TextSize", 10)
  4562. GameCooltip:SetOption ("ButtonsYMod", -2)
  4563. GameCooltip:SetOption ("YSpacingMod", 3)
  4564. GameCooltip:SetOption ("FixedHeight", 185)
  4565. GameCooltip:AddLine (" ")
  4566. GameCooltip:AddLine (L["S_MAPBAR_SUMMARYMENU_TODAYREWARDS"] .. ":", _, _, _, _, 12)
  4567.  
  4568. C_Timer.After (.05, CooltipOnTop_WhenFullScreen)
  4569.  
  4570. --~sumary
  4571. button_onenter (self)
  4572.  
  4573. local today = WorldQuestTracker.QueryHistory (WQT_QUERYTYPE_PERIOD, WQT_QUERYDB_LOCAL, WQT_DATE_TODAY)
  4574. today = today or {}
  4575.  
  4576. GameCooltip:AddLine (L["S_QUESTTYPE_GOLD"] .. ":", today.gold and today.gold > 0 and GetCoinTextureString (today.gold) or 0, 1, "white", "orange")
  4577. local texture, coords = WorldQuestTracker.GetGoldIcon()
  4578. GameCooltip:AddIcon (texture, 1, 1, 16, 16)
  4579.  
  4580. GameCooltip:AddLine (L["S_QUESTTYPE_RESOURCE"] .. ":", comma_value (today.resource or 0), 1, "white", "orange")
  4581. GameCooltip:AddIcon ([[Interface\AddOns\WorldQuestTracker\media\resource_iconT]], 1, 1, 14, 14)
  4582.  
  4583. local artifactIcon = WorldQuestTracker.GetArtifactPowerIcon (100000, true)
  4584. GameCooltip:AddLine (L["S_QUESTTYPE_ARTIFACTPOWER"] ..":", comma_value (today.artifact or 0), 1, "white", "orange")
  4585. GameCooltip:AddIcon (artifactIcon, 1, 1, 16, 16)
  4586.  
  4587. local quests_completed = WorldQuestTracker.QueryHistory (WQT_QUERYTYPE_PERIOD, WQT_QUERYDB_LOCAL, WQT_DATE_TODAY, WQT_QUESTS_PERIOD)
  4588. GameCooltip:AddLine (L["S_QUESTSCOMPLETED"] .. ":", quests_completed or 0, 1, "white", "orange")
  4589. GameCooltip:AddIcon ([[Interface\GossipFrame\AvailableQuestIcon]], 1, 1, 16, 16)
  4590. --
  4591. GameCooltip:AddLine (" ")
  4592. GameCooltip:AddLine (L["S_MAPBAR_SUMMARYMENU_ACCOUNTWIDE"] .. ":", _, _, _, _, 12)
  4593. --GameCooltip:AddLine (" ")
  4594.  
  4595. local today_account = WorldQuestTracker.QueryHistory (WQT_QUERYTYPE_PERIOD, WQT_QUERYDB_ACCOUNT, WQT_DATE_TODAY)-- or {}
  4596. today_account = today_account or {}
  4597.  
  4598. GameCooltip:AddLine (L["S_QUESTTYPE_GOLD"] .. ":", today_account.gold and today_account.gold > 0 and GetCoinTextureString (today_account.gold) or 0, 1, "white", "orange")
  4599. local texture, coords = WorldQuestTracker.GetGoldIcon()
  4600. GameCooltip:AddIcon (texture, 1, 1, 16, 16)
  4601.  
  4602. GameCooltip:AddLine (L["S_QUESTTYPE_RESOURCE"] .. ":", comma_value (today_account.resource or 0), 1, "white", "orange")
  4603. GameCooltip:AddIcon ([[Interface\AddOns\WorldQuestTracker\media\resource_iconT]], 1, 1, 14, 14)
  4604.  
  4605. local artifactIcon = WorldQuestTracker.GetArtifactPowerIcon (100000, true)
  4606. GameCooltip:AddLine (L["S_QUESTTYPE_ARTIFACTPOWER"] ..":", comma_value (today_account.artifact or 0), 1, "white", "orange")
  4607. GameCooltip:AddIcon (artifactIcon, 1, 1, 16, 16)
  4608.  
  4609. local quests_completed = WorldQuestTracker.QueryHistory (WQT_QUERYTYPE_PERIOD, WQT_QUERYDB_ACCOUNT, WQT_DATE_TODAY, WQT_QUESTS_PERIOD)
  4610. GameCooltip:AddLine (L["S_QUESTSCOMPLETED"] .. ":", quests_completed or 0, 1, "white", "orange")
  4611. GameCooltip:AddIcon ([[Interface\GossipFrame\AvailableQuestIcon]], 1, 1, 16, 16)
  4612.  
  4613. GameCooltip:AddLine (" ", "", 1, "green", _, 10)
  4614. GameCooltip:AddLine (L["S_MAPBAR_SUMMARYMENU_MOREINFO"], "", 1, "green", _, 10)
  4615.  
  4616. --WorldQuestTracker.GetCharInfo (guid)
  4617. --lista de outros personagems:
  4618.  
  4619. GameCooltip:AddLine (L["S_MAPBAR_SUMMARYMENU_REQUIREATTENTION"] .. ":", "", 2, _, _, 12)
  4620. GameCooltip:AddLine (" ", "", 2, _, _, 12)
  4621.  
  4622. local chrGuid = UnitGUID ("player")
  4623. local timeCutOff = time() + (60*60*2.2)
  4624. local subLines = 1
  4625. --[
  4626. for guid, trackTable in pairs (WorldQuestTracker.db.profile.quests_tracked) do
  4627. if (chrGuid ~= guid) then
  4628. local requireAttention = false
  4629. for i, questInfo in ipairs (trackTable) do
  4630. if (timeCutOff > questInfo.expireAt) then
  4631.  
  4632. local timeLeft = ((questInfo.expireAt - time()) / 60) --segundos / 60
  4633.  
  4634. if (timeLeft > 0) then
  4635. if (not requireAttention) then
  4636. local name, realm, class = WorldQuestTracker.GetCharInfo (guid)
  4637. local color = RAID_CLASS_COLORS [class]
  4638. local name = name .. " - " .. realm
  4639. if (color) then
  4640. name = "|c" .. color.colorStr .. name .. "|r"
  4641. end
  4642. GameCooltip:AddLine (name, "", 2, _, _, 12)
  4643. subLines = subLines + 1
  4644. requireAttention = true
  4645. end
  4646.  
  4647. local title, factionID, tagID, tagName, worldQuestType, rarity, isElite, tradeskillLineIndex = WorldQuestTracker.GetQuest_Info (questInfo.questID)
  4648.  
  4649. local rewardAmount = questInfo.rewardAmount
  4650. if (questInfo.questType == QUESTTYPE_GOLD) then
  4651. rewardAmount = floor (questInfo.rewardAmount / 10000)
  4652. end
  4653. local colorByRarity = ""
  4654.  
  4655. if (rarity == LE_WORLD_QUEST_QUALITY_EPIC) then
  4656. colorByRarity = "FFC845F9"
  4657. elseif (rarity == LE_WORLD_QUEST_QUALITY_RARE) then
  4658. colorByRarity = "FF0091F2"
  4659. else
  4660. colorByRarity = "FFFFFFFF"
  4661. end
  4662. GameCooltip:AddLine ("|cFFFFDD00[" .. rewardAmount .. "]|r |c" .. colorByRarity.. title .. "|r", SecondsToTime (timeLeft * 60), 2, "white", "orange", 10)-- .. "M" --(timeLeft > 60 and 60 or 1)
  4663. GameCooltip:AddIcon (questInfo.rewardTexture, 2, 1)
  4664.  
  4665. subLines = subLines + 1
  4666. end
  4667. end
  4668. end
  4669. end
  4670. end
  4671. --]]
  4672. if (subLines == 1) then
  4673. GameCooltip:AddLine (L["S_MAPBAR_SUMMARYMENU_NOATTENTION"], " ", 2, "gray", _, 10)
  4674. GameCooltip:AddLine (" ", " ", 2)
  4675. else
  4676. GameCooltip:SetOption ("HeighModSub", max (185 - (subLines * 20), 0))
  4677. end
  4678.  
  4679. GameCooltip:SetOption ("SubMenuIsTooltip", true)
  4680. GameCooltip:SetOption ("NoLastSelectedBar", true)
  4681.  
  4682. GameCooltip:SetLastSelected ("main", 1)
  4683.  
  4684. GameCooltip:SetOwner (rewardButton)
  4685. GameCooltip:Show()
  4686.  
  4687. GameCooltip:ShowSub (GameCooltip.Indexes)
  4688. end
  4689.  
  4690. local button_onLeave = function (self)
  4691. GameCooltip:Hide()
  4692. button_onleave (self)
  4693. end
  4694.  
  4695. --build option menu
  4696.  
  4697. local BuildOptionsMenu = function() -- �ptions ~options
  4698. GameCooltip:Preset (2)
  4699. GameCooltip:SetOption ("TextSize", 10)
  4700. GameCooltip:SetOption ("FixedWidth", 160)
  4701.  
  4702. local IconSize = 14
  4703.  
  4704. --all tracker options
  4705. GameCooltip:AddLine (L["S_MAPBAR_OPTIONSMENU_TRACKERCONFIG"])
  4706. GameCooltip:AddIcon ([[Interface\AddOns\WorldQuestTracker\media\ArrowGridT]], 1, 1, IconSize, IconSize, 944/1024, 993/1024, 272/1024, 324/1024)
  4707.  
  4708. --use quest tracker
  4709. GameCooltip:AddLine (L["S_MAPBAR_OPTIONSMENU_QUESTTRACKER"], "", 2)
  4710. if (WorldQuestTracker.db.profile.use_tracker) then
  4711. GameCooltip:AddIcon ([[Interface\BUTTONS\UI-CheckBox-Check]], 2, 1, 16, 16)
  4712. else
  4713. GameCooltip:AddIcon ([[Interface\BUTTONS\UI-AutoCastableOverlay]], 2, 1, 16, 16, .4, .6, .4, .6)
  4714. end
  4715. GameCooltip:AddMenu (2, options_on_click, "use_tracker", not WorldQuestTracker.db.profile.use_tracker)
  4716. --
  4717. GameCooltip:AddLine ("$div", nil, 2, nil, -5, -11)
  4718. --
  4719.  
  4720. GameCooltip:AddLine (format (L["S_MAPBAR_OPTIONSMENU_TRACKER_SCALE"], "0.8"), "", 2)
  4721. GameCooltip:AddMenu (2, options_on_click, "tracker_scale", 0.8)
  4722. GameCooltip:AddLine (format (L["S_MAPBAR_OPTIONSMENU_TRACKER_SCALE"], "1.0"), "", 2)
  4723. GameCooltip:AddMenu (2, options_on_click, "tracker_scale", 1)
  4724. GameCooltip:AddLine (format (L["S_MAPBAR_OPTIONSMENU_TRACKER_SCALE"], "1.1"), "", 2)
  4725. GameCooltip:AddMenu (2, options_on_click, "tracker_scale", 1.1)
  4726. GameCooltip:AddLine (format (L["S_MAPBAR_OPTIONSMENU_TRACKER_SCALE"], "1.2"), "", 2)
  4727. GameCooltip:AddMenu (2, options_on_click, "tracker_scale", 1.2)
  4728. GameCooltip:AddLine (format (L["S_MAPBAR_OPTIONSMENU_TRACKER_SCALE"], "1.3"), "", 2)
  4729. GameCooltip:AddMenu (2, options_on_click, "tracker_scale", 1.3)
  4730. GameCooltip:AddLine (format (L["S_MAPBAR_OPTIONSMENU_TRACKER_SCALE"], "1.5"), "", 2)
  4731. GameCooltip:AddMenu (2, options_on_click, "tracker_scale", 1.5)
  4732.  
  4733. --
  4734. GameCooltip:AddLine ("$div", nil, 2, nil, -5, -11)
  4735. --
  4736.  
  4737. -- tracker movable
  4738. --automatic
  4739. GameCooltip:AddLine (L["S_MAPBAR_OPTIONSMENU_TRACKERMOVABLE_AUTO"], "", 2)
  4740. if (not WorldQuestTracker.db.profile.tracker_is_movable) then
  4741. GameCooltip:AddIcon ([[Interface\BUTTONS\UI-CheckBox-Check]], 2, 1, 16, 16)
  4742. else
  4743. GameCooltip:AddIcon ([[Interface\BUTTONS\UI-AutoCastableOverlay]], 2, 1, 16, 16, .4, .6, .4, .6)
  4744. end
  4745. GameCooltip:AddMenu (2, options_on_click, "tracker_is_movable", false)
  4746. --manual
  4747. GameCooltip:AddLine (L["S_MAPBAR_OPTIONSMENU_TRACKERMOVABLE_CUSTOM"], "", 2)
  4748. if (WorldQuestTracker.db.profile.tracker_is_movable) then
  4749. GameCooltip:AddIcon ([[Interface\BUTTONS\UI-CheckBox-Check]], 2, 1, 16, 16)
  4750. else
  4751. GameCooltip:AddIcon ([[Interface\BUTTONS\UI-AutoCastableOverlay]], 2, 1, 16, 16, .4, .6, .4, .6)
  4752. end
  4753. GameCooltip:AddMenu (2, options_on_click, "tracker_is_movable", true)
  4754.  
  4755. if (WorldQuestTracker.db.profile.tracker_is_movable) then
  4756. GameCooltip:AddLine (L["S_MAPBAR_OPTIONSMENU_TRACKERMOVABLE_LOCKED"], "", 2)
  4757. else
  4758. GameCooltip:AddLine (L["S_MAPBAR_OPTIONSMENU_TRACKERMOVABLE_LOCKED"], "", 2, "gray")
  4759. end
  4760. if (WorldQuestTracker.db.profile.tracker_is_locked) then
  4761. GameCooltip:AddIcon ([[Interface\BUTTONS\UI-CheckBox-Check]], 2, 1, 16, 16)
  4762. else
  4763. GameCooltip:AddIcon ([[Interface\BUTTONS\UI-AutoCastableOverlay]], 2, 1, 16, 16, .4, .6, .4, .6)
  4764. end
  4765. GameCooltip:AddMenu (2, options_on_click, "tracker_is_locked", not WorldQuestTracker.db.profile.tracker_is_locked)
  4766.  
  4767. --
  4768. GameCooltip:AddLine ("$div", nil, 2, nil, -5, -11)
  4769. --
  4770.  
  4771. --show yards distance on the tracker
  4772. GameCooltip:AddLine (L["S_MAPBAR_OPTIONSMENU_YARDSDISTANCE"], "", 2)
  4773. if (WorldQuestTracker.db.profile.show_yards_distance) then
  4774. GameCooltip:AddIcon ([[Interface\BUTTONS\UI-CheckBox-Check]], 2, 1, 16, 16)
  4775. else
  4776. GameCooltip:AddIcon ([[Interface\BUTTONS\UI-AutoCastableOverlay]], 2, 1, 16, 16, .4, .6, .4, .6)
  4777. end
  4778. GameCooltip:AddMenu (2, options_on_click, "show_yards_distance", not WorldQuestTracker.db.profile.show_yards_distance)
  4779.  
  4780. --only show quests on the current zone
  4781. GameCooltip:AddLine (L["S_MAPBAR_OPTIONSMENU_TRACKER_CURRENTZONE"], "", 2)
  4782. if (WorldQuestTracker.db.profile.tracker_only_currentmap) then
  4783. GameCooltip:AddIcon ([[Interface\BUTTONS\UI-CheckBox-Check]], 2, 1, 16, 16)
  4784. else
  4785. GameCooltip:AddIcon ([[Interface\BUTTONS\UI-AutoCastableOverlay]], 2, 1, 16, 16, .4, .6, .4, .6)
  4786. end
  4787. GameCooltip:AddMenu (2, options_on_click, "tracker_only_currentmap", not WorldQuestTracker.db.profile.tracker_only_currentmap)
  4788.  
  4789. GameCooltip:AddLine (L["S_MAPBAR_SORTORDER_TIMELEFTPRIORITY_TITLE"], "", 2)
  4790. if (WorldQuestTracker.db.profile.tracker_show_time) then
  4791. GameCooltip:AddIcon ([[Interface\BUTTONS\UI-CheckBox-Check]], 2, 1, 16, 16)
  4792. else
  4793. GameCooltip:AddIcon ([[Interface\BUTTONS\UI-AutoCastableOverlay]], 2, 1, 16, 16, .4, .6, .4, .6)
  4794. end
  4795. GameCooltip:AddMenu (2, options_on_click, "tracker_show_time", not WorldQuestTracker.db.profile.tracker_show_time)
  4796.  
  4797. --
  4798.  
  4799. --World Map Config
  4800. GameCooltip:AddLine (L["S_MAPBAR_OPTIONSMENU_WORLDMAPCONFIG"])
  4801. GameCooltip:AddIcon ([[Interface\Worldmap\UI-World-Icon]], 1, 1, IconSize, IconSize)
  4802.  
  4803. GameCooltip:AddLine ("Disable Icons on World Map", "", 2)
  4804. if (WorldQuestTracker.db.profile.disable_world_map_widgets) then
  4805. GameCooltip:AddIcon ([[Interface\BUTTONS\UI-CheckBox-Check]], 2, 1, 16, 16)
  4806. else
  4807. GameCooltip:AddIcon ([[Interface\BUTTONS\UI-AutoCastableOverlay]], 2, 1, 16, 16, .4, .6, .4, .6)
  4808. end
  4809. GameCooltip:AddMenu (2, options_on_click, "world_map_config", "disable_world_map_widgets", not WorldQuestTracker.db.profile.disable_world_map_widgets)
  4810. GameCooltip:AddLine ("$div", nil, 2, nil, -7, -14)
  4811.  
  4812.  
  4813. GameCooltip:AddLine ("Small Text Size", "", 2)
  4814. GameCooltip:AddMenu (2, options_on_click, "world_map_config", "textsize", 9)
  4815. GameCooltip:AddLine ("Medium Text Size", "", 2)
  4816. GameCooltip:AddMenu (2, options_on_click, "world_map_config", "textsize", 10)
  4817. GameCooltip:AddLine ("Large Text Size", "", 2)
  4818. GameCooltip:AddMenu (2, options_on_click, "world_map_config", "textsize", 11)
  4819.  
  4820. GameCooltip:AddLine ("$div", nil, 2, nil, -7, -14)
  4821.  
  4822. GameCooltip:AddLine ("Scale - Small", "", 2)
  4823. GameCooltip:AddMenu (2, options_on_click, "world_map_config", "scale", 1)
  4824. GameCooltip:AddLine ("Scale - Medium", "", 2)
  4825. GameCooltip:AddMenu (2, options_on_click, "world_map_config", "scale", 1.2)
  4826. GameCooltip:AddLine ("Scale - Big", "", 2)
  4827. GameCooltip:AddMenu (2, options_on_click, "world_map_config", "scale", 1.4)
  4828. GameCooltip:AddLine ("Scale - Very Big", "", 2)
  4829. GameCooltip:AddMenu (2, options_on_click, "world_map_config", "scale", 1.6)
  4830.  
  4831. --Zone Map Config
  4832. GameCooltip:AddLine (L["S_MAPBAR_OPTIONSMENU_ZONEMAPCONFIG"])
  4833. GameCooltip:AddIcon ([[Interface\Worldmap\WorldMap-Icon]], 1, 1, IconSize, IconSize)
  4834.  
  4835. GameCooltip:AddLine (L["S_MAPBAR_OPTIONSMENU_ZONE_QUESTSUMMARY"], "", 2)
  4836. if (WorldQuestTracker.db.profile.use_quest_summary) then
  4837. GameCooltip:AddIcon ([[Interface\BUTTONS\UI-CheckBox-Check]], 2, 1, 16, 16)
  4838. else
  4839. GameCooltip:AddIcon ([[Interface\BUTTONS\UI-AutoCastableOverlay]], 2, 1, 16, 16, .4, .6, .4, .6)
  4840. end
  4841. GameCooltip:AddMenu (2, options_on_click, "use_quest_summary", not WorldQuestTracker.db.profile.use_quest_summary)
  4842.  
  4843. GameCooltip:AddLine ("$div", nil, 2, nil, -7, -14)
  4844.  
  4845. GameCooltip:AddLine ("Small Quest Icons", "", 2)
  4846. GameCooltip:AddMenu (2, options_on_click, "zone_map_config", "scale", 1)
  4847. GameCooltip:AddLine ("Medium Quest Icons", "", 2)
  4848. GameCooltip:AddMenu (2, options_on_click, "zone_map_config", "scale", 1.15)
  4849. GameCooltip:AddLine ("Large Quest Icons", "", 2)
  4850. GameCooltip:AddMenu (2, options_on_click, "zone_map_config", "scale", 1.23)
  4851. GameCooltip:AddLine ("Very Large Quest Icons", "", 2)
  4852. GameCooltip:AddMenu (2, options_on_click, "zone_map_config", "scale", 1.35)
  4853.  
  4854. GameCooltip:AddLine ("$div", nil, 2, nil, -7, -14)
  4855.  
  4856. GameCooltip:AddLine ("Only Tracked", "", 2)
  4857. if (WorldQuestTracker.db.profile.zone_only_tracked) then
  4858. GameCooltip:AddIcon ([[Interface\BUTTONS\UI-CheckBox-Check]], 2, 1, 16, 16)
  4859. else
  4860. GameCooltip:AddIcon ([[Interface\BUTTONS\UI-AutoCastableOverlay]], 2, 1, 16, 16, .4, .6, .4, .6)
  4861. end
  4862. GameCooltip:AddMenu (2, options_on_click, "zone_only_tracked", not WorldQuestTracker.db.profile.zone_only_tracked)
  4863.  
  4864.  
  4865.  
  4866. GameCooltip:AddLine ("$div")
  4867. --
  4868. GameCooltip:AddLine (L["S_MAPBAR_OPTIONSMENU_SOUNDENABLED"])
  4869. if (WorldQuestTracker.db.profile.sound_enabled) then
  4870. GameCooltip:AddIcon ([[Interface\BUTTONS\UI-CheckBox-Check]], 1, 1, 16, 16)
  4871. else
  4872. GameCooltip:AddIcon ([[Interface\BUTTONS\UI-AutoCastableOverlay]], 1, 1, 16, 16, .4, .6, .4, .6)
  4873. end
  4874. GameCooltip:AddMenu (1, options_on_click, "sound_enabled", not WorldQuestTracker.db.profile.sound_enabled)
  4875. --
  4876. GameCooltip:AddLine (L["S_MAPBAR_OPTIONSMENU_EQUIPMENTICONS"])
  4877. if (WorldQuestTracker.db.profile.use_old_icons) then
  4878. GameCooltip:AddIcon ([[Interface\BUTTONS\UI-CheckBox-Check]], 1, 1, 16, 16)
  4879. else
  4880. GameCooltip:AddIcon ([[Interface\BUTTONS\UI-AutoCastableOverlay]], 1, 1, 16, 16, .4, .6, .4, .6)
  4881. end
  4882. GameCooltip:AddMenu (1, options_on_click, "use_old_icons", not WorldQuestTracker.db.profile.use_old_icons)
  4883. --
  4884. GameCooltip:AddLine (L["S_MAPBAR_AUTOWORLDMAP"])
  4885. if (WorldQuestTracker.db.profile.enable_doubletap) then
  4886. GameCooltip:AddIcon ([[Interface\BUTTONS\UI-CheckBox-Check]], 1, 1, 16, 16)
  4887. else
  4888. GameCooltip:AddIcon ([[Interface\BUTTONS\UI-AutoCastableOverlay]], 1, 1, 16, 16, .4, .6, .4, .6)
  4889. end
  4890. GameCooltip:AddMenu (1, options_on_click, "enable_doubletap", not WorldQuestTracker.db.profile.enable_doubletap)
  4891. --
  4892. GameCooltip:AddLine (L["S_MAPBAR_OPTIONSMENU_STATUSBARANCHOR"])
  4893. if (WorldQuestTracker.db.profile.bar_anchor == "top") then
  4894. GameCooltip:AddIcon ([[Interface\BUTTONS\UI-CheckBox-Check]], 1, 1, 16, 16)
  4895. else
  4896. GameCooltip:AddIcon ([[Interface\BUTTONS\UI-AutoCastableOverlay]], 1, 1, 16, 16, .4, .6, .4, .6)
  4897. end
  4898. GameCooltip:AddMenu (1, options_on_click, "bar_anchor", WorldQuestTracker.db.profile.bar_anchor == "bottom" and "top" or "bottom")
  4899. --
  4900.  
  4901. GameCooltip:AddLine ("$div")
  4902. --
  4903.  
  4904. GameCooltip:AddLine (L["S_MAPBAR_OPTIONSMENU_ARROWSPEED"])
  4905. GameCooltip:AddIcon ([[Interface\AddOns\WorldQuestTracker\media\ArrowFrozen]], 1, 1, IconSize, IconSize, .15, .8, .15, .80)
  4906.  
  4907. GameCooltip:AddLine (L["S_MAPBAR_OPTIONSMENU_ARROWSPEED_REALTIME"], "", 2)
  4908. GameCooltip:AddMenu (2, options_on_click, "arrow_update_speed", 0.016)
  4909. if (WorldQuestTracker.db.profile.arrow_update_frequence < 0.017) then
  4910. GameCooltip:AddIcon ([[Interface\BUTTONS\UI-CheckBox-Check]], 2, 1, 16, 16)
  4911. else
  4912. GameCooltip:AddIcon ([[Interface\BUTTONS\UI-AutoCastableOverlay]], 2, 1, 16, 16, .4, .6, .4, .6)
  4913. end
  4914.  
  4915. GameCooltip:AddLine (L["S_MAPBAR_OPTIONSMENU_ARROWSPEED_HIGH"], "", 2)
  4916. GameCooltip:AddMenu (2, options_on_click, "arrow_update_speed", 0.03)
  4917. if (WorldQuestTracker.db.profile.arrow_update_frequence < 0.032 and WorldQuestTracker.db.profile.arrow_update_frequence > 0.029) then
  4918. GameCooltip:AddIcon ([[Interface\BUTTONS\UI-CheckBox-Check]], 2, 1, 16, 16)
  4919. else
  4920. GameCooltip:AddIcon ([[Interface\BUTTONS\UI-AutoCastableOverlay]], 2, 1, 16, 16, .4, .6, .4, .6)
  4921. end
  4922.  
  4923. GameCooltip:AddLine (L["S_MAPBAR_OPTIONSMENU_ARROWSPEED_MEDIUM"], "", 2)
  4924. GameCooltip:AddMenu (2, options_on_click, "arrow_update_speed", 0.075)
  4925. if (WorldQuestTracker.db.profile.arrow_update_frequence < 0.076 and WorldQuestTracker.db.profile.arrow_update_frequence > 0.074) then
  4926. GameCooltip:AddIcon ([[Interface\BUTTONS\UI-CheckBox-Check]], 2, 1, 16, 16)
  4927. else
  4928. GameCooltip:AddIcon ([[Interface\BUTTONS\UI-AutoCastableOverlay]], 2, 1, 16, 16, .4, .6, .4, .6)
  4929. end
  4930.  
  4931. GameCooltip:AddLine (L["S_MAPBAR_OPTIONSMENU_ARROWSPEED_SLOW"], "", 2)
  4932. GameCooltip:AddMenu (2, options_on_click, "arrow_update_speed", 0.1)
  4933. if (WorldQuestTracker.db.profile.arrow_update_frequence < 0.11 and WorldQuestTracker.db.profile.arrow_update_frequence > 0.099) then
  4934. GameCooltip:AddIcon ([[Interface\BUTTONS\UI-CheckBox-Check]], 2, 1, 16, 16)
  4935. else
  4936. GameCooltip:AddIcon ([[Interface\BUTTONS\UI-AutoCastableOverlay]], 2, 1, 16, 16, .4, .6, .4, .6)
  4937. end
  4938.  
  4939. --
  4940. if (TomTom and IsAddOnLoaded ("TomTom")) then
  4941. GameCooltip:AddLine ("$div")
  4942.  
  4943. GameCooltip:AddLine ("TomTom")
  4944. GameCooltip:AddIcon ([[Interface\AddOns\TomTom\Images\Arrow.blp]], 1, 1, 16, 14, 0, 56/512, 0, 43/512, "lightgreen")
  4945.  
  4946. GameCooltip:AddLine (L["S_ENABLED"], "", 2)
  4947. GameCooltip:AddMenu (2, options_on_click, "tomtom-enabled", not WorldQuestTracker.db.profile.tomtom.enabled)
  4948. if (WorldQuestTracker.db.profile.tomtom.enabled) then
  4949. GameCooltip:AddIcon ([[Interface\BUTTONS\UI-CheckBox-Check]], 2, 1, 16, 16)
  4950. else
  4951. GameCooltip:AddIcon ([[Interface\BUTTONS\UI-AutoCastableOverlay]], 2, 1, 16, 16, .4, .6, .4, .6)
  4952. end
  4953.  
  4954. GameCooltip:AddLine (L["S_MAPBAR_OPTIONSMENU_TOMTOM_WPPERSISTENT"], "", 2)
  4955. GameCooltip:AddMenu (2, options_on_click, "tomtom-persistent", not WorldQuestTracker.db.profile.tomtom.persistent)
  4956. if (WorldQuestTracker.db.profile.tomtom.persistent) then
  4957. GameCooltip:AddIcon ([[Interface\BUTTONS\UI-CheckBox-Check]], 2, 1, 16, 16)
  4958. else
  4959. GameCooltip:AddIcon ([[Interface\BUTTONS\UI-AutoCastableOverlay]], 2, 1, 16, 16, .4, .6, .4, .6)
  4960. end
  4961. end
  4962. --
  4963.  
  4964. GameCooltip:AddLine ("$div")
  4965.  
  4966. --
  4967. GameCooltip:AddLine (L["S_MAPBAR_OPTIONSMENU_REFRESH"])
  4968. GameCooltip:AddMenu (1, options_on_click, "clear_quest_cache", true)
  4969. GameCooltip:AddIcon ([[Interface\GLUES\CharacterSelect\CharacterUndelete]], 1, 1, IconSize, IconSize, .2, .8, .2, .8)
  4970. --
  4971. GameCooltip:AddLine (L["S_MAPBAR_OPTIONSMENU_UNTRACKQUESTS"])
  4972. GameCooltip:AddMenu (1, options_on_click, "untrack_quests", true)
  4973. GameCooltip:AddIcon ([[Interface\BUTTONS\UI-GROUPLOOT-PASS-HIGHLIGHT]], 1, 1, IconSize, IconSize)
  4974.  
  4975. --
  4976.  
  4977. --/dump InterfaceOptionsSocialPanelEnableTwitter.Logo:GetSize()
  4978.  
  4979. GameCooltip:AddLine (L["S_MAPBAR_OPTIONSMENU_SHARE"])
  4980. GameCooltip:AddIcon ("Interface\\FriendsFrame\\WowshareTextures.BLP", nil, 1, 14, 11, 122/256, 138/256, 167/256, 180/256)
  4981. GameCooltip:AddMenu (1, options_on_click, "share_addon", true)
  4982. --
  4983.  
  4984. GameCooltip:SetOption ("IconBlendMode", "ADD")
  4985. GameCooltip:SetOption ("SubFollowButton", true)
  4986.  
  4987. --
  4988. end
  4989.  
  4990. optionsButton.CoolTip = {
  4991. Type = "menu",
  4992. BuildFunc = BuildOptionsMenu, --> called when user mouse over the frame
  4993. OnEnterFunc = function (self)
  4994. optionsButton.button_mouse_over = true
  4995. button_onenter (self)
  4996. C_Timer.After (.05, CooltipOnTop_WhenFullScreen)
  4997. end,
  4998. OnLeaveFunc = function (self)
  4999. optionsButton.button_mouse_over = false
  5000. button_onleave (self)
  5001. end,
  5002. FixedValue = "none",
  5003. ShowSpeed = 0.05,
  5004. Options = function()
  5005. end
  5006. }
  5007.  
  5008. GameCooltip:CoolTipInject (optionsButton)
  5009.  
  5010. rewardButton:SetScript ("OnEnter", WorldQuestTracker.ShowHistoryTooltip)
  5011. rewardButton:SetScript ("OnLeave", button_onLeave)
  5012.  
  5013. --
  5014.  
  5015. --[[
  5016. local checkboxDoubleTap_func = function (self, actorTypeIndex, value)
  5017. WorldQuestTracker.db.profile.enable_doubletap = value
  5018. end
  5019. local checkboxDoubleTap = DF:CreateSwitch (WorldQuestTracker.DoubleTapFrame, checkboxDoubleTap_func, WorldQuestTracker.db.profile.enable_doubletap, nil, nil, nil, nil, "checkboxDoubleTap1")
  5020. checkboxDoubleTap:SetTemplate (DF:GetTemplate ("switch", "OPTIONS_CHECKBOX_TEMPLATE"))
  5021. checkboxDoubleTap:SetAsCheckBox()
  5022. checkboxDoubleTap:SetSize (16, 16)
  5023. checkboxDoubleTap.tooltip = L["S_MAPBAR_AUTOWORLDMAP_DESC"]
  5024. checkboxDoubleTap:SetPoint ("left", filterButton, "right", 2, 0)
  5025. --checkboxDoubleTap:SetValue (WorldQuestTracker.db.profile.enable_doubletap)
  5026. --checkboxDoubleTap.widget:SetBackdropColor (1, 0, 0, 0)
  5027. local doubleTapText = DF:CreateLabel (checkboxDoubleTap, L["S_MAPBAR_AUTOWORLDMAP"], 10, "orange", nil, "checkboxDoubleTapLabel", nil, "overlay")
  5028. doubleTapText:SetPoint ("left", checkboxDoubleTap, "right", 2, 0)
  5029. -]]
  5030. --------------
  5031.  
  5032. local ResourceFontTemplate = DF:GetTemplate ("font", "WQT_RESOURCES_AVAILABLE")
  5033.  
  5034. --> party members ~party
  5035.  
  5036. local partyFrame = CreateFrame ("frame", nil, WorldQuestTracker.DoubleTapFrame)
  5037. partyFrame:SetSize (80, 20)
  5038. partyFrame:SetPoint ("left", filterButton, "right", 10, 0)
  5039.  
  5040. local BuildPartyTooltipMenu = function (self)
  5041. GameCooltip:Preset (2)
  5042. GameCooltip:SetOption ("TextSize", 10)
  5043. GameCooltip:SetOption ("FixedWidth", 260)
  5044.  
  5045. local name = UnitName ("player")
  5046. local playersWith = {name}
  5047. local playersWithout = {}
  5048. local groupMembers = GetNumSubgroupMembers()
  5049.  
  5050. for i = 1, groupMembers do
  5051. local GUID = UnitGUID ("party" .. i)
  5052. local name = UnitName ("party" .. i)
  5053.  
  5054. if (WorldQuestTracker.PartyQuestsPool [GUID]) then
  5055. tinsert (playersWith, name)
  5056. else
  5057. tinsert (playersWithout, name)
  5058. end
  5059. end
  5060.  
  5061. --GameCooltip:AddLine ("With a little help from my friends", "", 1, {.9, .9, .9}, nil, 12)
  5062. --GameCooltip:AddLine (" ")
  5063.  
  5064. GameCooltip:AddLine (L["S_PARTY_PLAYERSWITH"], "", 1, {.7, .7, 1})
  5065. for _, name in ipairs (playersWith) do
  5066. GameCooltip:AddLine ("- " .. name, "", 1, {.95, .95, 1})
  5067. end
  5068.  
  5069. GameCooltip:AddLine (L["S_PARTY_PLAYERSWITHOUT"], "", 1, {1, .5, .5})
  5070. for _, name in ipairs (playersWithout) do
  5071. GameCooltip:AddLine ("- " .. name, "", 1, {1, .95, .95})
  5072. end
  5073.  
  5074. GameCooltip:AddLine (" ")
  5075.  
  5076. GameCooltip:AddLine (L["S_PARTY_DESC1"], nil, 1, {.75, .75, .85})
  5077. GameCooltip:AddIcon ([[Interface\AddOns\WorldQuestTracker\media\icon_party_sharedT]], 1, 1, 16, 16)
  5078.  
  5079. GameCooltip:AddLine (L["S_PARTY_DESC2"], nil, 1, {.85, .75, .75})
  5080. GameCooltip:AddIcon ([[Interface\AddOns\WorldQuestTracker\media\icon_party_shared_badT]], 1, 1, 16, 16)
  5081. end
  5082.  
  5083. partyFrame.CoolTip = {
  5084. Type = "tooltip",
  5085. BuildFunc = BuildPartyTooltipMenu, --> called when user mouse over the frame
  5086. OnEnterFunc = function (self)
  5087. optionsButton.button_mouse_over = true
  5088. --button_onenter (self)
  5089. C_Timer.After (.05, CooltipOnTop_WhenFullScreen)
  5090. end,
  5091. OnLeaveFunc = function (self)
  5092. optionsButton.button_mouse_over = false
  5093. --button_onleave (self)
  5094. end,
  5095. FixedValue = "none",
  5096. ShowSpeed = 0.05,
  5097. Options = function()
  5098. end
  5099. }
  5100. GameCooltip:CoolTipInject (partyFrame)
  5101.  
  5102. local partyStarIcon = partyFrame:CreateTexture (nil, "overlay")
  5103. partyStarIcon:SetPoint ("left", filterButton, "right", 10, 0)
  5104. partyStarIcon:SetTexture ([[Interface\AddOns\WorldQuestTracker\media\icon_party_sharedT]])
  5105. partyStarIcon:SetSize (48*.3, 48*.3)
  5106. partyStarIcon:SetAlpha (.8)
  5107. partyStarIcon:SetDesaturated (true)
  5108. WorldQuestTracker.PartyStarIcon = partyStarIcon
  5109.  
  5110. local shadow = partyFrame:CreateTexture (nil, "background")
  5111. shadow:SetPoint ("left", partyStarIcon, "left", -6, 0)
  5112. shadow:SetTexture ([[Interface\AddOns\WorldQuestTracker\media\background_blackgradientT]])
  5113. shadow:SetSize (88, 12)
  5114. shadow:SetAlpha (.3)
  5115.  
  5116. --local partyText = DF:CreateLabel (partyFrame, L["S_PARTY"] .. ":", ResourceFontTemplate)
  5117. local partyText = DF:CreateLabel (partyFrame, "" .. "", ResourceFontTemplate)
  5118. partyText:SetPoint ("left", partyStarIcon, "right", 2, 0)
  5119.  
  5120. local partyTextAmount = DF:CreateLabel (partyFrame, "0", ResourceFontTemplate)
  5121. partyTextAmount:SetPoint ("left", partyText, "right", 2, 0)
  5122. WorldQuestTracker.PartyAmountText = partyTextAmount
  5123.  
  5124. if (WorldQuestTracker.UpdatePartySharedQuests) then
  5125. WorldQuestTracker.UpdatePartySharedQuests (true)
  5126. end
  5127.  
  5128.  
  5129.  
  5130. -----------
  5131. --recursos dispon�veis
  5132. local xOffset = 35
  5133.  
  5134. -- ~resources ~recursos
  5135. local resource_GoldIcon = DF:CreateImage (WorldQuestTracker.DoubleTapFrame, [[Interface\AddOns\WorldQuestTracker\media\icons_resourcesT]], 16, 16, "overlay", {64/128, 96/128, 0, .25})
  5136. resource_GoldIcon:SetDrawLayer ("overlay", 7)
  5137. resource_GoldIcon:SetAlpha (.78)
  5138. local resource_GoldText = DF:CreateLabel (WorldQuestTracker.DoubleTapFrame, "", ResourceFontTemplate)
  5139.  
  5140.  
  5141. local resource_ResourcesIcon = DF:CreateImage (WorldQuestTracker.DoubleTapFrame, [[Interface\AddOns\WorldQuestTracker\media\icons_resourcesT]], 16, 16, "overlay", {0, 32/128, 0, .25})
  5142. resource_ResourcesIcon:SetDrawLayer ("overlay", 7)
  5143. resource_ResourcesIcon:SetAlpha (.78)
  5144. local resource_ResourcesText = DF:CreateLabel (WorldQuestTracker.DoubleTapFrame, "", ResourceFontTemplate)
  5145.  
  5146.  
  5147. local resource_APowerIcon = DF:CreateImage (WorldQuestTracker.DoubleTapFrame, [[Interface\AddOns\WorldQuestTracker\media\icons_resourcesT]], 16, 16, "overlay", {32/128, 64/128, 0, .25})
  5148. resource_APowerIcon:SetDrawLayer ("overlay", 7)
  5149. resource_APowerIcon:SetAlpha (.78)
  5150. local resource_APowerText = DF:CreateLabel (WorldQuestTracker.DoubleTapFrame, "", ResourceFontTemplate)
  5151.  
  5152.  
  5153. --ordem das anchors - cada widget ocupa 55 pixels: 0 55 110
  5154. --[=[
  5155. resource_GoldIcon:SetPoint ("left", filterButton, "right", 100 + xOffset, 0)
  5156. resource_APowerIcon:SetPoint ("left", filterButton, "right", 210 + xOffset, 0)
  5157. resource_ResourcesIcon:SetPoint ("left", filterButton, "right", 155 + xOffset, 0)
  5158.  
  5159. resource_APowerText:SetPoint ("left", resource_APowerIcon, "right", 2, 0)
  5160. resource_ResourcesText:SetPoint ("left", resource_ResourcesIcon, "right", 2, 0)
  5161. resource_GoldText:SetPoint ("left", resource_GoldIcon, "right", 2, 0)
  5162. --]=]
  5163.  
  5164. partyStarIcon:ClearAllPoints()
  5165. partyTextAmount:ClearAllPoints()
  5166. partyTextAmount:SetPoint ("bottomright", WorldQuestButton, "bottomleft", -10, 2)
  5167. partyStarIcon:SetPoint ("right", partyTextAmount.widget, "left", -2, 0)
  5168. shadow:SetSize (40, 12)
  5169. partyFrame:ClearAllPoints()
  5170. partyFrame:SetPoint ("left", partyStarIcon, "left", -2, 0)
  5171. partyFrame:SetWidth (38)
  5172.  
  5173. --resource_APowerText:SetPoint ("bottomright", WorldQuestButton, "bottomleft", -10, 2)
  5174. resource_APowerText:SetPoint ("right", partyStarIcon, "left", -10, 0)
  5175. resource_APowerIcon:SetPoint ("right", resource_APowerText, "left", -2, 0)
  5176. resource_ResourcesText:SetPoint ("right", resource_APowerIcon, "left", -10, 0)
  5177. resource_ResourcesIcon:SetPoint ("right", resource_ResourcesText, "left", -2, 0)
  5178. resource_GoldText:SetPoint ("right", resource_ResourcesIcon, "left", -10, 0)
  5179. resource_GoldIcon:SetPoint ("right", resource_GoldText, "left", -2, 0)
  5180.  
  5181. --[=[
  5182. partyStarIcon:ClearAllPoints()
  5183. partyTextAmount:ClearAllPoints()
  5184. partyTextAmount:SetPoint ("right", resource_GoldIcon.widget, "left", -10, 0)
  5185. partyStarIcon:SetPoint ("right", partyTextAmount.widget, "left", -2, 0)
  5186. shadow:SetSize (40, 12)
  5187. --]=]
  5188. --------
  5189.  
  5190. WorldQuestTracker.WorldMap_GoldIndicator = resource_GoldText
  5191. WorldQuestTracker.WorldMap_ResourceIndicator = resource_ResourcesText
  5192. WorldQuestTracker.WorldMap_APowerIndicator = resource_APowerText
  5193.  
  5194. -- ~trackall
  5195. local TrackAllFromType = function (self)
  5196. local mapID
  5197. if (mapType == "zone") then
  5198. mapID = GetCurrentMapAreaID()
  5199. end
  5200.  
  5201. local mapType = WorldQuestTrackerAddon.GetCurrentZoneType()
  5202. if (mapType == "zone") then
  5203. local qType = self.QuestType
  5204. if (qType == "gold") then
  5205. qType = QUESTTYPE_GOLD
  5206. elseif (qType == "resource") then
  5207. qType = QUESTTYPE_RESOURCE
  5208. elseif (qType == "apower") then
  5209. qType = QUESTTYPE_ARTIFACTPOWER
  5210. end
  5211.  
  5212. local widgets = WorldQuestTracker.Cache_ShownWidgetsOnZoneMap
  5213. for _, widget in ipairs (widgets) do
  5214. if (widget.QuestType == qType) then
  5215. WorldQuestTracker.AddQuestToTracker (widget)
  5216. if (widget.onEndTrackAnimation:IsPlaying()) then
  5217. widget.onEndTrackAnimation:Stop()
  5218. end
  5219. widget.onStartTrackAnimation:Play()
  5220. end
  5221. end
  5222.  
  5223. if (WorldQuestTracker.db.profile.sound_enabled) then
  5224. if (math.random (2) == 1) then
  5225. PlaySoundFile ("Interface\\AddOns\\WorldQuestTracker\\media\\quest_added_to_tracker_mass1.mp3")
  5226. else
  5227. PlaySoundFile ("Interface\\AddOns\\WorldQuestTracker\\media\\quest_added_to_tracker_mass2.mp3")
  5228. end
  5229. end
  5230. WorldQuestTracker.UpdateZoneWidgets()
  5231. end
  5232.  
  5233. if (mapType == "world") then
  5234. local questType = self.QuestType
  5235. local questsAvailable = WorldQuestTracker.Cache_ShownQuestOnWorldMap [questType]
  5236.  
  5237. if (questsAvailable) then
  5238. for i = 1, #questsAvailable do
  5239. local questID = questsAvailable [i]
  5240. --> track this quest
  5241. local widget = WorldQuestTracker.GetWorldWidgetForQuest (questID)
  5242.  
  5243. if (widget) then
  5244. WorldQuestTracker.AddQuestToTracker (widget)
  5245. if (widget.onEndTrackAnimation:IsPlaying()) then
  5246. widget.onEndTrackAnimation:Stop()
  5247. end
  5248. widget.onStartTrackAnimation:Play()
  5249. end
  5250. end
  5251.  
  5252. if (WorldQuestTracker.db.profile.sound_enabled) then
  5253. if (math.random (2) == 1) then
  5254. PlaySoundFile ("Interface\\AddOns\\WorldQuestTracker\\media\\quest_added_to_tracker_mass1.mp3")
  5255. else
  5256. PlaySoundFile ("Interface\\AddOns\\WorldQuestTracker\\media\\quest_added_to_tracker_mass2.mp3")
  5257. end
  5258. end
  5259. WorldQuestTracker.UpdateWorldQuestsOnWorldMap (true, false)
  5260. end
  5261. end
  5262. end
  5263.  
  5264. local resource_GoldFrame = CreateFrame ("button", nil, WorldQuestTracker.DoubleTapFrame)
  5265. resource_GoldFrame.QuestType = WQT_QUESTTYPE_GOLD
  5266. resource_GoldFrame:SetScript ("OnClick", TrackAllFromType)
  5267.  
  5268. local resource_ResourcesFrame = CreateFrame ("button", nil, WorldQuestTracker.DoubleTapFrame)
  5269. resource_ResourcesFrame.QuestType = WQT_QUESTTYPE_RESOURCE
  5270. resource_ResourcesFrame:SetScript ("OnClick", TrackAllFromType)
  5271.  
  5272. local resource_APowerFrame = CreateFrame ("button", nil, WorldQuestTracker.DoubleTapFrame)
  5273. resource_APowerFrame.QuestType = WQT_QUESTTYPE_APOWER
  5274. resource_APowerFrame:SetScript ("OnClick", TrackAllFromType)
  5275.  
  5276. local shadow = WorldQuestTracker.DoubleTapFrame:CreateTexture (nil, "background")
  5277. shadow:SetPoint ("left", resource_GoldIcon.widget, "left", 2, 0)
  5278. shadow:SetTexture ([[Interface\AddOns\WorldQuestTracker\media\background_blackgradientT]])
  5279. shadow:SetSize (58, 10)
  5280. shadow:SetAlpha (.3)
  5281. local shadow = WorldQuestTracker.DoubleTapFrame:CreateTexture (nil, "background")
  5282. shadow:SetPoint ("left", resource_ResourcesIcon.widget, "left", 2, 0)
  5283. shadow:SetTexture ([[Interface\AddOns\WorldQuestTracker\media\background_blackgradientT]])
  5284. shadow:SetSize (58, 10)
  5285. shadow:SetAlpha (.3)
  5286. local shadow = WorldQuestTracker.DoubleTapFrame:CreateTexture (nil, "background")
  5287. shadow:SetPoint ("left", resource_APowerIcon.widget, "left", 2, 0)
  5288. shadow:SetTexture ([[Interface\AddOns\WorldQuestTracker\media\background_blackgradientT]])
  5289. shadow:SetSize (58, 10)
  5290. shadow:SetAlpha (.3)
  5291.  
  5292. resource_GoldFrame:SetSize (55, 20)
  5293. resource_ResourcesFrame:SetSize (55, 20)
  5294. resource_APowerFrame:SetSize (55, 20)
  5295.  
  5296. resource_GoldFrame:SetPoint ("left", resource_GoldIcon.widget, "left", -2, 0)
  5297. resource_ResourcesFrame:SetPoint ("left", resource_ResourcesIcon.widget, "left", -2, 0)
  5298. resource_APowerFrame:SetPoint ("left", resource_APowerIcon.widget, "left", -2, 0)
  5299.  
  5300. resource_GoldFrame:SetScript ("OnEnter", function (self)
  5301. resource_GoldText.textcolor = "WQT_ORANGE_ON_ENTER"
  5302.  
  5303. GameCooltip:Preset (2)
  5304. GameCooltip:SetType ("tooltip")
  5305. GameCooltip:SetOption ("TextSize", 10)
  5306. GameCooltip:SetOption ("FixedWidth", 220)
  5307.  
  5308. GameCooltip:AddLine (L["S_QUESTTYPE_GOLD"])
  5309. GameCooltip:AddIcon (WQT_QUEST_NAMES_AND_ICONS [WQT_QUESTTYPE_GOLD].icon, 1, 1, 20, 20)
  5310.  
  5311. GameCooltip:AddLine ("", "", 1, "green", _, 10)
  5312. GameCooltip:AddLine (format (L["S_MAPBAR_RESOURCES_TOOLTIP_TRACKALL"], L["S_QUESTTYPE_GOLD"]), "", 1, "green", _, 10)
  5313.  
  5314. GameCooltip:SetOwner (self)
  5315. GameCooltip:Show(self)
  5316. CooltipOnTop_WhenFullScreen()
  5317. end)
  5318.  
  5319. resource_ResourcesFrame:SetScript ("OnEnter", function (self)
  5320. resource_ResourcesText.textcolor = "WQT_ORANGE_ON_ENTER"
  5321.  
  5322. GameCooltip:Preset (2)
  5323. GameCooltip:SetType ("tooltip")
  5324. GameCooltip:SetOption ("TextSize", 10)
  5325. GameCooltip:SetOption ("FixedWidth", 220)
  5326.  
  5327. GameCooltip:AddLine (L["S_QUESTTYPE_RESOURCE"])
  5328. GameCooltip:AddIcon (WQT_QUEST_NAMES_AND_ICONS [WQT_QUESTTYPE_RESOURCE].icon, 1, 1, 20, 20)
  5329.  
  5330. GameCooltip:AddLine ("", "", 1, "green", _, 10)
  5331. GameCooltip:AddLine (format (L["S_MAPBAR_RESOURCES_TOOLTIP_TRACKALL"], L["S_QUESTTYPE_RESOURCE"]), "", 1, "green", _, 10)
  5332.  
  5333. GameCooltip:SetOwner (self)
  5334. GameCooltip:Show(self)
  5335. CooltipOnTop_WhenFullScreen()
  5336. end)
  5337.  
  5338. resource_APowerFrame:SetScript ("OnEnter", function (self)
  5339. resource_APowerText.textcolor = "WQT_ORANGE_ON_ENTER"
  5340.  
  5341. GameCooltip:Preset (2)
  5342. GameCooltip:SetType ("tooltipbar")
  5343. GameCooltip:SetOption ("TextSize", 10)
  5344. GameCooltip:SetOption ("FixedWidth", 220)
  5345. GameCooltip:SetOption ("StatusBarTexture", [[Interface\RaidFrame\Raid-Bar-Hp-Fill]])
  5346.  
  5347. GameCooltip:AddLine (L["S_QUESTTYPE_ARTIFACTPOWER"])
  5348. GameCooltip:AddIcon (WQT_QUEST_NAMES_AND_ICONS [WQT_QUESTTYPE_APOWER].icon, 1, 1, 20, 20)
  5349.  
  5350. local itemID, altItemID, name, icon, totalXP, pointsSpent, quality, artifactAppearanceID, appearanceModID, itemAppearanceID, altItemAppearanceID, altOnTop = C_ArtifactUI.GetEquippedArtifactInfo()
  5351. if (itemID and WorldQuestTracker.WorldMap_APowerIndicator.Amount) then
  5352.  
  5353. --7.2 need to get the artifact tier
  5354. local artifactItemID, _, _, _, artifactTotalXP, artifactPointsSpent, _, _, _, _, _, _, artifactTier = C_ArtifactUI.GetEquippedArtifactInfo()
  5355. --then request the xp details
  5356. local numPointsAvailableToSpend, xp, xpForNextPoint = MainMenuBar_GetNumArtifactTraitsPurchasableFromXP (pointsSpent, totalXP, artifactTier)
  5357.  
  5358. local Available_APower = WorldQuestTracker.WorldMap_APowerIndicator.Amount / xpForNextPoint * 100
  5359. local diff = xpForNextPoint - xp
  5360. local Diff_APower = WorldQuestTracker.WorldMap_APowerIndicator.Amount / diff * 100
  5361. GameCooltip:AddLine (L["S_APOWER_AVAILABLE"], L["S_APOWER_NEXTLEVEL"], 1, 1, 1, 1, 1, 1, 1, 1, 1, nil, nil, "OUTLINE")
  5362.  
  5363. --GameCooltip:AddStatusBar (math.min (Available_APower, 100), 1, 0.9019, 0.7999, 0.5999, .85, true, {value = 100, color = {.3, .3, .3, 1}, specialSpark = false, texture = [[Interface\WorldStateFrame\WORLDSTATEFINALSCORE-HIGHLIGHT]]})
  5364. GameCooltip:AddStatusBar (math.min (Diff_APower, 100), 1, 0.9019, 0.7999, 0.5999, .85, true, {value = 100, color = {.3, .3, .3, 1}, specialSpark = false, texture = [[Interface\WorldStateFrame\WORLDSTATEFINALSCORE-HIGHLIGHT]]})
  5365. --GameCooltip:AddLine (comma_value (WorldQuestTracker.WorldMap_APowerIndicator.Amount), comma_value (xpForNextPoint), 1, "white", "white")
  5366. GameCooltip:AddLine (comma_value (WorldQuestTracker.WorldMap_APowerIndicator.Amount), comma_value (diff), 1, "white", "white")
  5367. --statusbarValue, frame, ColorR, ColorG, ColorB, ColorA, statusbarGlow, backgroundBar, barTexture
  5368. --print (xp, xpForNextPoint)
  5369. end
  5370.  
  5371. local nameLoc, timeleftString, timeLeft, elapsedTime = WorldQuestTracker:GetNextResearchNoteTime()
  5372. if (timeleftString) then
  5373. GameCooltip:AddLine (nameLoc, timeleftString, 1, "white", _, 10)
  5374. GameCooltip:AddIcon (237446, 1, 1, 18, 18, 5/64, 59/64, 5/64, 59/64)
  5375. end
  5376.  
  5377. local str = "|TInterface\\AddOns\\WorldQuestTracker\\media\\icon_artifactpower_blueT:0|t"
  5378. GameCooltip:AddLine (format (L["S_APOWER_DOWNVALUE"], str), "", 1, "white", _, 10)
  5379.  
  5380. GameCooltip:AddLine ("", "", 1, "green", _, 10)
  5381. GameCooltip:AddLine (format (L["S_MAPBAR_RESOURCES_TOOLTIP_TRACKALL"], L["S_QUESTTYPE_ARTIFACTPOWER"]), "", 1, "green", _, 10)
  5382. GameCooltip:SetOption ("LeftTextHeight", 22)
  5383. GameCooltip:SetOwner (self)
  5384. GameCooltip:Show(self)
  5385.  
  5386. CooltipOnTop_WhenFullScreen()
  5387.  
  5388. --WQT_QUEST_NAMES_AND_ICONS [WQT_QUESTTYPE_GOLD].icon
  5389. --WQT_QUEST_NAMES_AND_ICONS [WQT_QUESTTYPE_RESOURCE].icon
  5390. end)
  5391.  
  5392. local resource_IconsOnLeave = function (self)
  5393. GameCooltip:Hide()
  5394. resource_GoldText.textcolor = "WQT_ORANGE_RESOURCES_AVAILABLE"
  5395. resource_ResourcesText.textcolor = "WQT_ORANGE_RESOURCES_AVAILABLE"
  5396. resource_APowerText.textcolor = "WQT_ORANGE_RESOURCES_AVAILABLE"
  5397. end
  5398.  
  5399. resource_GoldFrame:SetScript ("OnLeave", resource_IconsOnLeave)
  5400. resource_ResourcesFrame:SetScript ("OnLeave", resource_IconsOnLeave)
  5401. resource_APowerFrame:SetScript ("OnLeave", resource_IconsOnLeave)
  5402.  
  5403. --------------
  5404.  
  5405. --anima��o
  5406. worldFramePOIs:SetScript ("OnShow", function()
  5407. worldFramePOIs.fadeInAnimation:Play()
  5408. end)
  5409. end
  5410.  
  5411. --esta dentro de dalaran?
  5412. if (WorldQuestTracker.CanShowBrokenIsles()) then
  5413. SetMapByID (MAPID_BROKENISLES)
  5414. WorldQuestTracker.CanChangeMap = true
  5415. WorldQuestTracker.UpdateWorldQuestsOnWorldMap (false, true)
  5416.  
  5417. elseif (WorldMapFrame.mapID == MAPID_BROKENISLES) then
  5418. WorldQuestTracker.UpdateWorldQuestsOnWorldMap (false, true)
  5419.  
  5420. else
  5421. WorldQuestTracker.HideWorldQuestsOnWorldMap()
  5422. --print ("eh pra hidar...")
  5423. end
  5424.  
  5425. -- ~tutorial
  5426. --WorldQuestTracker.db.profile.GotTutorial = nil
  5427. if (not WorldQuestTracker.db.profile.GotTutorial and not WorldQuestTracker.TutorialHoldOn) then
  5428.  
  5429. local re_ShowTutorialPanel = function()
  5430. WorldQuestTracker.ShowTutorialPanel()
  5431. end
  5432.  
  5433. function WorldQuestTracker.ShowTutorialPanel()
  5434.  
  5435. if (not WorldMapFrame:IsShown() or not IsQuestFlaggedCompleted (WORLD_QUESTS_AVAILABLE_QUEST_ID or 1)) then
  5436. WorldQuestTracker.TutorialHoldOn = true
  5437. C_Timer.After (10, re_ShowTutorialPanel)
  5438. return
  5439. end
  5440.  
  5441. WorldQuestTracker.TutorialHoldOn = true
  5442.  
  5443. local tutorialFrame = CreateFrame ("button", "WorldQuestTrackerTutorial", WorldMapFrame)
  5444. tutorialFrame:SetSize (160, 350)
  5445. tutorialFrame:SetPoint ("left", WorldMapFrame, "left")
  5446. tutorialFrame:SetPoint ("right", WorldMapFrame, "right")
  5447. tutorialFrame:SetBackdrop ({bgFile = "Interface\\Tooltips\\UI-Tooltip-Background", tile = true, tileSize = 16, edgeFile = [[Interface\Buttons\WHITE8X8]], edgeSize = 1})
  5448. tutorialFrame:SetBackdropColor (0, 0, 0, 1)
  5449. tutorialFrame:SetBackdropBorderColor (0, 0, 0, 1)
  5450. tutorialFrame:SetFrameStrata ("fullscreen")
  5451.  
  5452. tutorialFrame:SetScript ("OnClick", function()
  5453. WorldQuestTracker.db.profile.GotTutorial = true
  5454. tutorialFrame:Hide()
  5455. WorldQuestTracker.ShowTutorialAlert()
  5456. end)
  5457.  
  5458. local upLine = tutorialFrame:CreateTexture (nil, "overlay")
  5459. local downLine = tutorialFrame:CreateTexture (nil, "overlay")
  5460. upLine:SetColorTexture (1, 1, 1)
  5461. upLine:SetHeight (1)
  5462. upLine:SetPoint ("topleft", tutorialFrame, "topleft")
  5463. upLine:SetPoint ("topright", tutorialFrame, "topright")
  5464. downLine:SetColorTexture (1, 1, 1)
  5465. downLine:SetHeight (1)
  5466. downLine:SetPoint ("bottomleft", tutorialFrame, "bottomleft")
  5467. downLine:SetPoint ("bottomright", tutorialFrame, "bottomright")
  5468.  
  5469. local extraBg = tutorialFrame:CreateTexture (nil, "background")
  5470. extraBg:SetAllPoints()
  5471. extraBg:SetColorTexture (0, 0, 0, 0.3)
  5472. local extraBg2 = tutorialFrame:CreateTexture (nil, "background")
  5473. extraBg2:SetPoint ("topleft", tutorialFrame, "bottomleft")
  5474. extraBg2:SetPoint ("topright", tutorialFrame, "bottomright")
  5475. extraBg2:SetHeight (36)
  5476. extraBg2:SetColorTexture (0, 0, 0, 1)
  5477. local downLine2 = tutorialFrame:CreateTexture (nil, "overlay")
  5478. downLine2:SetColorTexture (1, 1, 1)
  5479. downLine2:SetHeight (1)
  5480. downLine2:SetPoint ("bottomleft", extraBg2, "bottomleft")
  5481. downLine2:SetPoint ("bottomright", extraBg2, "bottomright")
  5482. local doubleTap = tutorialFrame:CreateFontString (nil, "overlay", "GameFontNormal")
  5483. doubleTap:SetPoint ("left", extraBg2, "left", 246, 2)
  5484. DF:SetFontSize (doubleTap, 12)
  5485. doubleTap:SetText (L["S_MAPBAR_AUTOWORLDMAP_DESC"])
  5486. doubleTap:SetJustifyH ("left")
  5487. doubleTap:SetTextColor (1, 1, 1)
  5488. local doubleTabTexture = tutorialFrame:CreateTexture (nil, "overlay")
  5489. doubleTabTexture:SetTexture ([[Interface\DialogFrame\UI-Dialog-Icon-AlertNew]])
  5490. doubleTabTexture:SetTexCoord (0, 1, 0, .9)
  5491. doubleTabTexture:SetPoint ("right", doubleTap, "left", -4, 0)
  5492. doubleTabTexture:SetSize (32, 32)
  5493.  
  5494. doubleTap:Hide()
  5495. doubleTabTexture:Hide()
  5496. local title = tutorialFrame:CreateFontString (nil, "overlay", "GameFontNormal")
  5497. title:SetPoint ("center", extraBg2, "center")
  5498. title:SetText ("World Quest Tracker")
  5499. DF:SetFontSize (title, 24)
  5500.  
  5501. local close = DF:CreateButton (tutorialFrame, function()
  5502. WorldQuestTracker.db.profile.GotTutorial = true
  5503. tutorialFrame:Hide()
  5504. WorldQuestTracker.ShowTutorialAlert()
  5505. end, 100, 24, L["S_TUTORIAL_CLOSE"])
  5506. close:SetPoint ("right", extraBg2, "right", -8, 0)
  5507. close:InstallCustomTexture()
  5508.  
  5509. local texture = tutorialFrame:CreateTexture (nil, "border")
  5510. texture:SetSize (120, 120)
  5511. texture:SetPoint ("left", tutorialFrame, "left", 100, 70)
  5512. texture:SetTexture ([[Interface\ICONS\INV_Chest_Mail_RaidHunter_I_01]])
  5513.  
  5514. local square = tutorialFrame:CreateTexture (nil, "artwork")
  5515. square:SetPoint ("topleft", texture, "topleft", -8, 8)
  5516. square:SetPoint ("bottomright", texture, "bottomright", 8, -8)
  5517. square:SetTexture ([[Interface\AddOns\WorldQuestTracker\media\border_whiteT]])
  5518.  
  5519. local timeBlip = tutorialFrame:CreateTexture (nil, "overlay", 2)
  5520. timeBlip:SetPoint ("bottomright", texture, "bottomright", 15, -12)
  5521. timeBlip:SetSize (32, 32)
  5522. timeBlip:SetTexture ([[Interface\COMMON\Indicator-Green]])
  5523. timeBlip:SetVertexColor (1, 1, 1)
  5524. timeBlip:SetAlpha (1)
  5525.  
  5526. local partyStarBlip = tutorialFrame:CreateTexture (nil, "overlay", 2)
  5527. partyStarBlip:SetPoint ("topleft", texture, "topleft", -18, 20)
  5528. partyStarBlip:SetTexture ([[Interface\AddOns\WorldQuestTracker\media\icon_party_sharedT]])
  5529. partyStarBlip:SetSize (48*.8, 48*.8)
  5530. --partyStarBlip:SetDrawLayer ("background", 3)
  5531.  
  5532. local flag = tutorialFrame:CreateTexture (nil, "overlay")
  5533. flag:SetTexture ([[Interface\AddOns\WorldQuestTracker\media\icon_flagT]])
  5534. flag:SetPoint ("top", texture, "bottom", 0, 5)
  5535. flag:SetSize (64*2, 32*2)
  5536.  
  5537. local amountText = tutorialFrame:CreateFontString (nil, "overlay", "GameFontNormal")
  5538. amountText:SetPoint ("center", flag, "center", 0, 19)
  5539. DF:SetFontSize (amountText, 20)
  5540. amountText:SetText ("100")
  5541.  
  5542. local amountBackground = tutorialFrame:CreateTexture (nil, "overlay")
  5543. amountBackground:SetPoint ("center", amountText, "center", 0, 0)
  5544. amountBackground:SetTexture ([[Interface\AddOns\WorldQuestTracker\media\background_blackgradientT]])
  5545. amountBackground:SetSize (32*2, 10*2)
  5546. amountBackground:SetAlpha (.7)
  5547.  
  5548. local criteriaIndicator = tutorialFrame:CreateTexture (nil, "OVERLAY", 2)
  5549. criteriaIndicator:SetPoint ("bottomleft", texture, "bottomleft", 0, -6)
  5550. criteriaIndicator:SetSize (23*.8, 37*.8)
  5551. criteriaIndicator:SetAlpha (.8)
  5552. criteriaIndicator:SetTexture ([[Interface\AdventureMap\AdventureMap]])
  5553. criteriaIndicator:SetTexCoord (901/1024, 924/1024, 251/1024, 288/1024)
  5554. local criteriaIndicatorGlow = tutorialFrame:CreateTexture (nil, "OVERLAY", 1)
  5555. criteriaIndicatorGlow:SetPoint ("center", criteriaIndicator, "center")
  5556. criteriaIndicatorGlow:SetSize (32, 32)
  5557. criteriaIndicatorGlow:SetTexture ([[Interface\AddOns\WorldQuestTracker\media\criteriaIndicatorGlowT]])
  5558. criteriaIndicatorGlow:SetTexCoord (0, 1, 0, 1)
  5559.  
  5560. flag:SetDrawLayer ("overlay", 1)
  5561. amountBackground:SetDrawLayer ("overlay", 2)
  5562. amountText:SetDrawLayer ("overlay", 3)
  5563.  
  5564. --indicadores de raridade rarity
  5565. local rarity1 = tutorialFrame:CreateTexture (nil, "overlay")
  5566. rarity1:SetTexture ([[Interface\AddOns\WorldQuestTracker\media\border_whiteT]])
  5567. local rarity2 = tutorialFrame:CreateTexture (nil, "overlay")
  5568. rarity2:SetTexture ([[Interface\AddOns\WorldQuestTracker\media\border_blueT]])
  5569. local rarity3 = tutorialFrame:CreateTexture (nil, "overlay")
  5570. rarity3:SetTexture ([[Interface\AddOns\WorldQuestTracker\media\border_pinkT]])
  5571. rarity1:SetPoint ("topright", texture, "topright", 50, 0)
  5572. rarity2:SetPoint ("left", rarity1, "right", 2, 0)
  5573. rarity3:SetPoint ("left", rarity2, "right", 2, 0)
  5574. rarity1:SetSize (24, 24); rarity2:SetSize (rarity1:GetSize()); rarity3:SetSize (rarity1:GetSize());
  5575. local rarityText = tutorialFrame:CreateFontString (nil, "overlay", "GameFontNormal")
  5576. rarityText:SetPoint ("left", rarity3, "right", 4, 0)
  5577. DF:SetFontSize (rarityText, 12)
  5578. rarityText:SetText (L["S_TUTORIAL_RARITY"])
  5579.  
  5580. --indicadores de tempo
  5581. local time1 = tutorialFrame:CreateTexture (nil, "overlay")
  5582. time1:SetPoint ("topright", texture, "topright", 50, -30)
  5583. time1:SetSize (24, 24)
  5584. time1:SetTexture ([[Interface\COMMON\Indicator-Green]])
  5585. local time2 = tutorialFrame:CreateTexture (nil, "overlay")
  5586. time2:SetPoint ("left", time1, "right", 2, 0)
  5587. time2:SetSize (24, 24)
  5588. time2:SetTexture ([[Interface\COMMON\Indicator-Yellow]])
  5589. local time3 = tutorialFrame:CreateTexture (nil, "overlay")
  5590. time3:SetPoint ("left", time2, "right", 2, 0)
  5591. time3:SetSize (24, 24)
  5592. time3:SetTexture ([[Interface\COMMON\Indicator-Yellow]])
  5593. time3:SetVertexColor (1, .7, 0)
  5594. local time4 = tutorialFrame:CreateTexture (nil, "overlay")
  5595. time4:SetPoint ("left", time3, "right", 2, 0)
  5596. time4:SetSize (24, 24)
  5597. time4:SetTexture ([[Interface\COMMON\Indicator-Red]])
  5598. local timeText = tutorialFrame:CreateFontString (nil, "overlay", "GameFontNormal")
  5599. timeText:SetPoint ("left", time4, "right", 4, 2)
  5600. DF:SetFontSize (timeText, 12)
  5601. timeText:SetText (L["S_TUTORIAL_TIMELEFT"])
  5602.  
  5603. --incador de quantidade
  5604. local flag = tutorialFrame:CreateTexture (nil, "overlay")
  5605. flag:SetTexture ([[Interface\AddOns\WorldQuestTracker\media\icon_flagT]])
  5606. flag:SetPoint ("topright", texture, "topright", 88, -60)
  5607. flag:SetSize (64*1, 32*1)
  5608.  
  5609. local amountText = tutorialFrame:CreateFontString (nil, "overlay", "GameFontNormal")
  5610. amountText:SetPoint ("center", flag, "center", 0, 10)
  5611. DF:SetFontSize (amountText, 9)
  5612. amountText:SetText ("100")
  5613.  
  5614. local amountBackground = tutorialFrame:CreateTexture (nil, "overlay")
  5615. amountBackground:SetPoint ("center", amountText, "center", 0, 0)
  5616. amountBackground:SetTexture ([[Interface\AddOns\WorldQuestTracker\media\background_blackgradientT]])
  5617. amountBackground:SetSize (32*2, 10*2)
  5618. amountBackground:SetAlpha (.7)
  5619.  
  5620. local timeText = tutorialFrame:CreateFontString (nil, "overlay", "GameFontNormal")
  5621. timeText:SetPoint ("left", flag, "right", 4, 10)
  5622. DF:SetFontSize (timeText, 12)
  5623. timeText:SetText (L["S_TUTORIAL_AMOUNT"])
  5624.  
  5625. --indicadores de recompensa
  5626. local texture1 = tutorialFrame:CreateTexture (nil, "overlay")
  5627. texture1:SetSize (24, 24)
  5628. texture1:SetPoint ("topright", texture, "topright", 50, -90)
  5629. texture1:SetTexture ([[Interface\ICONS\INV_Chest_RaidShaman_I_01]])
  5630. local texture2 = tutorialFrame:CreateTexture (nil, "overlay")
  5631. texture2:SetSize (24, 24)
  5632. texture2:SetPoint ("left", texture1, "right", 2, 0)
  5633. texture2:SetTexture ([[Interface\GossipFrame\auctioneerGossipIcon]])
  5634. local texture3 = tutorialFrame:CreateTexture (nil, "overlay")
  5635. texture3:SetSize (24, 24)
  5636. texture3:SetPoint ("left", texture2, "right", 2, 0)
  5637. texture3:SetTexture ([[Interface\AddOns\WorldQuestTracker\media\icon_artifactpower_blueT]])
  5638. local texture4 = tutorialFrame:CreateTexture (nil, "overlay")
  5639. texture4:SetSize (24, 24)
  5640. texture4:SetPoint ("left", texture3, "right", 2, 0)
  5641. texture4:SetTexture ([[Interface\Icons\inv_orderhall_orderresources]])
  5642. local texture5 = tutorialFrame:CreateTexture (nil, "overlay")
  5643. texture5:SetSize (24, 24)
  5644. texture5:SetPoint ("left", texture4, "right", 2, 0)
  5645. texture5:SetTexture (1417744)
  5646.  
  5647. local textureText = tutorialFrame:CreateFontString (nil, "overlay", "GameFontNormal")
  5648. textureText:SetPoint ("left", texture5, "right", 6, 0)
  5649. DF:SetFontSize (textureText, 12)
  5650. textureText:SetText (L["S_TUTORIAL_REWARD"])
  5651.  
  5652. --indicador de fac��o
  5653. local criteriaIndicator = tutorialFrame:CreateTexture (nil, "OVERLAY", 2)
  5654. criteriaIndicator:SetPoint ("topright", texture, "topright", 48, -122)
  5655. criteriaIndicator:SetSize (23*.8, 37*.8)
  5656. criteriaIndicator:SetAlpha (.8)
  5657. criteriaIndicator:SetTexture ([[Interface\AdventureMap\AdventureMap]])
  5658. criteriaIndicator:SetTexCoord (901/1024, 924/1024, 251/1024, 288/1024)
  5659. local criteriaIndicatorGlow = tutorialFrame:CreateTexture (nil, "OVERLAY", 1)
  5660. criteriaIndicatorGlow:SetPoint ("center", criteriaIndicator, "center")
  5661. criteriaIndicatorGlow:SetSize (18, 18)
  5662. criteriaIndicatorGlow:SetTexture ([[Interface\AddOns\WorldQuestTracker\media\criteriaIndicatorGlowT]])
  5663. criteriaIndicatorGlow:SetTexCoord (0, 1, 0, 1)
  5664.  
  5665. local faccaoText = tutorialFrame:CreateFontString (nil, "overlay", "GameFontNormal")
  5666. faccaoText:SetPoint ("left", criteriaIndicator, "right", 6, 0)
  5667. DF:SetFontSize (faccaoText, 12)
  5668. faccaoText:SetText (L["S_TUTORIAL_FACTIONBOUNTY"])
  5669.  
  5670. --indicator de quantas questes ha para a fac��o
  5671. local factionFrame = CreateFrame ("frame", nil, tutorialFrame)
  5672. factionFrame:SetSize (20, 20)
  5673. factionFrame:SetPoint ("topright", texture, "topright", 50, -162)
  5674.  
  5675. local factionIcon = factionFrame:CreateTexture (nil, "background")
  5676. factionIcon:SetSize (18, 18)
  5677. factionIcon:SetPoint ("center", factionFrame, "center")
  5678. factionIcon:SetDrawLayer ("background", -2)
  5679.  
  5680. local factionHighlight = factionFrame:CreateTexture (nil, "background")
  5681. factionHighlight:SetSize (36, 36)
  5682. factionHighlight:SetTexture ([[Interface\QUESTFRAME\WorldQuest]])
  5683. factionHighlight:SetTexCoord (0.546875, 0.62109375, 0.6875, 0.984375)
  5684. factionHighlight:SetDrawLayer ("background", -3)
  5685. factionHighlight:SetPoint ("center", factionFrame, "center")
  5686.  
  5687. local factionIconBorder = factionFrame:CreateTexture (nil, "artwork", 0)
  5688. factionIconBorder:SetSize (20, 20)
  5689. factionIconBorder:SetPoint ("center", factionFrame, "center")
  5690. factionIconBorder:SetTexture ([[Interface\COMMON\GoldRing]])
  5691.  
  5692. local factionQuestAmount = factionFrame:CreateFontString (nil, "overlay", "GameFontNormal")
  5693. factionQuestAmount:SetPoint ("center", factionFrame, "center")
  5694. factionQuestAmount:SetText ("4")
  5695.  
  5696. local factionQuestAmountBackground = factionFrame:CreateTexture (nil, "background")
  5697. factionQuestAmountBackground:SetPoint ("center", factionFrame, "center")
  5698. factionQuestAmountBackground:SetTexture ([[Interface\AddOns\WorldQuestTracker\media\background_blackgradientT]])
  5699. factionQuestAmountBackground:SetSize (20, 10)
  5700. factionQuestAmountBackground:SetAlpha (.7)
  5701. factionQuestAmountBackground:SetDrawLayer ("background", 3)
  5702.  
  5703. local faccaoAmountText = tutorialFrame:CreateFontString (nil, "overlay", "GameFontNormal")
  5704. faccaoAmountText:SetPoint ("left", factionFrame, "right", 6, 0)
  5705. DF:SetFontSize (faccaoAmountText, 12)
  5706. faccaoAmountText:SetText (L["S_TUTORIAL_FACTIONBOUNTY_AMOUNTQUESTS"])
  5707.  
  5708. --click para colocar no tracker
  5709. local clickToTrack = factionFrame:CreateTexture (nil, "background")
  5710. clickToTrack:SetPoint ("topright", texture, "topright", 51, -192)
  5711. clickToTrack:SetTexture ([[Interface\TUTORIALFRAME\UI-TUTORIAL-FRAME]])
  5712. clickToTrack:SetTexCoord (15/512, 63/512, 231/512, 306/512)
  5713. clickToTrack:SetSize (48*.5, 75*.5)
  5714. clickToTrack:SetDrawLayer ("background", 3)
  5715.  
  5716. local clickToTrack2 = tutorialFrame:CreateFontString (nil, "overlay", "GameFontNormal")
  5717. clickToTrack2:SetPoint ("left", clickToTrack, "right", 6, 0)
  5718. DF:SetFontSize (clickToTrack2, 12)
  5719. clickToTrack2:SetText (L["S_TUTORIAL_HOWTOADDTRACKER"])
  5720.  
  5721. --indicator de party
  5722. local partyStar = tutorialFrame:CreateTexture (nil, "background")
  5723. partyStar:SetPoint ("topright", texture, "topright", 51, -236)
  5724. partyStar:SetTexture ([[Interface\AddOns\WorldQuestTracker\media\icon_party_sharedT]])
  5725. partyStar:SetSize (48*.5, 48*.5)
  5726. partyStar:SetDrawLayer ("background", 3)
  5727.  
  5728. local partyStar2 = tutorialFrame:CreateFontString (nil, "overlay", "GameFontNormal")
  5729. partyStar2:SetPoint ("left", partyStar, "right", 6, 0)
  5730. DF:SetFontSize (partyStar2, 12)
  5731. partyStar2:SetText ("A blue star indicates all party members have this quest as well (if they have world quest tracker installed).")
  5732. end
  5733.  
  5734. WorldQuestTracker.ShowTutorialPanel()
  5735.  
  5736. end
  5737.  
  5738. -- ~tutorial
  5739. WorldQuestTracker.ShowTutorialAlert()
  5740.  
  5741. else
  5742. WorldQuestTracker.NoAutoSwitchToWorldMap = nil
  5743. end
  5744. end)
  5745.  
  5746. ----------------------------------------------------------------------------------------------------------------------------------------------------------------
  5747. --> zone summary
  5748.  
  5749. local ZoneSumaryFrame = CreateFrame ("frame", "WorldQuestTrackerZoneSummaryFrame", worldFramePOIs)
  5750. ZoneSumaryFrame:SetPoint ("bottomleft", WorldMapScrollFrame, "bottomleft", 0, 19)
  5751. ZoneSumaryFrame:SetSize (1, 1)
  5752.  
  5753. ZoneSumaryFrame.WidgetHeight = 18
  5754. ZoneSumaryFrame.WidgetWidth = 130
  5755. ZoneSumaryFrame.WidgetBackdrop = {bgFile = "Interface\\Tooltips\\UI-Tooltip-Background", tile = true, tileSize = 16}
  5756. ZoneSumaryFrame.WidgetBackdropColor = {0, 0, 0, 0}
  5757. ZoneSumaryFrame.IconSize = 18
  5758. ZoneSumaryFrame.IconTextureSize = 14
  5759. ZoneSumaryFrame.IconTimeSize = 18
  5760.  
  5761. WorldQuestTracker.ZoneSumaryWidgets = {}
  5762.  
  5763. ZoneSumaryFrame.Header = CreateFrame ("frame", "WorldQuestTrackerSummaryHeader", ZoneSumaryFrame, "ObjectiveTrackerHeaderTemplate")
  5764. ZoneSumaryFrame.Header.Title = ZoneSumaryFrame.Header:CreateFontString (nil, "overlay", "GameFontNormal")
  5765. ZoneSumaryFrame.Header.Title:SetText ("Quest Summary")
  5766. ZoneSumaryFrame.Header.Desc = ZoneSumaryFrame.Header:CreateFontString (nil, "overlay", "GameFontNormal")
  5767. ZoneSumaryFrame.Header.Desc:SetText ("Click to Add to Tracker")
  5768. ZoneSumaryFrame.Header.Desc:SetAlpha (.7)
  5769. DF:SetFontSize (ZoneSumaryFrame.Header.Title, 10)
  5770. DF:SetFontSize (ZoneSumaryFrame.Header.Desc, 8)
  5771. ZoneSumaryFrame.Header.Title:SetPoint ("topleft", ZoneSumaryFrame.Header, "topleft", -9, -2)
  5772. ZoneSumaryFrame.Header.Desc:SetPoint ("bottomleft", ZoneSumaryFrame.Header, "bottomleft", -9, 4)
  5773. ZoneSumaryFrame.Header.Background:SetWidth (150)
  5774. ZoneSumaryFrame.Header.Background:SetHeight (ZoneSumaryFrame.Header.Background:GetHeight()*0.45)
  5775. ZoneSumaryFrame.Header.Background:SetTexCoord (0, 1, 0, .45)
  5776. ZoneSumaryFrame.Header:Hide()
  5777. ZoneSumaryFrame.Header.BlackBackground = ZoneSumaryFrame.Header:CreateTexture (nil, "background")
  5778. ZoneSumaryFrame.Header.BlackBackground:SetTexture ([[Interface\AddOns\WorldQuestTracker\media\background_summaryzoneT]])
  5779. ZoneSumaryFrame.Header.BlackBackground:SetAlpha (.8)
  5780. ZoneSumaryFrame.Header.BlackBackground:SetSize (150, ZoneSumaryFrame.Header.Background:GetHeight())
  5781. ZoneSumaryFrame.Header.BlackBackground:SetPoint ("topleft", ZoneSumaryFrame.Header.Background, "topleft", 8, -14)
  5782. ZoneSumaryFrame.Header.BlackBackground:SetPoint ("bottomright", ZoneSumaryFrame.Header.Background, "bottomright", 0, 0)
  5783.  
  5784. local GetOrCreateZoneSummaryWidget = function (index)
  5785.  
  5786. local widget = WorldQuestTracker.ZoneSumaryWidgets [index]
  5787. if (widget) then
  5788. return widget
  5789. end
  5790.  
  5791. local button = CreateFrame ("button", "WorldQuestTrackerZoneSummaryFrame_Widget" .. index, ZoneSumaryFrame)
  5792. button:SetPoint ("bottomleft", ZoneSumaryFrame, "bottomleft", 0, ((index-1)* (ZoneSumaryFrame.WidgetHeight + 1)) -2)
  5793. button:SetSize (ZoneSumaryFrame.WidgetWidth, ZoneSumaryFrame.WidgetHeight)
  5794. button:SetFrameLevel (worldFramePOIs:GetFrameLevel()+1)
  5795. --button:SetBackdrop (ZoneSumaryFrame.WidgetBackdrop)
  5796. --button:SetBackdropColor (unpack (ZoneSumaryFrame.WidgetBackdropColor))
  5797.  
  5798. local buttonIcon = WorldQuestTracker.CreateZoneWidget (index, "WorldQuestTrackerZoneSummaryFrame_WidgetIcon", button)
  5799. buttonIcon:SetPoint ("left", button, "left", 2, 0)
  5800. buttonIcon:SetSize (ZoneSumaryFrame.IconSize, ZoneSumaryFrame.IconSize)
  5801. --buttonIcon:SetFrameStrata ("DIALOG")
  5802. buttonIcon:SetFrameLevel (worldFramePOIs:GetFrameLevel()+2)
  5803. button.Icon = buttonIcon
  5804.  
  5805. local art = button:CreateTexture (nil, "border")
  5806. art:SetAllPoints()
  5807. art:SetTexture ([[Interface\ARCHEOLOGY\ArchaeologyParts]])
  5808. art:SetTexCoord (73/512, 320/512, 15/256, 65/256)
  5809. art:SetAlpha (1)
  5810.  
  5811. local art2 = button:CreateTexture (nil, "artwork")
  5812. art2:SetAllPoints()
  5813. art2:SetTexture ([[Interface\AddOns\WorldQuestTracker\media\background_summaryzoneT]])
  5814. art2:SetAlpha (.4)
  5815. button.BlackBackground = art2
  5816.  
  5817. local highlight = button:CreateTexture (nil, "highlight")
  5818. highlight:SetAllPoints()
  5819. highlight:SetTexture ([[Interface\AddOns\WorldQuestTracker\media\border_pixel_whiteT.blp]])
  5820. highlight:SetAlpha (.2)
  5821. button.Highlight = highlight
  5822.  
  5823. --border lines
  5824. local lineUp = button:CreateTexture (nil, "overlay")
  5825. lineUp:SetTexture ([[Interface\AddOns\WorldQuestTracker\media\border_pixel_whiteT.blp]])
  5826. lineUp:SetPoint ("bottomleft", button, "topleft", 0, -1)
  5827. lineUp:SetPoint ("bottomright", button, "topright", 0, -1)
  5828. lineUp:SetHeight (1)
  5829. lineUp:SetVertexColor (0, 0, 0)
  5830. lineUp:SetAlpha (.3)
  5831.  
  5832. --border lines
  5833. local lineDown = button:CreateTexture (nil, "overlay")
  5834. lineDown:SetTexture ([[Interface\AddOns\WorldQuestTracker\media\border_pixel_whiteT.blp]])
  5835. lineDown:SetPoint ("topleft", button, "bottomleft", 0, 1)
  5836. lineDown:SetPoint ("topright", button, "bottomright", 0, 1)
  5837. lineDown:SetHeight (1)
  5838. lineDown:SetVertexColor (0, 0, 0)
  5839. lineDown:SetAlpha (.3)
  5840. button.LineDown = lineDown
  5841. button.LineUp = lineUp
  5842. --
  5843.  
  5844. local x = 30
  5845. buttonIcon.timeBlipRed:ClearAllPoints()
  5846. buttonIcon.timeBlipRed:SetPoint ("left", buttonIcon, "right", x, 0)
  5847. buttonIcon.timeBlipRed:SetSize (ZoneSumaryFrame.IconTimeSize, ZoneSumaryFrame.IconTimeSize)
  5848. buttonIcon.timeBlipRed:SetAlpha (1)
  5849. buttonIcon.timeBlipOrange:ClearAllPoints()
  5850. buttonIcon.timeBlipOrange:SetPoint ("left", buttonIcon, "right", x, 0)
  5851. buttonIcon.timeBlipOrange:SetSize (ZoneSumaryFrame.IconTimeSize, ZoneSumaryFrame.IconTimeSize)
  5852. buttonIcon.timeBlipOrange:SetAlpha (.8)
  5853. buttonIcon.timeBlipYellow:ClearAllPoints()
  5854. buttonIcon.timeBlipYellow:SetPoint ("left", buttonIcon, "right", x, 0)
  5855. buttonIcon.timeBlipYellow:SetSize (ZoneSumaryFrame.IconTimeSize, ZoneSumaryFrame.IconTimeSize)
  5856. buttonIcon.timeBlipYellow:SetAlpha (.6)
  5857. buttonIcon.timeBlipGreen:ClearAllPoints()
  5858. buttonIcon.timeBlipGreen:SetPoint ("left", buttonIcon, "right", x, 0)
  5859. buttonIcon.timeBlipGreen:SetSize (ZoneSumaryFrame.IconTimeSize, ZoneSumaryFrame.IconTimeSize)
  5860. buttonIcon.timeBlipGreen:SetAlpha (.3)
  5861. --
  5862. buttonIcon.criteriaIndicator:ClearAllPoints()
  5863. buttonIcon.criteriaIndicator:SetPoint ("left", buttonIcon, "right", 50, 0)
  5864. buttonIcon.criteriaIndicator:SetSize (23*.4, 37*.4)
  5865. --
  5866. button.Text = DF:CreateLabel (button)
  5867. button.Text:SetPoint ("left", buttonIcon, "right", 3, 0)
  5868. DF:SetFontSize (button.Text, 10)
  5869. DF:SetFontColor (button.Text, "orange")
  5870. --
  5871.  
  5872. button.OnTracker = button:CreateTexture (nil, "overlay")
  5873. button.OnTracker:SetPoint ("left", buttonIcon, "right", 65, 0)
  5874. button.OnTracker:SetTexture ([[Interface\AddOns\WorldQuestTracker\media\ArrowFrozen]])
  5875. button.OnTracker:SetAlpha (.75)
  5876. button.OnTracker:SetSize (16, 16)
  5877. button.OnTracker:SetTexCoord (.15, .8, .15, .80)
  5878.  
  5879. --
  5880. --animations
  5881. local on_enter_animation = DF:CreateAnimationHub (button, nil, function()
  5882. --button:SetScale (1.1, 1.1)
  5883. end)
  5884. on_enter_animation.Step1 = DF:CreateAnimation (on_enter_animation, "scale", 1, 0.05, 1, 1, 1.05, 1.05)
  5885. on_enter_animation.Step2 = DF:CreateAnimation (on_enter_animation, "scale", 2, 0.05, 1.05, 1.05, 1.0, 1.0)
  5886. button.OnEnterAnimation = on_enter_animation
  5887.  
  5888. local on_leave_animation = DF:CreateAnimationHub (button, nil, function()
  5889. --button:SetScale (1.0, 1.0)
  5890. end)
  5891. on_leave_animation.Step1 = DF:CreateAnimation (on_leave_animation, "scale", 1, 0.1, 1.1, 1.1, 1, 1)
  5892. button.OnLeaveAnimation = on_leave_animation
  5893.  
  5894. local mouseoverHighlight = WorldMapPOIFrame:CreateTexture (nil, "overlay")
  5895. mouseoverHighlight:SetTexture ([[Interface\Worldmap\QuestPoiGlow]])
  5896. mouseoverHighlight:SetSize (80, 80)
  5897. mouseoverHighlight:SetBlendMode ("ADD")
  5898.  
  5899. button:SetScript ("OnClick", function (self)
  5900. --WorldQuestTracker.AddQuestToTracker (self.Icon)
  5901. for i = 1, #WorldQuestTracker.Cache_ShownWidgetsOnZoneMap do
  5902. if (WorldQuestTracker.Cache_ShownWidgetsOnZoneMap[i].questID == self.Icon.questID) then
  5903. WorldQuestTracker.Cache_ShownWidgetsOnZoneMap[i]:GetScript ("OnClick")(WorldQuestTracker.Cache_ShownWidgetsOnZoneMap[i])
  5904. break
  5905. end
  5906. end
  5907. end)
  5908.  
  5909. button:SetScript ("OnEnter", function (self)
  5910. --print ("enter", self:GetScale())
  5911. --self.OnEnterAnimation.Step1:SetFromScale (self.OnEnterAnimation.Step1:GetScale())
  5912. --self.OnLeaveAnimation:Stop()
  5913. --self.OnEnterAnimation:Play()
  5914. --WorldQuestTracker.HaveZoneSummaryHover = self._Twin
  5915. WorldQuestTracker.HaveZoneSummaryHover = self
  5916. self.Icon:GetScript ("OnEnter")(self.Icon)
  5917. WorldMapTooltip:SetPoint ("bottomleft", WorldQuestTracker.HaveZoneSummaryHover, "bottomright", 2, 0)
  5918.  
  5919. --GameCooltip:Hide()
  5920. --procura o icone da quest no mapa e indica ele
  5921. for i = 1, #WorldQuestTracker.Cache_ShownWidgetsOnZoneMap do
  5922. if (WorldQuestTracker.Cache_ShownWidgetsOnZoneMap[i].questID == self.Icon.questID) then
  5923. mouseoverHighlight:SetPoint ("center", WorldQuestTracker.Cache_ShownWidgetsOnZoneMap[i], "center")
  5924. mouseoverHighlight:Show()
  5925. break
  5926. end
  5927. end
  5928.  
  5929. end)
  5930. button:SetScript ("OnLeave", function (self)
  5931. --print ("enter", self:GetScale())
  5932. --self.OnLeaveAnimation.Step1:SetFromScale (self.OnLeaveAnimation.Step1:GetScale())
  5933. --self.OnEnterAnimation:Stop()
  5934. --self.OnLeaveAnimation:Play()
  5935. self.Icon:GetScript ("OnLeave")(self.Icon)
  5936. WorldQuestTracker.HaveZoneSummaryHover = nil
  5937. mouseoverHighlight:Hide()
  5938. end)
  5939.  
  5940. WorldQuestTracker.ZoneSumaryWidgets [index] = button
  5941. return button
  5942. end
  5943.  
  5944. function WorldQuestTracker.ClearZoneSummaryButtons()
  5945. for _, button in ipairs (WorldQuestTracker.ZoneSumaryWidgets) do
  5946. button:Hide()
  5947. end
  5948. WorldQuestTracker.QuestSummaryShown = true
  5949. ZoneSumaryFrame.Header:Hide()
  5950. end
  5951.  
  5952. function WorldQuestTracker.SetupZoneSummaryButton (summaryWidget, zoneWidget)
  5953. local Icon = summaryWidget.Icon
  5954.  
  5955. Icon.mapID = zoneWidget.mapID
  5956. Icon.questID = zoneWidget.questID
  5957. Icon.numObjectives = zoneWidget.numObjectives
  5958.  
  5959. WorldQuestTracker.SetupWorldQuestButton (Icon, zoneWidget.worldQuestType, zoneWidget.rarity, zoneWidget.isElite, zoneWidget.tradeskillLineIndex, zoneWidget.inProgress, zoneWidget.selected, zoneWidget.isCriteria, zoneWidget.isSpellTarget)
  5960.  
  5961. --Icon.Shadow:Hide()
  5962. Icon.blackGradient:Hide()
  5963. Icon.rareSerpent:Hide()
  5964. Icon.rareGlow:Hide()
  5965. Icon.bgFlag:Hide()
  5966. Icon.IsTrackingRareGlow:Hide()
  5967. Icon.flagCriteriaMatchGlow:Hide()
  5968. Icon.flagText:Hide()
  5969.  
  5970. Icon.IsTrackingGlow:SetSize (30, 30)
  5971. Icon.IsTrackingGlow:Hide()
  5972. Icon.criteriaIndicatorGlow:Hide()
  5973.  
  5974. Icon.Texture:SetSize (ZoneSumaryFrame.IconTextureSize, ZoneSumaryFrame.IconTextureSize)
  5975. Icon.Texture:SetAlpha (.75)
  5976. Icon.circleBorder:SetAlpha (.75)
  5977.  
  5978. if (zoneWidget.rarity == LE_WORLD_QUEST_QUALITY_COMMON) then
  5979. summaryWidget.LineUp:SetAlpha (.3)
  5980. summaryWidget.LineDown:SetAlpha (.3)
  5981. summaryWidget.LineUp:SetVertexColor (0, 0, 0)
  5982. summaryWidget.LineDown:SetVertexColor (0, 0, 0)
  5983. elseif (zoneWidget.rarity == LE_WORLD_QUEST_QUALITY_RARE) then
  5984. local color = BAG_ITEM_QUALITY_COLORS [LE_ITEM_QUALITY_RARE]
  5985. summaryWidget.LineUp:SetAlpha (.8)
  5986. summaryWidget.LineDown:SetAlpha (.8)
  5987. summaryWidget.LineUp:SetVertexColor (color.r, color.g, color.b)
  5988. summaryWidget.LineDown:SetVertexColor (color.r, color.g, color.b)
  5989. elseif (zoneWidget.rarity == LE_WORLD_QUEST_QUALITY_EPIC) then
  5990. local color = BAG_ITEM_QUALITY_COLORS [LE_ITEM_QUALITY_EPIC]
  5991. summaryWidget.LineUp:SetAlpha (.8)
  5992. summaryWidget.LineDown:SetAlpha (.8)
  5993. summaryWidget.LineUp:SetVertexColor (color.r, color.g, color.b)
  5994. summaryWidget.LineDown:SetVertexColor (color.r, color.g, color.b)
  5995. end
  5996.  
  5997. Icon.flagText:SetText (zoneWidget.IconText)
  5998. summaryWidget.Text:SetText (zoneWidget.IconText)
  5999.  
  6000. summaryWidget.BlackBackground:SetAlpha (.4)
  6001. summaryWidget.Highlight:SetAlpha (.2)
  6002.  
  6003. summaryWidget:Show()
  6004. end
  6005.  
  6006. function WorldQuestTracker.CanShowZoneSummaryFrame()
  6007. return WorldQuestTracker.db.profile.use_quest_summary and is_broken_isles_map [GetCurrentMapAreaID()] and not WorldMapFrame_InWindowedMode()
  6008. end
  6009.  
  6010. function WorldQuestTracker.UpdateZoneSummaryFrame()
  6011. if (not WorldQuestTracker.CanShowZoneSummaryFrame()) then
  6012. if (WorldQuestTracker.QuestSummaryShown) then
  6013. WorldQuestTracker.ClearZoneSummaryButtons()
  6014. end
  6015. return
  6016. end
  6017.  
  6018. local index = 1
  6019. WorldQuestTracker.ClearZoneSummaryButtons()
  6020.  
  6021. table.sort (WorldQuestTracker.Cache_ShownWidgetsOnZoneMap, function (t1, t2)
  6022. return t1.Order < t2.Order
  6023. end)
  6024.  
  6025. local LastWidget
  6026. for i = 1, #WorldQuestTracker.Cache_ShownWidgetsOnZoneMap do
  6027. local zoneWidget = WorldQuestTracker.Cache_ShownWidgetsOnZoneMap [i]
  6028. local summaryWidget = GetOrCreateZoneSummaryWidget (index)
  6029. summaryWidget._Twin = zoneWidget
  6030. WorldQuestTracker.SetupZoneSummaryButton (summaryWidget, zoneWidget)
  6031. LastWidget = summaryWidget
  6032.  
  6033. if (WorldQuestTracker.IsQuestBeingTracked (zoneWidget.questID)) then
  6034. summaryWidget.OnTracker:Show()
  6035. else
  6036. summaryWidget.OnTracker:Hide()
  6037. end
  6038.  
  6039. index = index + 1
  6040. end
  6041.  
  6042. if (LastWidget) then
  6043. ZoneSumaryFrame.Header:Show()
  6044. ZoneSumaryFrame.Header:SetPoint ("bottomleft", LastWidget, "topleft", 20, 0)
  6045. end
  6046.  
  6047. WorldQuestTracker.QuestSummaryShown = true
  6048. end
  6049.  
  6050. ----------------------------------------------------------------------------------------------------------------------------------------------------------------
  6051. --> tracker quest --~tracker
  6052.  
  6053. local TRACKER_TITLE_TEXT_SIZE_INMAP = 12
  6054. local TRACKER_TITLE_TEXT_SIZE_OUTMAP = 10
  6055. local TRACKER_TITLE_TEXTWIDTH_MAX = 185
  6056. local TRACKER_ARROW_ALPHA_MAX = 1
  6057. local TRACKER_ARROW_ALPHA_MIN = .75
  6058. local TRACKER_BACKGROUND_ALPHA_MIN = .35
  6059. local TRACKER_BACKGROUND_ALPHA_MAX = .75
  6060. local TRACKER_FRAME_ALPHA_INMAP = 1
  6061. local TRACKER_FRAME_ALPHA_OUTMAP = .75
  6062.  
  6063. --verifica se a quest ja esta na lista de track
  6064. function WorldQuestTracker.IsQuestBeingTracked (questID)
  6065. for _, quest in ipairs (WorldQuestTracker.QuestTrackList) do
  6066. if (quest.questID == questID) then
  6067. return true
  6068. end
  6069. end
  6070. return
  6071. end
  6072.  
  6073.  
  6074. function WorldQuestTracker.AddQuestTomTom (questID, mapID, noRemove)
  6075. local x, y = C_TaskQuest.GetQuestLocation (questID, mapID)
  6076. local title, factionID, tagID, tagName, worldQuestType, rarity, isElite, tradeskillLineIndex = WorldQuestTracker.GetQuest_Info (questID)
  6077. local alreadyExists = TomTom:WaypointMFExists (mapID, nil, x, y, title)
  6078.  
  6079. if (alreadyExists and WorldQuestTracker.db.profile.tomtom.uids [questID]) then
  6080. if (noRemove) then
  6081. return
  6082. end
  6083. TomTom:RemoveWaypoint (WorldQuestTracker.db.profile.tomtom.uids [questID])
  6084. WorldQuestTracker.db.profile.tomtom.uids [questID] = nil
  6085. return
  6086. end
  6087.  
  6088. if (not alreadyExists) then
  6089. local uid = TomTom:AddMFWaypoint (mapID, nil, x, y, {title=title, persistent=WorldQuestTracker.db.profile.tomtom.persistent})
  6090. WorldQuestTracker.db.profile.tomtom.uids [questID] = uid
  6091. end
  6092. return
  6093. end
  6094.  
  6095. --adiciona uma quest ao tracker
  6096. function WorldQuestTracker.AddQuestToTracker (self)
  6097. local questID = self.questID
  6098.  
  6099. if (not HaveQuestData (questID)) then
  6100. WorldQuestTracker:Msg (L["S_ERROR_NOTLOADEDYET"])
  6101. return
  6102. end
  6103.  
  6104. if (WorldQuestTracker.db.profile.tomtom.enabled and TomTom and IsAddOnLoaded ("TomTom")) then
  6105. return WorldQuestTracker.AddQuestTomTom (self.questID, self.mapID)
  6106. end
  6107.  
  6108. if (WorldQuestTracker.IsQuestBeingTracked (questID)) then
  6109. return
  6110. end
  6111.  
  6112. local timeLeft = WorldQuestTracker.GetQuest_TimeLeft (questID)
  6113. if (timeLeft and timeLeft > 0) then
  6114. local mapID = self.mapID
  6115. local iconTexture = self.IconTexture
  6116. local iconText = self.IconText
  6117. local questType = self.QuestType
  6118. local numObjectives = self.numObjectives
  6119.  
  6120. -- if (type (iconText) == "string") then --no good
  6121. -- iconText = iconText:gsub ("|c%x?%x?%x?%x?%x?%x?%x?%x?", "")
  6122. -- iconText = iconText:gsub ("|r", "")
  6123. -- iconText = tonumber (iconText)
  6124. -- end
  6125. --removing this, the reward amount can now be a number or a string, we cannot check for amount without checking first if is a number (on tracker only)
  6126.  
  6127. if (iconTexture) then
  6128. tinsert (WorldQuestTracker.QuestTrackList, {
  6129. questID = questID,
  6130. mapID = mapID,
  6131. mapIDSynthetic = WorldQuestTracker.db.profile.syntheticMapIdList [mapID] or 0,
  6132. timeAdded = time(),
  6133. timeFraction = GetTime(),
  6134. timeLeft = timeLeft,
  6135. expireAt = time() + (timeLeft*60),
  6136. rewardTexture = iconTexture,
  6137. rewardAmount = iconText,
  6138. index = #WorldQuestTracker.QuestTrackList,
  6139. questType = questType,
  6140. numObjectives = numObjectives,
  6141. })
  6142. WorldQuestTracker.JustAddedToTracker [questID] = true
  6143. else
  6144. WorldQuestTracker:Msg (L["S_ERROR_NOTLOADEDYET"])
  6145. end
  6146.  
  6147. --atualiza os widgets para adicionar a quest no frame do tracker
  6148. WorldQuestTracker.RefreshTrackerWidgets()
  6149. else
  6150. WorldQuestTracker:Msg (L["S_ERROR_NOTIMELEFT"])
  6151. end
  6152. end
  6153.  
  6154. --remove uma quest que ja esta no tracker
  6155. --quando o addon iniciar e fazer a primeira chacagem de quests desatualizadas, mandar noUpdate = true
  6156. function WorldQuestTracker.RemoveQuestFromTracker (questID, noUpdate)
  6157. for index, quest in ipairs (WorldQuestTracker.QuestTrackList) do
  6158. if (quest.questID == questID) then
  6159. --remove da tabela
  6160. tremove (WorldQuestTracker.QuestTrackList, index)
  6161. --atualiza os widgets para remover a quest do frame do tracker
  6162. if (not noUpdate) then
  6163. WorldQuestTracker.RefreshTrackerWidgets()
  6164. end
  6165. return true
  6166. end
  6167. end
  6168. end
  6169.  
  6170. --remove todas as quests do tracker
  6171. function WorldQuestTracker.RemoveAllQuestsFromTracker()
  6172. for i = #WorldQuestTracker.QuestTrackList, 1, -1 do
  6173. local quest = WorldQuestTracker.QuestTrackList [i]
  6174. local questID = quest.questID
  6175. local widget = WorldQuestTracker.GetWorldWidgetForQuest (questID)
  6176. if (widget) then
  6177. if (widget.onStartTrackAnimation:IsPlaying()) then
  6178. widget.onStartTrackAnimation:Stop()
  6179. end
  6180. widget.onEndTrackAnimation:Play()
  6181. end
  6182. --remove da tabela
  6183. tremove (WorldQuestTracker.QuestTrackList, i)
  6184. end
  6185.  
  6186. WorldQuestTracker.RefreshTrackerWidgets()
  6187.  
  6188. if (WorldQuestTrackerAddon.GetCurrentZoneType() == "world") then
  6189. WorldQuestTracker.UpdateWorldQuestsOnWorldMap()
  6190. elseif (WorldQuestTrackerAddon.GetCurrentZoneType() == "zone") then
  6191. WorldQuestTracker.UpdateZoneWidgets()
  6192. end
  6193. end
  6194.  
  6195. --o cliente n�o tem o tempo restante da quest na primeira execu��o
  6196. function WorldQuestTracker.CheckTimeLeftOnQuestsFromTracker_Load()
  6197. for i = #WorldQuestTracker.QuestTrackList, 1, -1 do
  6198. local quest = WorldQuestTracker.QuestTrackList [i]
  6199. --if (HaveQuestData (quest.questID)) then
  6200. local timeLeft = WorldQuestTracker.GetQuest_TimeLeft (quest.questID)
  6201. --end
  6202. end
  6203. end
  6204.  
  6205. --verifica o tempo restante de cada quest no tracker e a remove se o tempo estiver terminado
  6206. function WorldQuestTracker.CheckTimeLeftOnQuestsFromTracker()
  6207. local now = time()
  6208. local gotRemoval
  6209.  
  6210. for i = #WorldQuestTracker.QuestTrackList, 1, -1 do
  6211. local quest = WorldQuestTracker.QuestTrackList [i]
  6212. local timeLeft = WorldQuestTracker.GetQuest_TimeLeft (quest.questID)
  6213.  
  6214. if (quest.expireAt < now or not timeLeft or timeLeft <= 0) then -- or not allQuests [quest.questID]
  6215. --print ("removing", quest.expireAt, now, quest.expireAt < now, select (1, C_TaskQuest.GetQuestInfoByQuestID(quest.questID)))
  6216. WorldQuestTracker.RemoveQuestFromTracker (quest.questID, true)
  6217. gotRemoval = true
  6218. end
  6219. end
  6220. if (gotRemoval) then
  6221. WorldQuestTracker.RefreshTrackerWidgets()
  6222. end
  6223. end
  6224.  
  6225. --ao clicar em um bot�o de uma quest no world map ou no mapa da zona
  6226. function WorldQuestTracker.OnQuestClicked (self, button)
  6227. --button � o frame que foi precionado
  6228. local questID = self.questID
  6229. local mapID = self.mapID
  6230.  
  6231. --verifica se a quest ja esta sendo monitorada
  6232. if (WorldQuestTracker.IsQuestBeingTracked (questID)) then
  6233. --remover a quest do track
  6234. WorldQuestTracker.RemoveQuestFromTracker (questID)
  6235. else
  6236. --adicionar a quest ao track
  6237. WorldQuestTracker.AddQuestToTracker (self)
  6238. end
  6239. if (self.IsZoneQuestButton) then
  6240. WorldQuestTracker.UpdateZoneWidgets()
  6241. elseif (self.IsWorldQuestButton) then
  6242. WorldQuestTracker.UpdateWorldQuestsOnWorldMap()
  6243. end
  6244. end
  6245.  
  6246. --organiza as quest para as quests do mapa atual serem jogadas para cima
  6247. local Sort_currentMapID = 0
  6248. local Sort_QuestsOnTracker = function (t1, t2)
  6249. if (t1.mapID == Sort_currentMapID and t2.mapID == Sort_currentMapID) then
  6250. return t1.LastDistance > t2.LastDistance
  6251. --return t1.timeFraction > t2.timeFraction
  6252. elseif (t1.mapID == Sort_currentMapID) then
  6253. return true
  6254. elseif (t2.mapID == Sort_currentMapID) then
  6255. return false
  6256. else
  6257. if (t1.mapIDSynthetic == t2.mapIDSynthetic) then
  6258. return t1.timeFraction > t2.timeFraction
  6259. else
  6260. return t1.mapIDSynthetic > t2.mapIDSynthetic
  6261. end
  6262. end
  6263. end
  6264.  
  6265. --poe as quests em ordem de acordo com o mapa atual do jogador?
  6266. function WorldQuestTracker.ReorderQuestsOnTracker()
  6267. --joga as quests do mapa atual pra cima
  6268. Sort_currentMapID = WorldMapFrame.currentStandingZone or GetCurrentMapAreaID()
  6269. if (Sort_currentMapID == 1080 or Sort_currentMapID == 1072) then
  6270. --Thunder Totem or Trueshot Lodge
  6271. Sort_currentMapID = 1024
  6272. end
  6273. for index, quest in ipairs (WorldQuestTracker.QuestTrackList) do
  6274. quest.LastDistance = quest.LastDistance or 0
  6275. end
  6276. table.sort (WorldQuestTracker.QuestTrackList, Sort_QuestsOnTracker)
  6277. end
  6278.  
  6279. --parent frame na UIParent ~trackerframe
  6280. --esse frame � quem vai ser anexado ao tracker da blizzard
  6281. --this is the main frame for the quest tracker, every thing on the tracker is parent of this frame
  6282. -- ~trackerframe
  6283. local WorldQuestTrackerFrame = CreateFrame ("frame", "WorldQuestTrackerScreenPanel", UIParent)
  6284. WorldQuestTrackerFrame:SetSize (235, 500)
  6285. WorldQuestTrackerFrame:SetFrameStrata ("LOW") --thanks @p3lim on curseforge
  6286.  
  6287. --debug tracker size
  6288. --WorldQuestTrackerFrame:SetBackdrop ({bgFile = "Interface\\Tooltips\\UI-Tooltip-Background", tile = true, tileSize = 16})
  6289.  
  6290.  
  6291. local WorldQuestTrackerFrame_QuestHolder = CreateFrame ("frame", "WorldQuestTrackerScreenPanel_QuestHolder", WorldQuestTrackerFrame)
  6292. WorldQuestTrackerFrame_QuestHolder:SetAllPoints()
  6293.  
  6294. function WorldQuestTracker.UpdateTrackerScale()
  6295. WorldQuestTrackerFrame:SetScale (WorldQuestTracker.db.profile.tracker_scale)
  6296. --WorldQuestTrackerFrame_QuestHolder:SetScale (WorldQuestTracker.db.profile.tracker_scale) --aumenta s� as quests sem mexer no cabe�alho
  6297. end
  6298.  
  6299. --cria o header
  6300. local WorldQuestTrackerHeader = CreateFrame ("frame", "WorldQuestTrackerQuestsHeader", WorldQuestTrackerFrame, "ObjectiveTrackerHeaderTemplate") -- "ObjectiveTrackerHeaderTemplate"
  6301. WorldQuestTrackerHeader.Text:SetText ("World Quest Tracker")
  6302. local minimizeButton = CreateFrame ("button", "WorldQuestTrackerQuestsHeaderMinimizeButton", WorldQuestTrackerFrame)
  6303. local minimizeButtonText = minimizeButton:CreateFontString (nil, "overlay", "GameFontNormal")
  6304. minimizeButtonText:SetText (L["S_WORLDQUESTS"])
  6305. minimizeButtonText:SetPoint ("right", minimizeButton, "left", -3, 1)
  6306. minimizeButtonText:Hide()
  6307.  
  6308. WorldQuestTrackerFrame.MinimizeButton = minimizeButton
  6309. minimizeButton:SetSize (16, 16)
  6310. minimizeButton:SetPoint ("topright", WorldQuestTrackerHeader, "topright", 0, -4)
  6311. minimizeButton:SetScript ("OnClick", function()
  6312. if (WorldQuestTrackerFrame.collapsed) then
  6313. WorldQuestTrackerFrame.collapsed = false
  6314. minimizeButton:GetNormalTexture():SetTexCoord (0, 0.5, 0.5, 1)
  6315. minimizeButton:GetPushedTexture():SetTexCoord (0.5, 1, 0.5, 1)
  6316. WorldQuestTrackerFrame_QuestHolder:Show()
  6317. WorldQuestTrackerHeader:Show()
  6318. minimizeButtonText:Hide()
  6319. else
  6320. WorldQuestTrackerFrame.collapsed = true
  6321. minimizeButton:GetNormalTexture():SetTexCoord (0, 0.5, 0, 0.5)
  6322. minimizeButton:GetPushedTexture():SetTexCoord (0.5, 1, 0, 0.5)
  6323. WorldQuestTrackerFrame_QuestHolder:Hide()
  6324. WorldQuestTrackerHeader:Hide()
  6325. minimizeButtonText:Show()
  6326. minimizeButtonText:SetText ("World Quest Tracker")
  6327. end
  6328. end)
  6329. minimizeButton:SetNormalTexture ([[Interface\Buttons\UI-Panel-QuestHideButton]])
  6330. minimizeButton:GetNormalTexture():SetTexCoord (0, 0.5, 0.5, 1)
  6331. minimizeButton:SetPushedTexture ([[Interface\Buttons\UI-Panel-QuestHideButton]])
  6332. minimizeButton:GetPushedTexture():SetTexCoord (0.5, 1, 0.5, 1)
  6333. minimizeButton:SetHighlightTexture ([[Interface\Buttons\UI-Panel-MinimizeButton-Highlight]])
  6334. minimizeButton:SetDisabledTexture ([[Interface\Buttons\UI-Panel-QuestHideButton-disabled]])
  6335.  
  6336. --armazena todos os widgets
  6337. local TrackerWidgetPool = {}
  6338. --inicializa a variavel que armazena o tamanho do quest frame
  6339. WorldQuestTracker.TrackerHeight = 0
  6340.  
  6341. --move anything
  6342. C_Timer.After (10, function()
  6343. if (MAOptions) then
  6344. MAOptions:HookScript ("OnUpdate", function()
  6345. WorldQuestTracker.RefreshAnchor()
  6346. end)
  6347.  
  6348. --ObjectiveTrackerFrameMover:CreateTexture("AA", "overlay")
  6349. --AA:SetAllPoints()
  6350. --AA:SetColorTexture (1, 1, 1, .3)
  6351. end
  6352. end)
  6353.  
  6354. --da refresh na ancora do screen panel
  6355. --enUS - refresh the track positioning on the player screen
  6356. function WorldQuestTracker.RefreshAnchor()
  6357.  
  6358. if (not WorldQuestTracker.db.profile.tracker_is_movable) then
  6359. WorldQuestTrackerScreenPanel:ClearAllPoints()
  6360.  
  6361. for i = 1, ObjectiveTrackerFrame:GetNumPoints() do
  6362. local point, relativeTo, relativePoint, xOfs, yOfs = ObjectiveTrackerFrame:GetPoint (i)
  6363.  
  6364. --note: we're probably missing something here, when the frame anchors to MoveAnything frame 'ObjectiveTrackerFrameMover',
  6365. --it automatically anchors to MinimapCluster frame.
  6366. --so the solution we've found was to get the screen position of the MoveAnything frame and anchor our frame to UIParent.
  6367.  
  6368. --if (relativeTo:GetName() == "ObjectiveTrackerFrameMover") then
  6369. if (IsAddOnLoaded("MoveAnything") and relativeTo and (relativeTo:GetName() == "ObjectiveTrackerFrameMover")) then -- (check if MA is lodaded - thanks @liquidbase on WoWUI)
  6370. local top, left = ObjectiveTrackerFrameMover:GetTop(), ObjectiveTrackerFrameMover:GetLeft()
  6371. WorldQuestTrackerScreenPanel:SetPoint ("top", UIParent, "top", 0, (yOfs - WorldQuestTracker.TrackerHeight - 20) - abs (top-GetScreenHeight()))
  6372. WorldQuestTrackerScreenPanel:SetPoint ("left", UIParent, "left", -10 + xOfs + left, 0)
  6373. else
  6374. WorldQuestTrackerScreenPanel:SetPoint (point, relativeTo, relativePoint, -10 + xOfs, yOfs - WorldQuestTracker.TrackerHeight - 20)
  6375. end
  6376.  
  6377. --print where the frame is setting its potision
  6378. --print ("SETTING POS ON:", point, relativeTo:GetName(), relativePoint, -10 + xOfs, yOfs - WorldQuestTracker.TrackerHeight - 20)
  6379. end
  6380.  
  6381. --print where the frame was anchored, weird thing happens if we set the anchor to a MoveAnything frame
  6382. --local point, relativeTo, relativePoint, xOfs, yOfs = WorldQuestTrackerScreenPanel:GetPoint (1)
  6383. --print ("SETTED AT", point, relativeTo:GetName(), relativePoint, xOfs, yOfs)
  6384.  
  6385. WorldQuestTrackerHeader:ClearAllPoints()
  6386. WorldQuestTrackerHeader:SetPoint ("bottom", WorldQuestTrackerFrame, "top", 0, -20)
  6387. else
  6388. --> se estiver destrancado, ativar o mouse
  6389. if (not WorldQuestTracker.db.profile.tracker_is_locked and WorldQuestTrackerScreenPanel.RegisteredForLibWindow) then
  6390. WorldQuestTrackerScreenPanel:EnableMouse (true)
  6391. LibWindow.MakeDraggable (WorldQuestTrackerScreenPanel)
  6392. else
  6393. WorldQuestTrackerScreenPanel:EnableMouse (false)
  6394. end
  6395.  
  6396. WorldQuestTrackerHeader:ClearAllPoints()
  6397. WorldQuestTrackerHeader:SetPoint ("bottom", WorldQuestTrackerFrame, "top", 0, -20)
  6398. end
  6399. end
  6400.  
  6401. --quando um widget for clicado, mostrar painel com op��o para parar de trackear
  6402. local TrackerFrameOnClick = function (self, button)
  6403. --ao clicar em cima de uma quest mostrada no tracker
  6404. --??--
  6405. if (button == "RightButton") then
  6406. WorldQuestTracker.RemoveQuestFromTracker (self.questID)
  6407. ---se o worldmap estiver aberto, dar refresh
  6408. if (WorldMapFrame:IsShown()) then
  6409. if (GetCurrentMapAreaID() == MAPID_BROKENISLES) then
  6410. --refresh no world map
  6411. WorldQuestTracker.UpdateWorldQuestsOnWorldMap (true)
  6412. elseif (is_broken_isles_map [GetCurrentMapAreaID()]) then
  6413. --refresh nos widgets
  6414. WorldQuestTracker.UpdateZoneWidgets()
  6415. WorldQuestTracker.WorldWidgets_NeedFullRefresh = true
  6416. end
  6417. else
  6418. WorldQuestTracker.WorldWidgets_NeedFullRefresh = true
  6419. end
  6420. else
  6421. --WQGF integration
  6422. if (WorldQuestGroupFinderAddon and button == "MiddleButton") then
  6423. WorldQuestGroupFinder.HandleBlockClick (self.questID)
  6424. return
  6425. end
  6426. WorldQuestTracker.CanLinkToChat (self, button)
  6427. end
  6428. end
  6429.  
  6430. local buildTooltip = function (self)
  6431. GameTooltip:ClearAllPoints()
  6432. GameTooltip:SetPoint ("TOPRIGHT", self, "TOPLEFT", -20, 0)
  6433. GameTooltip:SetOwner (self, "ANCHOR_PRESERVE")
  6434. local questID = self.questID
  6435.  
  6436. if ( not HaveQuestData (questID) ) then
  6437. GameTooltip:SetText (RETRIEVING_DATA, RED_FONT_COLOR.r, RED_FONT_COLOR.g, RED_FONT_COLOR.b)
  6438. GameTooltip:Show()
  6439. return
  6440. end
  6441.  
  6442. local title, factionID, capped = C_TaskQuest.GetQuestInfoByQuestID (questID)
  6443.  
  6444. local tagID, tagName, worldQuestType, rarity, isElite, tradeskillLineIndex = GetQuestTagInfo (questID)
  6445. local color = WORLD_QUEST_QUALITY_COLORS [rarity]
  6446. GameTooltip:SetText (title, color.r, color.g, color.b)
  6447.  
  6448. --belongs to what faction
  6449. if (factionID) then
  6450. local factionName = GetFactionInfoByID (factionID)
  6451. if (factionName) then
  6452. if (capped) then
  6453. GameTooltip:AddLine (factionName, GRAY_FONT_COLOR:GetRGB())
  6454. else
  6455. GameTooltip:AddLine (factionName, 0.4, 0.733, 1.0)
  6456. end
  6457. GameTooltip:AddLine (" ")
  6458. end
  6459. end
  6460.  
  6461. --time left
  6462. local timeLeftMinutes = C_TaskQuest.GetQuestTimeLeftMinutes (questID)
  6463. if (timeLeftMinutes) then
  6464. local color = NORMAL_FONT_COLOR
  6465. local timeString
  6466. if (timeLeftMinutes <= WORLD_QUESTS_TIME_CRITICAL_MINUTES) then
  6467. color = RED_FONT_COLOR
  6468. timeString = SecondsToTime (timeLeftMinutes * 60)
  6469. elseif (timeLeftMinutes <= 60 + WORLD_QUESTS_TIME_CRITICAL_MINUTES) then
  6470. timeString = SecondsToTime ((timeLeftMinutes - WORLD_QUESTS_TIME_CRITICAL_MINUTES) * 60)
  6471. elseif (timeLeftMinutes < 24 * 60 + WORLD_QUESTS_TIME_CRITICAL_MINUTES) then
  6472. timeString = D_HOURS:format (math.floor(timeLeftMinutes - WORLD_QUESTS_TIME_CRITICAL_MINUTES) / 60)
  6473. else
  6474. local days = math.floor(timeLeftMinutes - WORLD_QUESTS_TIME_CRITICAL_MINUTES) / 1440
  6475. local hours = math.floor(timeLeftMinutes - WORLD_QUESTS_TIME_CRITICAL_MINUTES) / 60
  6476. timeString = D_DAYS:format (days) .. " " .. D_HOURS:format (hours - (floor (days)*24))
  6477. end
  6478. GameTooltip:AddLine (BONUS_OBJECTIVE_TIME_LEFT:format (timeString), color.r, color.g, color.b)
  6479. end
  6480.  
  6481. --all objectives
  6482. for objectiveIndex = 1, self.numObjectives do
  6483. local objectiveText, objectiveType, finished = GetQuestObjectiveInfo(questID, objectiveIndex, false);
  6484. if ( objectiveText and #objectiveText > 0 ) then
  6485. local color = finished and GRAY_FONT_COLOR or HIGHLIGHT_FONT_COLOR;
  6486. GameTooltip:AddLine(QUEST_DASH .. objectiveText, color.r, color.g, color.b, true);
  6487. end
  6488. end
  6489.  
  6490. --percentage bar
  6491. local percent = C_TaskQuest.GetQuestProgressBarInfo (questID)
  6492. if ( percent ) then
  6493. GameTooltip_InsertFrame(GameTooltip, WorldMapTaskTooltipStatusBar);
  6494. WorldMapTaskTooltipStatusBar.Bar:SetValue(percent);
  6495. WorldMapTaskTooltipStatusBar.Bar.Label:SetFormattedText(PERCENTAGE_STRING, percent);
  6496. end
  6497.  
  6498. -- rewards
  6499. if ( GetQuestLogRewardXP(questID) > 0 or GetNumQuestLogRewardCurrencies(questID) > 0 or GetNumQuestLogRewards(questID) > 0 or GetQuestLogRewardMoney(questID) > 0 or GetQuestLogRewardArtifactXP(questID) > 0 ) then
  6500. GameTooltip:AddLine(" ");
  6501. GameTooltip:AddLine(QUEST_REWARDS, NORMAL_FONT_COLOR.r, NORMAL_FONT_COLOR.g, NORMAL_FONT_COLOR.b, true);
  6502. local hasAnySingleLineRewards = false;
  6503. -- xp
  6504. local xp = GetQuestLogRewardXP(questID);
  6505. if ( xp > 0 ) then
  6506. GameTooltip:AddLine(BONUS_OBJECTIVE_EXPERIENCE_FORMAT:format(xp), HIGHLIGHT_FONT_COLOR.r, HIGHLIGHT_FONT_COLOR.g, HIGHLIGHT_FONT_COLOR.b);
  6507. hasAnySingleLineRewards = true;
  6508. end
  6509. -- money
  6510. local money = GetQuestLogRewardMoney(questID);
  6511. if ( money > 0 ) then
  6512. SetTooltipMoney(GameTooltip, money, nil);
  6513. hasAnySingleLineRewards = true;
  6514. end
  6515. local artifactXP = GetQuestLogRewardArtifactXP(questID);
  6516. if ( artifactXP > 0 ) then
  6517. GameTooltip:AddLine(BONUS_OBJECTIVE_ARTIFACT_XP_FORMAT:format(artifactXP), HIGHLIGHT_FONT_COLOR.r, HIGHLIGHT_FONT_COLOR.g, HIGHLIGHT_FONT_COLOR.b);
  6518. hasAnySingleLineRewards = true;
  6519. end
  6520. -- currency
  6521. local numQuestCurrencies = GetNumQuestLogRewardCurrencies(questID);
  6522. for i = 1, numQuestCurrencies do
  6523. local name, texture, numItems = GetQuestLogRewardCurrencyInfo(i, questID);
  6524. local text = BONUS_OBJECTIVE_REWARD_WITH_COUNT_FORMAT:format(texture, numItems, name);
  6525. GameTooltip:AddLine(text, HIGHLIGHT_FONT_COLOR.r, HIGHLIGHT_FONT_COLOR.g, HIGHLIGHT_FONT_COLOR.b);
  6526. hasAnySingleLineRewards = true;
  6527. end
  6528. -- items
  6529. local numQuestRewards = GetNumQuestLogRewards (questID)
  6530. for i = 1, numQuestRewards do
  6531. local name, texture, numItems, quality, isUsable = GetQuestLogRewardInfo(i, questID);
  6532. local text;
  6533. if ( numItems > 1 ) then
  6534. text = string.format(BONUS_OBJECTIVE_REWARD_WITH_COUNT_FORMAT, texture, numItems, name);
  6535. elseif( texture and name ) then
  6536. text = string.format(BONUS_OBJECTIVE_REWARD_FORMAT, texture, name);
  6537. end
  6538. if( text ) then
  6539. local color = ITEM_QUALITY_COLORS[quality];
  6540. GameTooltip:AddLine(text, color.r, color.g, color.b);
  6541. end
  6542. end
  6543.  
  6544. end
  6545.  
  6546. GameTooltip:Show()
  6547. -- if (GameTooltip.ItemTooltip) then
  6548. -- GameTooltip:SetHeight (GameTooltip:GetHeight() + GameTooltip.ItemTooltip:GetHeight())
  6549. -- end
  6550. end
  6551.  
  6552. local TrackerFrameOnEnter = function (self)
  6553. local color = OBJECTIVE_TRACKER_COLOR["HeaderHighlight"]
  6554. self.Title:SetTextColor (color.r, color.g, color.b)
  6555.  
  6556. local color = OBJECTIVE_TRACKER_COLOR["NormalHighlight"]
  6557. self.Zone:SetTextColor (color.r, color.g, color.b)
  6558.  
  6559. self.RightBackground:SetAlpha (TRACKER_BACKGROUND_ALPHA_MAX)
  6560. self.Arrow:SetAlpha (TRACKER_ARROW_ALPHA_MAX)
  6561. buildTooltip (self)
  6562.  
  6563. self.HasOverHover = true
  6564. end
  6565.  
  6566. local TrackerFrameOnLeave = function (self)
  6567. local color = OBJECTIVE_TRACKER_COLOR["Header"]
  6568. self.Title:SetTextColor (color.r, color.g, color.b)
  6569.  
  6570. local color = OBJECTIVE_TRACKER_COLOR["Normal"]
  6571. self.Zone:SetTextColor (color.r, color.g, color.b)
  6572.  
  6573. self.RightBackground:SetAlpha (TRACKER_BACKGROUND_ALPHA_MIN)
  6574. self.Arrow:SetAlpha (TRACKER_ARROW_ALPHA_MIN)
  6575. GameTooltip:Hide()
  6576.  
  6577. self.HasOverHover = nil
  6578. self.QuestInfomation.text = ""
  6579. end
  6580.  
  6581. local TrackerIconButtonOnEnter = function (self)
  6582.  
  6583. end
  6584. local TrackerIconButtonOnLeave = function (self)
  6585.  
  6586. end
  6587. local TrackerIconButtonOnClick = function (self, button)
  6588. if (self.questID == GetSuperTrackedQuestID()) then
  6589. WorldQuestTracker.SuperTracked = nil
  6590. QuestSuperTracking_ChooseClosestQuest()
  6591. return
  6592. end
  6593.  
  6594. if (HaveQuestData (self.questID)) then
  6595. WorldQuestTracker.SelectSingleQuestInBlizzardWQTracker (self.questID)
  6596. WorldQuestTracker.RefreshTrackerWidgets()
  6597. WorldQuestTracker.SuperTracked = self.questID
  6598. end
  6599. end
  6600.  
  6601. -- �rrow ~arrow
  6602. local UpdateSuperQuestTracker = function()
  6603. if (WorldQuestTracker.SuperTracked and HaveQuestData (WorldQuestTracker.SuperTracked)) then
  6604. --verifica se a quest esta sendo mostrada no tracker
  6605. for i = 1, #TrackerWidgetPool do
  6606. if (TrackerWidgetPool[i]:IsShown() and TrackerWidgetPool[i].questID == WorldQuestTracker.SuperTracked) then
  6607. WorldQuestTracker.SelectSingleQuestInBlizzardWQTracker (WorldQuestTracker.SuperTracked)
  6608. return
  6609. end
  6610. end
  6611. WorldQuestTracker.SuperTracked = nil
  6612. end
  6613. end
  6614.  
  6615. --[[
  6616. -- overwriting this was causing taint issues
  6617.  
  6618. --rewrite QuestSuperTracking_IsSuperTrackedQuestValid to avoid conflict with World Quest Tracker
  6619. function QuestSuperTracking_IsSuperTrackedQuestValid()
  6620. local trackedQuestID = GetSuperTrackedQuestID();
  6621. if trackedQuestID == 0 then
  6622. return false;
  6623. end
  6624.  
  6625. if GetQuestLogIndexByID(trackedQuestID) == 0 then
  6626. -- Might be a tracked world quest that isn't in our log yet (blizzard)
  6627. -- adding here if the quest is tracked by World Quest Tracker (tercio)
  6628. if (QuestUtils_IsQuestWorldQuest(trackedQuestID) and WorldQuestTracker.SuperTracked == trackedQuestID) then
  6629. return true
  6630. end
  6631. if QuestUtils_IsQuestWorldQuest(trackedQuestID) and IsWorldQuestWatched(trackedQuestID) then
  6632. return C_TaskQuest.IsActive(trackedQuestID);
  6633. end
  6634. return false;
  6635. end
  6636.  
  6637. return true;
  6638. end
  6639. --]]
  6640.  
  6641. -- See: https://wow.curseforge.com/projects/world-quest-tracker/issues/443
  6642. --[[
  6643. hooksecurefunc ("QuestSuperTracking_ChooseClosestQuest", function()
  6644. if (WorldQuestTracker.SuperTracked) then
  6645. --delay increased from 20ms to 200ms to avoid lag spikes
  6646. C_Timer.After (.2, UpdateSuperQuestTracker)
  6647. end
  6648. end)
  6649. ]]
  6650.  
  6651. local TrackerIconButtonOnMouseDown = function (self, button)
  6652. self.Icon:SetPoint ("topleft", self:GetParent(), "topleft", -12, -3)
  6653. end
  6654. local TrackerIconButtonOnMouseUp = function (self, button)
  6655. self.Icon:SetPoint ("topleft", self:GetParent(), "topleft", -13, -2)
  6656. end
  6657.  
  6658. --pega um widget j� criado ou cria um novo ~trackercreate ~trackerwidget
  6659. function WorldQuestTracker.GetOrCreateTrackerWidget (index)
  6660. if (TrackerWidgetPool [index]) then
  6661. return TrackerWidgetPool [index]
  6662. end
  6663.  
  6664. local f = CreateFrame ("button", "WorldQuestTracker_Tracker" .. index, WorldQuestTrackerFrame_QuestHolder)
  6665. --f:SetBackdrop ({bgFile = "Interface\\Tooltips\\UI-Tooltip-Background", tile = true, tileSize = 16})
  6666. --f:SetBackdropColor (0, 0, 0, .2)
  6667. f:SetSize (235, 30)
  6668. f:SetScript ("OnClick", TrackerFrameOnClick)
  6669. f:SetScript ("OnEnter", TrackerFrameOnEnter)
  6670. f:SetScript ("OnLeave", TrackerFrameOnLeave)
  6671. f:RegisterForClicks ("LeftButtonDown", "MiddleButtonDown", "RightButtonDown")
  6672.  
  6673. f.RightBackground = f:CreateTexture (nil, "background")
  6674. f.RightBackground:SetTexture ([[Interface\ACHIEVEMENTFRAME\UI-Achievement-HorizontalShadow]])
  6675. f.RightBackground:SetTexCoord (1, 61/128, 0, 1)
  6676. f.RightBackground:SetDesaturated (true)
  6677. f.RightBackground:SetPoint ("topright", f, "topright")
  6678. f.RightBackground:SetPoint ("bottomright", f, "bottomright")
  6679. f.RightBackground:SetWidth (200)
  6680. f.RightBackground:SetAlpha (TRACKER_BACKGROUND_ALPHA_MIN)
  6681.  
  6682. --f.module = _G ["WORLD_QUEST_TRACKER_MODULE"]
  6683. f.worldQuest = true
  6684.  
  6685. f.Title = DF:CreateLabel (f)
  6686. f.Title.textsize = TRACKER_TITLE_TEXT_SIZE_INMAP
  6687. --f.Title = f:CreateFontString (nil, "overlay", "ObjectiveFont")
  6688. f.Title:SetPoint ("topleft", f, "topleft", 10, -1)
  6689. local titleColor = OBJECTIVE_TRACKER_COLOR["Header"]
  6690. f.Title:SetTextColor (titleColor.r, titleColor.g, titleColor.b)
  6691. f.Zone = DF:CreateLabel (f)
  6692. f.Zone.textsize = TRACKER_TITLE_TEXT_SIZE_INMAP
  6693. --f.Zone = f:CreateFontString (nil, "overlay", "ObjectiveFont")
  6694. f.Zone:SetPoint ("topleft", f, "topleft", 10, -17)
  6695.  
  6696. f.QuestInfomation = DF:CreateLabel (f)
  6697. f.QuestInfomation:SetPoint ("topleft", f, "topright", 2, 0)
  6698.  
  6699. f.YardsDistance = f:CreateFontString (nil, "overlay", "GameFontNormal")
  6700. f.YardsDistance:SetPoint ("left", f.Zone.widget, "right", 2, 0)
  6701. f.YardsDistance:SetJustifyH ("left")
  6702. DF:SetFontColor (f.YardsDistance, "white")
  6703. DF:SetFontSize (f.YardsDistance, 12)
  6704. f.YardsDistance:SetAlpha (.5)
  6705.  
  6706. f.TimeLeft = f:CreateFontString (nil, "overlay", "GameFontNormal")
  6707. f.TimeLeft:SetPoint ("left", f.YardsDistance, "right", 2, 0)
  6708. f.TimeLeft:SetJustifyH ("left")
  6709. DF:SetFontColor (f.TimeLeft, "white")
  6710. DF:SetFontSize (f.TimeLeft, 12)
  6711. f.TimeLeft:SetAlpha (.5)
  6712.  
  6713. f.Icon = f:CreateTexture (nil, "artwork")
  6714. f.Icon:SetPoint ("topleft", f, "topleft", -13, -2)
  6715. f.Icon:SetSize (16, 16)
  6716.  
  6717. local IconButton = CreateFrame ("button", "$parentIconButton", f)
  6718. IconButton:SetSize (18, 18)
  6719. IconButton:SetPoint ("center", f.Icon, "center")
  6720. IconButton:SetScript ("OnEnter", TrackerIconButtonOnEnter)
  6721. IconButton:SetScript ("OnLeave", TrackerIconButtonOnLeave)
  6722. IconButton:SetScript ("OnClick", TrackerIconButtonOnClick)
  6723. IconButton:SetScript ("OnMouseDown", TrackerIconButtonOnMouseDown)
  6724. IconButton:SetScript ("OnMouseUp", TrackerIconButtonOnMouseUp)
  6725. IconButton.Icon = f.Icon
  6726. f.IconButton = IconButton
  6727. --
  6728. f.Circle = f:CreateTexture (nil, "overlay")
  6729. f.Circle:SetTexture ([[Interface\Transmogrify\Transmogrify]])
  6730. f.Circle:SetTexCoord (381/512, 405/512, 93/512, 117/512)
  6731. f.Circle:SetSize (18, 18)
  6732. --f.Circle:SetPoint ("center", f.Icon, "center")
  6733. f.Circle:SetPoint ("topleft", f, "topleft", -14, -1)
  6734. f.Circle:SetDesaturated (true)
  6735. f.Circle:SetAlpha (.7)
  6736.  
  6737. f.RewardAmount = f:CreateFontString (nil, "overlay", "ObjectiveFont")
  6738. f.RewardAmount:SetTextColor (titleColor.r, titleColor.g, titleColor.b)
  6739. f.RewardAmount:SetPoint ("top", f.Circle, "bottom", 0, -2)
  6740. DF:SetFontSize (f.RewardAmount, 10)
  6741.  
  6742. f.Shadow = f:CreateTexture (nil, "BACKGROUND")
  6743. f.Shadow:SetSize (26, 26)
  6744. f.Shadow:SetPoint ("center", f.Circle, "center")
  6745. f.Shadow:SetTexture ([[Interface\PETBATTLES\BattleBar-AbilityBadge-Neutral]])
  6746. f.Shadow:SetAlpha (.3)
  6747. f.Shadow:SetDrawLayer ("BACKGROUND", -5)
  6748.  
  6749. f.SuperTracked = f:CreateTexture (nil, "background")
  6750. f.SuperTracked:SetPoint ("center", f.Circle, "center")
  6751. f.SuperTracked:SetAlpha (1)
  6752. f.SuperTracked:SetTexture ([[Interface\Worldmap\UI-QuestPoi-IconGlow]])
  6753. f.SuperTracked:SetBlendMode ("ADD")
  6754. f.SuperTracked:SetSize (42, 42)
  6755. f.SuperTracked:SetDrawLayer ("BACKGROUND", -6)
  6756. f.SuperTracked:Hide()
  6757.  
  6758. local highlight = IconButton:CreateTexture (nil, "highlight")
  6759. highlight:SetPoint ("center", f.Circle, "center")
  6760. highlight:SetAlpha (1)
  6761. highlight:SetTexture ([[Interface\Worldmap\UI-QuestPoi-NumberIcons]])
  6762. --highlight:SetTexCoord (167/256, 185/256, 103/256, 121/256) --low light
  6763. highlight:SetTexCoord (167/256, 185/256, 231/256, 249/256)
  6764. highlight:SetBlendMode ("ADD")
  6765. highlight:SetSize (14, 14)
  6766.  
  6767. f.Arrow = f:CreateTexture (nil, "overlay")
  6768. f.Arrow:SetPoint ("right", f, "right", 0, 0)
  6769. f.Arrow:SetSize (32, 32)
  6770. f.Arrow:SetAlpha (.6)
  6771. --f.Arrow:SetAlpha (1)
  6772. f.Arrow:SetTexture ([[Interface\AddOns\WorldQuestTracker\media\ArrowGridT]])
  6773.  
  6774. f.ArrowDistance = f:CreateTexture (nil, "overlay")
  6775. --f.ArrowDistance:SetPoint ("center", f.Arrow, "center", -5, 0)
  6776. f.ArrowDistance:SetPoint ("center", f.Arrow, "center", 0, 0)
  6777. f.ArrowDistance:SetSize (34, 34)
  6778. f.ArrowDistance:SetAlpha (.5)
  6779. f.ArrowDistance:SetTexture ([[Interface\AddOns\WorldQuestTracker\media\ArrowGridTGlow]])
  6780.  
  6781. f.ArrowDistance:SetDrawLayer ("overlay", 4)
  6782. f.Arrow:SetDrawLayer ("overlay", 5)
  6783.  
  6784. ------------------------
  6785.  
  6786. f.AnimationFrame = CreateFrame ("frame", "$parentAnimation", f)
  6787. f.AnimationFrame:SetAllPoints()
  6788. f.AnimationFrame:SetFrameLevel (f:GetFrameLevel()-1)
  6789. f.AnimationFrame:Hide()
  6790.  
  6791. local star = f.AnimationFrame:CreateTexture (nil, "overlay")
  6792. star:SetTexture ([[Interface\Cooldown\star4]])
  6793. star:SetSize (168, 168)
  6794. star:SetPoint ("center", f.Icon, "center", 1, -1)
  6795. star:SetBlendMode ("ADD")
  6796. star:Hide()
  6797.  
  6798. local flash = f.AnimationFrame:CreateTexture (nil, "overlay")
  6799. flash:SetTexture ([[Interface\ACHIEVEMENTFRAME\UI-Achievement-Alert-Glow]])
  6800. flash:SetTexCoord (0, 400/512, 0, 170/256)
  6801. flash:SetPoint ("topleft", -60, 30)
  6802. flash:SetPoint ("bottomright", 40, -30)
  6803. flash:SetBlendMode ("ADD")
  6804.  
  6805. local spark = f.AnimationFrame:CreateTexture (nil, "overlay")
  6806. spark:SetTexture ([[Interface\ACHIEVEMENTFRAME\UI-Achievement-Alert-Glow]])
  6807. spark:SetTexCoord (400/512, 470/512, 0, 70/256)
  6808. spark:SetSize (50, 34)
  6809. spark:SetBlendMode ("ADD")
  6810. spark:SetPoint ("left")
  6811.  
  6812. local iconoverlay = f:CreateTexture (nil, "overlay")
  6813. iconoverlay:SetTexture ([[Interface\COMMON\StreamBackground]])
  6814. iconoverlay:SetPoint ("center", f.Icon, "center", 0, 0)
  6815. iconoverlay:Hide()
  6816. --iconoverlay:SetSize (256, 256)
  6817. iconoverlay:SetDrawLayer ("overlay", 7)
  6818.  
  6819. --iconoverlay:SetSize (50, 34)
  6820. --iconoverlay:SetBlendMode ("ADD")
  6821.  
  6822.  
  6823. local StarShowAnimation = DF:CreateAnimationHub (star, function() star:Show() end, function() star:Hide() end)
  6824. DF:CreateAnimation (StarShowAnimation, "alpha", 1, .3, 0, .2)
  6825. DF:CreateAnimation (StarShowAnimation, "rotation", 1, .3, 90)
  6826. DF:CreateAnimation (StarShowAnimation, "scale", 1, .3, 0, 0, 1.2, 1.2)
  6827. DF:CreateAnimation (StarShowAnimation, "alpha", 2, .3, .2, 0)
  6828. DF:CreateAnimation (StarShowAnimation, "rotation", 2, .3, .8)
  6829. DF:CreateAnimation (StarShowAnimation, "scale", 1, .3, 1.2, 1.2, 0, 0)
  6830.  
  6831. local FlashAnimation = DF:CreateAnimationHub (flash, function() flash:Show() end, function() flash:Hide() end)
  6832. DF:CreateAnimation (FlashAnimation, "alpha", 1, .05, 0, .3)
  6833. DF:CreateAnimation (FlashAnimation, "alpha", 2, .5, .3, 0)
  6834.  
  6835. local SparkAnimation = DF:CreateAnimationHub (spark, function() spark:Show() end, function() spark:Hide() end)
  6836. DF:CreateAnimation (SparkAnimation, "alpha", 1, .2, 0, .1)
  6837. DF:CreateAnimation (SparkAnimation, "translation", 2, .3, 255, 0)
  6838.  
  6839. local CircleOverlayAnimation = DF:CreateAnimationHub (iconoverlay, function() iconoverlay:Show() end, function() iconoverlay:Hide() end)
  6840. DF:CreateAnimation (CircleOverlayAnimation, "alpha", 1, .05, 0, 1)
  6841. DF:CreateAnimation (CircleOverlayAnimation, "alpha", 2, .5, 1, 0)
  6842.  
  6843. f.AnimationFrame.ShowAnimation = function()
  6844. f.AnimationFrame:Show()
  6845. StarShowAnimation:Play()
  6846. spark:SetPoint ("left", -40, 0)
  6847. SparkAnimation:Play()
  6848. FlashAnimation:Play()
  6849. CircleOverlayAnimation:Play()
  6850. end
  6851.  
  6852. ------------------------
  6853.  
  6854. TrackerWidgetPool [index] = f
  6855. return f
  6856. end
  6857.  
  6858. local zoneXLength, zoneYLength = 0, 0
  6859. local playerIsMoving = true
  6860.  
  6861. function WorldQuestTracker:PLAYER_STARTED_MOVING()
  6862. playerIsMoving = true
  6863. end
  6864. function WorldQuestTracker:PLAYER_STOPPED_MOVING()
  6865. playerIsMoving = false
  6866. end
  6867.  
  6868. -- ~trackertick ~trackeronupdate ~tick ~onupdate ~ontick �ntick �nupdate
  6869. local TrackerOnTick = function (self, deltaTime)
  6870. if (self.NextPositionUpdate < 0) then
  6871. if (Sort_currentMapID ~= GetCurrentMapAreaID()) then
  6872. self.Arrow:SetAlpha (.3)
  6873. self.Arrow:SetTexture ([[Interface\AddOns\WorldQuestTracker\media\ArrowFrozen]])
  6874. self.Arrow:SetTexCoord (0, 1, 0, 1)
  6875. self.ArrowDistance:Hide()
  6876. self.Arrow.Frozen = true
  6877. return
  6878. elseif (self.Arrow.Frozen) then
  6879. self.Arrow:SetTexture ([[Interface\AddOns\WorldQuestTracker\media\ArrowGridT]])
  6880. self.ArrowDistance:Show()
  6881. self.Arrow.Frozen = nil
  6882. end
  6883. end
  6884.  
  6885. local x, y = GetPlayerMapPosition ("player")
  6886.  
  6887. if (self.NextArrowUpdate < 0) then
  6888. local questYaw = (FindLookAtRotation (_, x, y, self.questX, self.questY) + p)%pipi
  6889. local playerYaw = GetPlayerFacing()
  6890. local angle = (((questYaw + playerYaw)%pipi)+pi)%pipi
  6891. local imageIndex = 1+(floor (MapRangeClamped (_, 0, pipi, 1, 144, angle)) + 48)%144 --48� quadro � o que aponta para o norte
  6892. local line = ceil (imageIndex / 12)
  6893. local coord = (imageIndex - ((line-1) * 12)) / 12
  6894. self.Arrow:SetTexCoord (coord-0.0833, coord, 0.0833 * (line-1), 0.0833 * line)
  6895. --self.ArrowDistance:SetTexCoord (coord-0.0905, coord-0.0160, 0.0833 * (line-1), 0.0833 * line) -- 0.0763
  6896. self.ArrowDistance:SetTexCoord (coord-0.0833, coord, 0.0833 * (line-1), 0.0833 * line) -- 0.0763
  6897.  
  6898. self.NextArrowUpdate = ARROW_UPDATE_FREQUENCE
  6899. else
  6900. self.NextArrowUpdate = self.NextArrowUpdate - deltaTime
  6901. end
  6902.  
  6903. self.NextPositionUpdate = self.NextPositionUpdate - deltaTime
  6904.  
  6905. if ((playerIsMoving or self.ForceUpdate) and self.NextPositionUpdate < 0) then
  6906. local distance = GetDistance_Point (_, x, y, self.questX, self.questY)
  6907. local x = zoneXLength * distance
  6908. local y = zoneYLength * distance
  6909. local yards = (x*x + y*y) ^ 0.5
  6910. self.YardsDistance:SetText ("[|cFFC0C0C0" .. floor (yards) .. "|r]")
  6911.  
  6912. distance = abs (distance - 1)
  6913. self.info.LastDistance = distance
  6914.  
  6915. distance = Saturate (distance - 0.75) * 4
  6916. local alpha = MapRangeClamped (_, 0, 1, 0, 0.5, distance)
  6917. self.Arrow:SetAlpha (.5 + (alpha))
  6918. self.ArrowDistance:SetVertexColor (distance, distance, distance)
  6919.  
  6920. self.NextPositionUpdate = .5
  6921. self.ForceUpdate = nil
  6922.  
  6923. if (self.HasOverHover) then
  6924. if (IsAltKeyDown()) then
  6925. self.QuestInfomation.text = "ID: " .. self.questID .. "\nMapID: " .. self.info.mapID .. "\nTimeLeft: " .. self.info.timeLeft .. "\nType: " .. self.info.questType .. "\nNumObjetives: " .. self.info.numObjectives
  6926. else
  6927. self.QuestInfomation.text = ""
  6928. end
  6929. end
  6930. end
  6931.  
  6932. self.NextTimeUpdate = self.NextTimeUpdate - deltaTime
  6933.  
  6934. if (self.NextTimeUpdate < 0) then
  6935. if (HaveQuestData (self.questID)) then
  6936. local timeLeft = WorldQuestTracker.GetQuest_TimeLeft (self.questID)
  6937. if (timeLeft and timeLeft > 0) then
  6938. local timeLeft2 = WorldQuestTracker.GetQuest_TimeLeft (self.questID, true)
  6939. --local str = timeLeft > 1440 and floor (timeLeft/1440) .. "d" or timeLeft > 60 and floor (timeLeft/60) .. "h" or timeLeft .. "m"
  6940. local color = "FFC0C0C0"
  6941. if (timeLeft < 30) then
  6942. color = "FFFF2200"
  6943. elseif (timeLeft < 60) then
  6944. color = "FFFF9900"
  6945. end
  6946. self.TimeLeft:SetText ("[|c" .. color .. timeLeft2 .. "|r]")
  6947. else
  6948. self.TimeLeft:SetText ("[0m]")
  6949. end
  6950. end
  6951. self.NextTimeUpdate = 60
  6952. end
  6953.  
  6954. end
  6955.  
  6956. local TrackerOnTick_TimeLeft = function (self, deltaTime)
  6957. self.NextTimeUpdate = self.NextTimeUpdate - deltaTime
  6958.  
  6959. if (self.NextTimeUpdate < 0) then
  6960. if (HaveQuestData (self.questID)) then
  6961. local timeLeft = WorldQuestTracker.GetQuest_TimeLeft (self.questID)
  6962. if (timeLeft and timeLeft > 0) then
  6963. local timeLeft2 = WorldQuestTracker.GetQuest_TimeLeft (self.questID, true)
  6964. --local str = timeLeft > 1440 and floor (timeLeft/1440) .. "d" or timeLeft > 60 and floor (timeLeft/60) .. "h" or timeLeft .. "m"
  6965. local color = "FFC0C0C0"
  6966. if (timeLeft < 30) then
  6967. color = "FFFF2200"
  6968. elseif (timeLeft < 60) then
  6969. color = "FFFF9900"
  6970. end
  6971. self.TimeLeft:SetText ("[|c" .. color .. timeLeft2 .. "|r]")
  6972. else
  6973. self.TimeLeft:SetText ("[0m]")
  6974. end
  6975. end
  6976. self.NextTimeUpdate = 60
  6977. end
  6978. end
  6979.  
  6980.  
  6981. function WorldQuestTracker.SortTrackerByQuestDistance()
  6982. WorldQuestTracker.ReorderQuestsOnTracker()
  6983. WorldQuestTracker.RefreshTrackerWidgets()
  6984. end
  6985.  
  6986. --atualiza os widgets e reajusta a ancora
  6987. function WorldQuestTracker.RefreshTrackerWidgets()
  6988. --reordena as quests
  6989. WorldQuestTracker.ReorderQuestsOnTracker()
  6990. --atualiza as quest no tracker
  6991. local y = -30
  6992. local nextWidget = 1
  6993. local needSortByDistance = 0
  6994. local onlyCurrentMap = WorldQuestTracker.db.profile.tracker_only_currentmap
  6995.  
  6996. for index, quest in ipairs (WorldQuestTracker.QuestTrackList) do
  6997. --verifica se a quest esta ativa, ela pode ser desativada se o jogador estiver dentro da area da quest
  6998. if (HaveQuestData (quest.questID)) then
  6999. local title, factionID, tagID, tagName, worldQuestType, rarity, isElite, tradeskillLineIndex = WorldQuestTracker.GetQuest_Info (quest.questID)
  7000.  
  7001. if (not quest.isDisabled and title and (not onlyCurrentMap or (onlyCurrentMap and Sort_currentMapID == quest.mapID))) then
  7002. local widget = WorldQuestTracker.GetOrCreateTrackerWidget (nextWidget)
  7003. widget:ClearAllPoints()
  7004. widget:SetPoint ("topleft", WorldQuestTrackerFrame, "topleft", 0, y)
  7005. widget.questID = quest.questID
  7006. widget.info = quest
  7007. widget.numObjectives = quest.numObjectives
  7008. --widget.id = quest.questID
  7009.  
  7010. widget.Title:SetText (title)
  7011. while (widget.Title:GetStringWidth() > TRACKER_TITLE_TEXTWIDTH_MAX) do
  7012. title = strsub (title, 1, #title-1)
  7013. widget.Title:SetText (title)
  7014. end
  7015.  
  7016. local color = OBJECTIVE_TRACKER_COLOR["Header"]
  7017. widget.Title:SetTextColor (color.r, color.g, color.b)
  7018.  
  7019. widget.Zone:SetText ("- " .. WorldQuestTracker.GetZoneName (quest.mapID))
  7020. local color = OBJECTIVE_TRACKER_COLOR["Normal"]
  7021. widget.Zone:SetTextColor (color.r, color.g, color.b)
  7022.  
  7023. if (quest.questType == QUESTTYPE_ARTIFACTPOWER) then
  7024. widget.Icon:SetMask (nil)
  7025. else
  7026. widget.Icon:SetMask ([[Interface\CharacterFrame\TempPortraitAlphaMask]])
  7027. end
  7028. widget.Icon:SetTexture (quest.rewardTexture)
  7029. widget.IconButton.questID = quest.questID
  7030.  
  7031. if (GetSuperTrackedQuestID() == quest.questID) then
  7032. widget.SuperTracked:Show()
  7033. widget.Circle:SetDesaturated (false)
  7034. else
  7035. widget.SuperTracked:Hide()
  7036. widget.Circle:SetDesaturated (true)
  7037. end
  7038.  
  7039. if (type (quest.rewardAmount) == "number" and quest.rewardAmount >= 1000) then --erro compare number witrh string
  7040. widget.RewardAmount:SetText (WorldQuestTracker.ToK (quest.rewardAmount))
  7041. else
  7042. widget.RewardAmount:SetText (quest.rewardAmount)
  7043. end
  7044.  
  7045. widget:Show()
  7046.  
  7047. if (WorldQuestTracker.JustAddedToTracker [quest.questID]) then
  7048. widget.AnimationFrame.ShowAnimation()
  7049. WorldQuestTracker.JustAddedToTracker [quest.questID] = nil
  7050. end
  7051.  
  7052. if (Sort_currentMapID == quest.mapID) then
  7053. local x, y = C_TaskQuest.GetQuestLocation (quest.questID, quest.mapID)
  7054. widget.questX, widget.questY = x or 0, y or 0
  7055.  
  7056. local curZone, zoneLeft, zoneTop, zoneRight, zoneBottom = GetCurrentMapZone()
  7057. if (zoneLeft) then
  7058. zoneXLength, zoneYLength = zoneLeft - zoneRight, zoneTop - zoneBottom
  7059. end
  7060.  
  7061. widget.NextPositionUpdate = -1
  7062. widget.NextArrowUpdate = -1
  7063. widget.NextTimeUpdate = -1
  7064.  
  7065. widget.ForceUpdate = true
  7066.  
  7067. widget:SetScript ("OnUpdate", TrackerOnTick)
  7068. widget.Arrow:Show()
  7069. widget.ArrowDistance:Show()
  7070. widget.RightBackground:Show()
  7071. widget:SetAlpha (TRACKER_FRAME_ALPHA_INMAP)
  7072. widget.Title.textsize = TRACKER_TITLE_TEXT_SIZE_INMAP
  7073. widget.Zone.textsize = TRACKER_TITLE_TEXT_SIZE_INMAP
  7074. needSortByDistance = needSortByDistance + 1
  7075.  
  7076. if (WorldQuestTracker.db.profile.show_yards_distance) then
  7077. DF:SetFontSize (widget.TimeLeft, TRACKER_TITLE_TEXT_SIZE_INMAP)
  7078. widget.YardsDistance:Show()
  7079. else
  7080. widget.YardsDistance:Hide()
  7081. end
  7082.  
  7083. if (WorldQuestTracker.db.profile.tracker_show_time) then
  7084. widget.TimeLeft:Show()
  7085. else
  7086. widget.TimeLeft:Hide()
  7087. end
  7088.  
  7089. --widget.Title.textcolor = "WQT_QUESTTITLE_INMAP"
  7090. --widget.Zone.textcolor = "WQT_QUESTZONE_INMAP"
  7091. else
  7092. widget.Arrow:Hide()
  7093. widget.ArrowDistance:Hide()
  7094. widget.RightBackground:Hide()
  7095. widget:SetAlpha (TRACKER_FRAME_ALPHA_OUTMAP)
  7096. widget.Title.textsize = TRACKER_TITLE_TEXT_SIZE_OUTMAP
  7097. widget.Zone.textsize = TRACKER_TITLE_TEXT_SIZE_OUTMAP
  7098. widget.YardsDistance:SetText ("")
  7099. widget:SetScript ("OnUpdate", nil)
  7100.  
  7101. --widget.Title.textcolor = "WQT_QUESTTITLE_OUTMAP"
  7102. --widget.Zone.textcolor = "WQT_QUESTZONE_OUTMAP"
  7103.  
  7104. if (WorldQuestTracker.db.profile.tracker_show_time) then
  7105. widget.TimeLeft:Show()
  7106. DF:SetFontSize (widget.TimeLeft, TRACKER_TITLE_TEXT_SIZE_OUTMAP)
  7107. widget.NextTimeUpdate = -1
  7108. widget:SetScript ("OnUpdate", TrackerOnTick_TimeLeft)
  7109. else
  7110. widget.TimeLeft:Hide()
  7111. end
  7112. end
  7113.  
  7114. y = y - 35
  7115. nextWidget = nextWidget + 1
  7116. end
  7117. end
  7118. end
  7119.  
  7120. if (IsInInstance()) then
  7121. nextWidget = 1
  7122. end
  7123.  
  7124. --se n�o h� nenhuma quest sendo mostrada, hidar o cabe�alho
  7125. if (nextWidget == 1) then
  7126. WorldQuestTrackerHeader:Hide()
  7127. minimizeButton:Hide()
  7128. else
  7129. if (not WorldQuestTrackerFrame.collapsed) then
  7130. WorldQuestTrackerHeader:Show()
  7131. end
  7132. minimizeButton:Show()
  7133. WorldQuestTracker.UpdateTrackerScale()
  7134. end
  7135.  
  7136. if (WorldQuestTracker.SortingQuestByDistance) then
  7137. WorldQuestTracker.SortingQuestByDistance:Cancel()
  7138. WorldQuestTracker.SortingQuestByDistance = nil
  7139. end
  7140. if (needSortByDistance >= 2 and not IsInInstance()) then
  7141. WorldQuestTracker.SortingQuestByDistance = C_Timer.NewTicker (10, WorldQuestTracker.SortTrackerByQuestDistance)
  7142. end
  7143.  
  7144. --esconde os widgets n�o usados
  7145. for i = nextWidget, #TrackerWidgetPool do
  7146. TrackerWidgetPool [i]:SetScript ("OnUpdate", nil)
  7147. TrackerWidgetPool [i]:Hide()
  7148. end
  7149.  
  7150. WorldQuestTracker.RefreshAnchor()
  7151. end
  7152.  
  7153. local TrackerAnimation_OnAccept = CreateFrame ("frame", nil, UIParent)
  7154. TrackerAnimation_OnAccept:SetSize (235, 30)
  7155. TrackerAnimation_OnAccept.Title = DF:CreateLabel (TrackerAnimation_OnAccept)
  7156. TrackerAnimation_OnAccept.Title.textsize = TRACKER_TITLE_TEXT_SIZE_INMAP
  7157. TrackerAnimation_OnAccept.Title:SetPoint ("topleft", TrackerAnimation_OnAccept, "topleft", 10, -1)
  7158. local titleColor = OBJECTIVE_TRACKER_COLOR["Header"]
  7159. TrackerAnimation_OnAccept.Title:SetTextColor (titleColor.r, titleColor.g, titleColor.b)
  7160. TrackerAnimation_OnAccept.Zone = DF:CreateLabel (TrackerAnimation_OnAccept)
  7161. TrackerAnimation_OnAccept.Zone.textsize = TRACKER_TITLE_TEXT_SIZE_INMAP
  7162. TrackerAnimation_OnAccept.Zone:SetPoint ("topleft", TrackerAnimation_OnAccept, "topleft", 10, -17)
  7163. TrackerAnimation_OnAccept.Icon = TrackerAnimation_OnAccept:CreateTexture (nil, "artwork")
  7164. TrackerAnimation_OnAccept.Icon:SetPoint ("topleft", TrackerAnimation_OnAccept, "topleft", -13, -2)
  7165. TrackerAnimation_OnAccept.Icon:SetSize (16, 16)
  7166. TrackerAnimation_OnAccept.RewardAmount = TrackerAnimation_OnAccept:CreateFontString (nil, "overlay", "ObjectiveFont")
  7167. TrackerAnimation_OnAccept.RewardAmount:SetTextColor (titleColor.r, titleColor.g, titleColor.b)
  7168. TrackerAnimation_OnAccept.RewardAmount:SetPoint ("top", TrackerAnimation_OnAccept.Icon, "bottom", 0, -2)
  7169. DF:SetFontSize (TrackerAnimation_OnAccept.RewardAmount, 10)
  7170. TrackerAnimation_OnAccept:Hide()
  7171.  
  7172. TrackerAnimation_OnAccept.FlashTexture = TrackerAnimation_OnAccept:CreateTexture (nil, "background")
  7173. TrackerAnimation_OnAccept.FlashTexture:SetTexture ([[Interface\ACHIEVEMENTFRAME\UI-Achievement-Alert-Glow]])
  7174. TrackerAnimation_OnAccept.FlashTexture:SetTexCoord (0, 400/512, 0, 168/256)
  7175. TrackerAnimation_OnAccept.FlashTexture:SetBlendMode ("ADD")
  7176. TrackerAnimation_OnAccept.FlashTexture:SetPoint ("topleft", -60, 40)
  7177. TrackerAnimation_OnAccept.FlashTexture:SetPoint ("bottomright", 40, -35)
  7178.  
  7179. local TrackerAnimation_OnAccept_MoveAnimation = DF:CreateAnimationHub (TrackerAnimation_OnAccept, function (self)
  7180. -- 3 movement started
  7181. --seta textos e texturas
  7182. local quest = self.QuestObject
  7183. local widget = self.WidgetObject
  7184. TrackerAnimation_OnAccept.Title.text = widget.Title.text
  7185. TrackerAnimation_OnAccept.Zone.text = widget.Zone.text
  7186. if (quest.questType == QUESTTYPE_ARTIFACTPOWER) then
  7187. TrackerAnimation_OnAccept.Icon:SetMask (nil)
  7188. else
  7189. TrackerAnimation_OnAccept.Icon:SetMask ([[Interface\CharacterFrame\TempPortraitAlphaMask]])
  7190. end
  7191. TrackerAnimation_OnAccept.Icon:SetTexture (quest.rewardTexture)
  7192. TrackerAnimation_OnAccept.RewardAmount:SetText (widget.RewardAmount:GetText())
  7193. end,
  7194. function (self)
  7195. -- 4 movement end
  7196. TrackerAnimation_OnAccept:Hide()
  7197. end)
  7198. local ScreenWidth = -(floor (GetScreenWidth() / 2) - 200)
  7199. TrackerAnimation_OnAccept_MoveAnimation.Translation = DF:CreateAnimation (TrackerAnimation_OnAccept_MoveAnimation, "translation", 1, 2, ScreenWidth, 270)
  7200. DF:CreateAnimation (TrackerAnimation_OnAccept_MoveAnimation, "alpha", 1, 1.6, 1, 0)
  7201. --DF:CreateAnimation (TrackerAnimation_OnAccept_MoveAnimation, "scale", 1, 1.6, 1, 1, 0, 0)
  7202.  
  7203. local TrackerAnimation_OnAccept_FlashAnimation = DF:CreateAnimationHub (TrackerAnimation_OnAccept.FlashTexture,
  7204. function (self)
  7205. -- 1 Playing Flash
  7206. TrackerAnimation_OnAccept.Title.text = ""
  7207. TrackerAnimation_OnAccept.Zone.text = ""
  7208. TrackerAnimation_OnAccept.Icon:SetTexture (nil)
  7209. TrackerAnimation_OnAccept.RewardAmount:SetText ("")
  7210. TrackerAnimation_OnAccept:Show()
  7211. TrackerAnimation_OnAccept.FlashTexture:Show()
  7212. TrackerAnimation_OnAccept:SetPoint ("topleft", self.WidgetObject, "topleft", 0, 0)
  7213. end,
  7214. function (self)
  7215. -- 2 Flash Finished
  7216. local quest = self.QuestObject
  7217. local widget = self.WidgetObject
  7218.  
  7219. self.QuestObject.isDisabled = true
  7220. self.QuestObject.enteringZone = nil
  7221.  
  7222. local top = widget:GetTop()
  7223. local distance = GetScreenHeight() - top - 150
  7224. TrackerAnimation_OnAccept_MoveAnimation.Translation:SetOffset (ScreenWidth, distance)
  7225. TrackerAnimation_OnAccept_MoveAnimation:Play()
  7226.  
  7227. TrackerAnimation_OnAccept.FlashTexture:Hide()
  7228. WorldQuestTracker.UpdateQuestsInArea()
  7229. end)
  7230. DF:CreateAnimation (TrackerAnimation_OnAccept_FlashAnimation, "alpha", 1, 0.15, 0, .68)
  7231. DF:CreateAnimation (TrackerAnimation_OnAccept_FlashAnimation, "scale", 1, 0.1, .1, .1, 1, 1, "center")
  7232. DF:CreateAnimation (TrackerAnimation_OnAccept_FlashAnimation, "alpha", 2, 0.15, .68, 0)
  7233.  
  7234. local get_widget_from_questID = function (questID)
  7235. for i = 1, #TrackerWidgetPool do
  7236. if (TrackerWidgetPool[i].questID == questID) then
  7237. return TrackerWidgetPool[i]
  7238. end
  7239. end
  7240. end
  7241.  
  7242. --quando o tracker da interface atualizar, atualizar tbm o nosso tracker
  7243. --verifica se o jogador esta na area da quest
  7244. function WorldQuestTracker.UpdateQuestsInArea()
  7245. for index, quest in ipairs (WorldQuestTracker.QuestTrackList) do
  7246. if (HaveQuestData (quest.questID)) then
  7247. local questIndex = GetQuestLogIndexByID (quest.questID)
  7248. local isInArea, isOnMap, numObjectives = GetTaskInfo (quest.questID)
  7249. if ((questIndex and questIndex ~= 0) or isInArea) then
  7250. --desativa pois o jogo ja deve estar mostrando a quest
  7251. if (not quest.isDisabled and not quest.enteringZone) then
  7252. local widget = get_widget_from_questID (quest.questID)
  7253. if (widget and not WorldQuestTracker.IsQuestOnObjectiveTracker (widget.Title:GetText())) then
  7254. --acabou de aceitar a quest
  7255. quest.enteringZone = true
  7256. TrackerAnimation_OnAccept:Show()
  7257. TrackerAnimation_OnAccept_MoveAnimation.QuestObject = quest
  7258. TrackerAnimation_OnAccept_FlashAnimation.QuestObject = quest
  7259.  
  7260. TrackerAnimation_OnAccept_MoveAnimation.WidgetObject = widget
  7261. TrackerAnimation_OnAccept_FlashAnimation.WidgetObject = widget
  7262.  
  7263. TrackerAnimation_OnAccept_FlashAnimation:Play()
  7264. else
  7265. quest.isDisabled = true
  7266. end
  7267. end
  7268. --quest.isDisabled = true
  7269. else
  7270. quest.isDisabled = nil
  7271. end
  7272. end
  7273. end
  7274. WorldQuestTracker.RefreshTrackerWidgets()
  7275. end
  7276.  
  7277. --ao completar uma world quest remover a quest do tracker e da refresh nos widgets
  7278. hooksecurefunc ("BonusObjectiveTracker_OnTaskCompleted", function (questID, xp, money)
  7279. for i = #WorldQuestTracker.QuestTrackList, 1, -1 do
  7280. if (WorldQuestTracker.QuestTrackList[i].questID == questID) then
  7281. tremove (WorldQuestTracker.QuestTrackList, i)
  7282. WorldQuestTracker.RefreshTrackerWidgets()
  7283. break
  7284. end
  7285. end
  7286. end)
  7287.  
  7288. -- ~blizzard objective tracker
  7289. function WorldQuestTracker.IsQuestOnObjectiveTracker (quest)
  7290. local tracker = ObjectiveTrackerFrame
  7291.  
  7292. if (not tracker.initialized) then
  7293. return
  7294. end
  7295.  
  7296. local CheckByType = type (quest)
  7297.  
  7298. for i = 1, #tracker.MODULES do
  7299. local module = tracker.MODULES [i]
  7300. for blockName, usedBlock in pairs (module.usedBlocks) do
  7301.  
  7302. local questID = usedBlock.id
  7303. if (questID) then
  7304. if (CheckByType == "string") then
  7305. if (HaveQuestData (questID)) then
  7306. local thisQuestName = GetQuestInfoByQuestID (questID)
  7307. if (thisQuestName and thisQuestName == quest) then
  7308. return true
  7309. end
  7310. end
  7311. elseif (CheckByType == "number") then
  7312. if (quest == questID) then
  7313. return true
  7314. end
  7315. end
  7316. end
  7317. end
  7318. end
  7319. end
  7320.  
  7321. --dispara quando o tracker da interface � atualizado, precisa dar refresh na nossa ancora
  7322. local On_ObjectiveTracker_Update = function()
  7323. local tracker = ObjectiveTrackerFrame
  7324.  
  7325. if (not tracker.initialized) then
  7326. return
  7327. end
  7328.  
  7329. WorldQuestTracker.UpdateQuestsInArea()
  7330.  
  7331. --pega a altura do tracker de quests
  7332. local y = 0
  7333. for i = 1, #tracker.MODULES do
  7334. local module = tracker.MODULES [i]
  7335. if (module.Header:IsShown()) then
  7336. y = y + module.contentsHeight
  7337. end
  7338. end
  7339.  
  7340. --usado na fun��o da ancora
  7341. if (ObjectiveTrackerFrame.collapsed) then
  7342. WorldQuestTracker.TrackerHeight = 20
  7343. else
  7344. WorldQuestTracker.TrackerHeight = y
  7345. end
  7346.  
  7347. -- atualiza a ancora do nosso tracker
  7348. WorldQuestTracker.RefreshAnchor()
  7349.  
  7350. end
  7351.  
  7352. --quando houver uma atualiza��o no quest tracker, atualizar as ancores do nosso tracker
  7353. hooksecurefunc ("ObjectiveTracker_Update", function (reason, id)
  7354. On_ObjectiveTracker_Update()
  7355. end)
  7356. --quando o jogador clicar no bot�o de minizar o quest tracker, atualizar as ancores do nosso tracker
  7357. ObjectiveTrackerFrame.HeaderMenu.MinimizeButton:HookScript ("OnClick", function()
  7358. On_ObjectiveTracker_Update()
  7359. end)
  7360.  
  7361. function WorldQuestTracker:FullTrackerUpdate()
  7362. On_ObjectiveTracker_Update()
  7363. end
  7364.  
  7365. ----------------------------------------------------------------------------------------------------------------------------------------------------------------
  7366. --> taxy map widgets ~taxy ~fly
  7367. local taxyMapWidgets = {}
  7368.  
  7369. --
  7370. --WorldQuestTracker.db.profile.taxy_trackedonly
  7371.  
  7372. --fazer os blips para o mapa sem zoom
  7373. --fazer os blips deseparecerem quando o mapa tiver zoom
  7374. --quando pasasr o mouse no blip, mostrar qual quest que �
  7375. --quando dar zoom mostrar o icone do reward no lugar da exclama��o
  7376.  
  7377. function WorldQuestTracker:GetQuestFullInfo (questID)
  7378. --info
  7379. local title, factionID, tagID, tagName, worldQuestType, rarity, isElite, tradeskillLineIndex = WorldQuestTracker.GetQuest_Info (questID)
  7380. --tempo restante
  7381. local timeLeft = WorldQuestTracker.GetQuest_TimeLeft (questID)
  7382. --se � da faction selecionada
  7383. local isCriteria = WorldMapFrame.UIElementsFrame.BountyBoard:IsWorldQuestCriteriaForSelectedBounty (questID)
  7384. local selected = questID == GetSuperTrackedQuestID()
  7385. local isSpellTarget = SpellCanTargetQuest() and IsQuestIDValidSpellTarget (questID)
  7386.  
  7387. --gold
  7388. local gold, goldFormated = WorldQuestTracker.GetQuestReward_Gold (questID)
  7389. --class hall resource
  7390. local rewardName, rewardTexture, numRewardItems = WorldQuestTracker.GetQuestReward_Resource (questID)
  7391. --item
  7392. local itemName, itemTexture, itemLevel, quantity, quality, isUsable, itemID, isArtifact, artifactPower, isStackable = WorldQuestTracker.GetQuestReward_Item (questID)
  7393. local questType = 0x0
  7394. local texture
  7395.  
  7396. if (gold > 0) then
  7397. questType = QUESTTYPE_GOLD
  7398. texture = WorldQuestTracker.GetGoldIcon()
  7399. end
  7400.  
  7401. if (rewardName) then
  7402. questType = QUESTTYPE_RESOURCE
  7403. texture = rewardTexture
  7404. end
  7405.  
  7406. if (itemName) then
  7407. if (isArtifact) then
  7408. questType = QUESTTYPE_ARTIFACTPOWER
  7409. local artifactIcon = WorldQuestTracker.GetArtifactPowerIcon (artifactPower)
  7410. texture = artifactIcon .. "_round"
  7411. else
  7412. questType = QUESTTYPE_ITEM
  7413. texture = itemTexture
  7414. end
  7415. end
  7416.  
  7417. return title, questType, texture, factionID, tagID, tagName, worldQuestType, rarity, isElite, tradeskillLineIndex, selected, isSpellTarget, timeLeft, isCriteria, gold, goldFormated, rewardName, rewardTexture, numRewardItems, itemName, itemTexture, itemLevel, quantity, quality, isUsable, itemID, isArtifact, artifactPower, isStackable
  7418. end
  7419.  
  7420. --n�o esta sendo usado no momento
  7421. function WorldQuestTracker:GetAllWorldQuests_Info()
  7422. local result = {}
  7423. SetMapByID (MAPID_BROKENISLES)
  7424. local total = 0
  7425. for mapId, configTable in pairs (WorldQuestTracker.mapTables) do
  7426.  
  7427. --local taskInfo = GetQuestsForPlayerByMapID (mapId, 1007)
  7428. local taskInfo = GetQuestsForPlayerByMapID (mapId)
  7429.  
  7430. if (taskInfo and #taskInfo > 0) then
  7431. for i, info in ipairs (taskInfo) do
  7432. local questID = info.questId
  7433. if (HaveQuestData (questID)) then
  7434. local isWorldQuest = QuestMapFrame_IsQuestWorldQuest (questID)
  7435. if (isWorldQuest) then
  7436. C_TaskQuest.RequestPreloadRewardData (questID)
  7437. result [mapId] = result [mapId] or {}
  7438. tinsert (result [mapId], info)
  7439. total = total + 1
  7440. end
  7441. end
  7442. end
  7443. end
  7444. end
  7445.  
  7446. return result
  7447. end
  7448.  
  7449. function WorldQuestTracker.TaxyFrameHasZoom()
  7450. return not FlightMapFrame.ScrollContainer:IsZoomedOut()
  7451. end
  7452.  
  7453. local TaxyPOIIndex, TaxyPOIContainer = 1, {}
  7454. function WorldQuestTracker:GetOrCreateTaxyPOI (parent)
  7455. local button = WorldQuestTracker.CreateZoneWidget (TaxyPOIIndex, "WorldQuestTrackerTaxyPOI", parent)
  7456. tinsert (TaxyPOIContainer, button)
  7457. TaxyPOIIndex = TaxyPOIIndex + 1
  7458. return button
  7459. end
  7460.  
  7461. local onTaxyWidgetClick = function (self, button)
  7462. --se tiver zoom, tratar o clique como qualquer outro
  7463. if (WorldQuestTracker.TaxyFrameHasZoom()) then
  7464. WorldQuestTracker.OnQuestClicked (self, button)
  7465. else
  7466. --se n�o tiver zoom, ver se a quest esta sendo trackeada
  7467. if (not WorldQuestTracker.IsQuestBeingTracked (self.questID)) then
  7468. --se n�o estiver, adicionar ela ao tracker
  7469. WorldQuestTracker.OnQuestClicked (self, button)
  7470. else
  7471. --se ela ja estaver sendo trackeada, verificar se foi clique com o botao direito
  7472. if (button == "RightButton") then
  7473. WorldQuestTracker.OnQuestClicked (self, button)
  7474. end
  7475. end
  7476. end
  7477. end
  7478. local format_for_taxy_zoom_allquests = function (button)
  7479. button:SetScale (1.3)
  7480. button:SetWidth (20)
  7481. button:SetAlpha (1)
  7482. end
  7483. local format_for_taxy_nozoom_tracked = function (button)
  7484. button:ClearWidget()
  7485.  
  7486. button:SetScale (WorldQuestTracker.db.profile.taxy_tracked_scale)
  7487. button:SetWidth (20)
  7488. button:SetAlpha (1)
  7489.  
  7490. button.circleBorder:Show()
  7491.  
  7492. button.IsTrackingGlow:Show()
  7493. button.IsTrackingGlow:SetAlpha (.4)
  7494. end
  7495.  
  7496. --this function format quest pins on the taxy map (I know, taxy is with I: taxi)
  7497. local format_for_taxy_nozoom_all = function (button)
  7498. button:ClearWidget()
  7499.  
  7500. button:SetScale (WorldQuestTracker.db.profile.taxy_tracked_scale + 0.5)
  7501. button:SetWidth (20)
  7502. button:SetAlpha (.75)
  7503.  
  7504. button.circleBorder:Show()
  7505.  
  7506. if (WorldQuestTracker.IsQuestBeingTracked (button.questID)) then
  7507. button:SetAlpha (1)
  7508. button.IsTrackingGlow:Show()
  7509. button.IsTrackingGlow:SetAlpha (.5)
  7510. end
  7511. end
  7512.  
  7513. WorldQuestTracker.TaxyZoneWidgets = {}
  7514.  
  7515. function WorldQuestTracker:TAXIMAP_OPENED()
  7516.  
  7517. if (not WorldQuestTracker.FlyMapHook and FlightMapFrame) then
  7518.  
  7519. for dataProvider, isInstalled in pairs (FlightMapFrame.dataProviders) do
  7520. if (dataProvider.DoesWorldQuestInfoPassFilters) then
  7521. C_Timer.After (1, function() dataProvider.RefreshAllData (dataProvider) end)
  7522. C_Timer.After (2, function() dataProvider.RefreshAllData (dataProvider) end)
  7523. break
  7524. end
  7525. end
  7526.  
  7527. WorldQuestTracker.Taxy_CurrentShownBlips = WorldQuestTracker.Taxy_CurrentShownBlips or {}
  7528.  
  7529. _G ["left"] = nil
  7530. _G ["right"] = nil
  7531. _G ["topleft"] = nil
  7532. _G ["topright"] = nil
  7533.  
  7534. --tracking options
  7535. FlightMapFrame.WorldQuestTrackerOptions = CreateFrame ("frame", "WorldQuestTrackerTaxyMapFrame", FlightMapFrame.BorderFrame)
  7536. FlightMapFrame.WorldQuestTrackerOptions:SetSize (1, 1)
  7537. FlightMapFrame.WorldQuestTrackerOptions:SetPoint ("bottomleft", FlightMapFrame.BorderFrame, "bottomleft", 3, 3)
  7538. local doubleTapBackground = FlightMapFrame.WorldQuestTrackerOptions:CreateTexture (nil, "overlay")
  7539. doubleTapBackground:SetTexture ([[Interface\ACHIEVEMENTFRAME\UI-Achievement-HorizontalShadow]])
  7540. doubleTapBackground:SetPoint ("bottomleft", FlightMapFrame.WorldQuestTrackerOptions, "bottomleft", 0, 0)
  7541. doubleTapBackground:SetSize (630, 18)
  7542.  
  7543. local checkboxShowAllQuests_func = function (self, actorTypeIndex, value)
  7544. WorldQuestTracker.db.profile.taxy_showquests = value
  7545. end
  7546. local checkboxShowAllQuests = DF:CreateSwitch (FlightMapFrame.WorldQuestTrackerOptions, checkboxShowAllQuests_func, WorldQuestTracker.db.profile.taxy_showquests, _, _, _, _, "checkboxShowAllQuests", _, _, _, _, _, DF:GetTemplate ("switch", "OPTIONS_CHECKBOX_BRIGHT_TEMPLATE"))
  7547. checkboxShowAllQuests:SetAsCheckBox()
  7548. checkboxShowAllQuests:SetSize (16, 16)
  7549. checkboxShowAllQuests.tooltip = L["S_FLYMAP_SHOWWORLDQUESTS"]
  7550. checkboxShowAllQuests:SetPoint ("bottomleft", FlightMapFrame.WorldQuestTrackerOptions, "bottomleft", 0, 0)
  7551. local checkboxShowAllQuestsString = DF:CreateLabel (checkboxShowAllQuests, L["S_FLYMAP_SHOWWORLDQUESTS"], 12, "orange", nil, "checkboxShowAllQuestsLabel", nil, "overlay")
  7552. checkboxShowAllQuestsString:SetPoint ("left", checkboxShowAllQuests, "right", 2, 0)
  7553.  
  7554. local checkboxShowTrackedOnly_func = function (self, actorTypeIndex, value)
  7555. WorldQuestTracker.db.profile.taxy_trackedonly = value
  7556. end
  7557. local checkboxShowTrackedOnly = DF:CreateSwitch (FlightMapFrame.WorldQuestTrackerOptions, checkboxShowTrackedOnly_func, WorldQuestTracker.db.profile.taxy_trackedonly, _, _, _, _, "checkboxShowTrackedOnly", _, _, _, _, _, DF:GetTemplate ("switch", "OPTIONS_CHECKBOX_BRIGHT_TEMPLATE"))
  7558. checkboxShowTrackedOnly:SetAsCheckBox()
  7559. checkboxShowTrackedOnly:SetSize (16, 16)
  7560. checkboxShowTrackedOnly.tooltip = L["S_FLYMAP_SHOWTRACKEDONLY_DESC"]
  7561. checkboxShowTrackedOnly:SetPoint ("left", checkboxShowAllQuestsString, "right", 4, 0)
  7562. local checkboxShowTrackedOnlyString = DF:CreateLabel (checkboxShowTrackedOnly, L["S_FLYMAP_SHOWTRACKEDONLY"], 12, "orange", nil, "checkboxShowTrackedOnlyLabel", nil, "overlay")
  7563. checkboxShowTrackedOnlyString:SetPoint ("left", checkboxShowTrackedOnly, "right", 2, 0)
  7564.  
  7565. if (not WorldQuestTracker.db.profile.TutorialTaxyMap) then
  7566. local alert = CreateFrame ("frame", "WorldQuestTrackerTaxyTutorial", checkboxShowTrackedOnly.widget, "MicroButtonAlertTemplate")
  7567. alert:SetFrameLevel (302)
  7568. alert.label = "Options are here, show all quests or only those being tracked"
  7569. alert.Text:SetSpacing (4)
  7570. MicroButtonAlert_SetText (alert, alert.label)
  7571. alert:SetPoint ("bottom", checkboxShowTrackedOnly.widget, "top", 0, 30)
  7572. alert:Show()
  7573. WorldQuestTracker.db.profile.TutorialTaxyMap = true
  7574. end
  7575.  
  7576. local filters = WorldQuestTracker.db.profile.filters
  7577.  
  7578. --hooksecurefunc (FlightMapFrame, "SetPinPosition", function (self, pin, normalizedX, normalizedY, insetIndex)
  7579. hooksecurefunc (FlightMapFrame, "ApplyPinPosition", function (self, pin, normalizedX, normalizedY, insetIndex)
  7580. --print ("setting pin poisition")
  7581. if (not pin.questID or not QuestMapFrame_IsQuestWorldQuest (pin.questID)) then
  7582. --print (self.questID)
  7583. --print (pin._WQT_Twin and pin._WQT_Twin.questID)
  7584. --print (pin.Icon, self.Icon)
  7585. if (pin.Icon and pin.Icon:GetTexture() == 1455734) then
  7586. --pin.Icon:SetTexture ([[Interface\TAXIFRAME\UI-Taxi-Icon-Highlight]])
  7587. if (not pin.Icon.ExtraShadow) then
  7588. pin.Icon:SetDrawLayer ("overlay")
  7589. pin.Icon.ExtraShadow = pin:CreateTexture (nil, "background")
  7590. pin.Icon.ExtraShadow:SetSize (19, 19)
  7591. pin.Icon.ExtraShadow:SetTexture (1455734)
  7592. pin.Icon.ExtraShadow:SetTexCoord (4/128, 71/128, 36/512, 108/512)
  7593. pin.Icon.ExtraShadow:SetPoint ("center")
  7594. end
  7595. end
  7596. return
  7597. end
  7598.  
  7599. if (not pin._WQT_Twin) then
  7600. pin._WQT_Twin = WorldQuestTracker:GetOrCreateTaxyPOI (pin:GetParent())
  7601. pin._WQT_Twin:RegisterForClicks ("LeftButtonUp", "RightButtonUp")
  7602. pin._WQT_Twin:SetFrameStrata (pin:GetFrameStrata())
  7603. pin._WQT_Twin:SetFrameLevel (pin:GetFrameLevel()+100)
  7604. pin._WQT_Twin:SetScale (1.3)
  7605. pin._WQT_Twin:SetScript ("OnClick", onTaxyWidgetClick)
  7606. pin._WQT_Twin:SetPoint ("center", pin, "center")
  7607. --mixin
  7608. for member, func in pairs (pin) do
  7609. if (type (func) == "function") then
  7610. pin._WQT_Twin [member] = func
  7611. end
  7612. end
  7613. --override scripts
  7614. --pin._WQT_Twin:SetScript ("OnEnter", pin:GetScript ("OnEnter"))
  7615. pin._WQT_Twin:SetScript ("OnEnter", function (self)
  7616. --> the tooltip should get the scale from the taxi map pin
  7617. pin:GetScript ("OnEnter")(pin)
  7618. pin._WQT_Twin.Texture:SetBlendMode ("ADD")
  7619. end)
  7620.  
  7621. pin._WQT_Twin:SetScript ("OnLeave", function()
  7622. pin:GetScript ("OnLeave")(pin)
  7623. pin._WQT_Twin.Texture:SetBlendMode ("BLEND")
  7624. end)
  7625.  
  7626. tinsert (WorldQuestTracker.TaxyZoneWidgets, pin._WQT_Twin)
  7627. end
  7628.  
  7629. local isShowingQuests = WorldQuestTracker.db.profile.taxy_showquests
  7630. local isShowingOnlyTracked = WorldQuestTracker.db.profile.taxy_trackedonly
  7631. local hasZoom = WorldQuestTracker.TaxyFrameHasZoom()
  7632.  
  7633. --n�o esta mostrando as quests e o mapa n�o tem zoom
  7634. if (not isShowingQuests and not hasZoom) then
  7635. pin._WQT_Twin:Hide()
  7636. WorldQuestTracker.Taxy_CurrentShownBlips [pin._WQT_Twin] = nil
  7637. pin._WQT_Twin.questID = nil
  7638. pin._WQT_Twin.LastUpdate = nil
  7639. return
  7640. end
  7641.  
  7642. --esta mostrando apenas quests que est�o sendo trackeadas
  7643. if (isShowingOnlyTracked) then
  7644. if ((not WorldQuestTracker.IsQuestBeingTracked (pin.questID) and not WorldQuestTracker.IsQuestOnObjectiveTracker (pin.questID)) and not hasZoom) then
  7645. pin._WQT_Twin:Hide()
  7646. WorldQuestTracker.Taxy_CurrentShownBlips [pin._WQT_Twin] = nil
  7647. pin._WQT_Twin.questID = nil
  7648. pin._WQT_Twin.LastUpdate = nil
  7649. return
  7650. end
  7651. end
  7652.  
  7653. pin._WQT_Twin:Show()
  7654. WorldQuestTracker.Taxy_CurrentShownBlips [pin._WQT_Twin] = true
  7655.  
  7656. local title, questType, texture, factionID, tagID, tagName, worldQuestType, rarity, isElite, tradeskillLineIndex, selected, isSpellTarget, timeLeft, isCriteria, gold, goldFormated, rewardName, rewardTexture, numRewardItems, itemName, itemTexture, itemLevel, quantity, quality, isUsable, itemID, isArtifact, artifactPower, isStackable = WorldQuestTracker:GetQuestFullInfo (pin.questID)
  7657.  
  7658. --n�o mostrar quests que foram filtradas
  7659. local filter = WorldQuestTracker.GetQuestFilterTypeAndOrder (worldQuestType, gold, rewardName, itemName, isArtifact, quantity, numRewardItems, rewardTexture)
  7660.  
  7661. if (not filters [filter] and rarity ~= LE_WORLD_QUEST_QUALITY_EPIC) then
  7662. pin._WQT_Twin:Hide()
  7663. WorldQuestTracker.Taxy_CurrentShownBlips [pin._WQT_Twin] = nil
  7664. pin._WQT_Twin.questID = nil
  7665. pin._WQT_Twin.LastUpdate = nil
  7666. return
  7667. end
  7668.  
  7669. local inProgress, questIDChanged
  7670.  
  7671. if (pin._WQT_Twin.questID ~= pin.questID) then
  7672. questIDChanged = true
  7673. end
  7674. pin._WQT_Twin.questID = pin.questID
  7675. pin._WQT_Twin.numObjectives = pin.numObjectives
  7676. local mapID, zoneID = C_TaskQuest.GetQuestZoneID (pin.questID)
  7677. pin._WQT_Twin.mapID = zoneID
  7678.  
  7679. --FlightMapFrame:ZoomOut()
  7680. if (not hasZoom) then
  7681. --n�o tem zoom
  7682. if (isShowingOnlyTracked) then
  7683. if (questIDChanged or pin._WQT_Twin.zoomState or not pin._WQT_Twin.LastUpdate or pin._WQT_Twin.LastUpdate+20 < GetTime()) then
  7684. WorldQuestTracker.SetupWorldQuestButton (pin._WQT_Twin, questType, rarity, isElite, tradeskillLineIndex, inProgress, selected, isCriteria, isSpellTarget)
  7685. format_for_taxy_nozoom_tracked (pin._WQT_Twin)
  7686. pin._WQT_Twin.LastUpdate = GetTime()
  7687. pin._WQT_Twin.zoomState = nil
  7688. --print ("UPDATED")
  7689. end
  7690. else
  7691. if (questIDChanged or pin._WQT_Twin.zoomState or not pin._WQT_Twin.LastUpdate or pin._WQT_Twin.LastUpdate+20 < GetTime()) then
  7692. WorldQuestTracker.SetupWorldQuestButton (pin._WQT_Twin, questType, rarity, isElite, tradeskillLineIndex, inProgress, selected, isCriteria, isSpellTarget)
  7693. format_for_taxy_nozoom_all (pin._WQT_Twin)
  7694. pin._WQT_Twin.LastUpdate = GetTime()
  7695. pin._WQT_Twin.zoomState = nil
  7696. --print ("atualizando", GetTime())
  7697. end
  7698. end
  7699. else
  7700. --tem zoom
  7701. if (questIDChanged or not pin._WQT_Twin.zoomState or not pin._WQT_Twin.LastUpdate or pin._WQT_Twin.LastUpdate+20 < GetTime()) then
  7702. WorldQuestTracker.SetupWorldQuestButton (pin._WQT_Twin, questType, rarity, isElite, tradeskillLineIndex, inProgress, selected, isCriteria, isSpellTarget)
  7703. format_for_taxy_zoom_allquests (pin._WQT_Twin)
  7704. pin._WQT_Twin.LastUpdate = GetTime()
  7705. pin._WQT_Twin.zoomState = true
  7706. --print ("UPDATED")
  7707. end
  7708. end
  7709. end)
  7710.  
  7711. WorldQuestTracker.FlyMapHook = true
  7712. end
  7713.  
  7714. if (WorldQuestTracker.Taxy_CurrentShownBlips) then
  7715. for _WQT_Twin, isShown in pairs (WorldQuestTracker.Taxy_CurrentShownBlips) do
  7716. if (_WQT_Twin:IsShown() and not WorldQuestTracker.IsQuestBeingTracked (_WQT_Twin.questID)) then
  7717. _WQT_Twin:Hide()
  7718. WorldQuestTracker.Taxy_CurrentShownBlips [_WQT_Twin] = nil
  7719. --local title, factionID, tagID, tagName, worldQuestType, rarity, isElite, tradeskillLineIndex = WorldQuestTracker.GetQuest_Info (_WQT_Twin.questID)
  7720. --print ("Taxy Hide", title)
  7721. end
  7722. end
  7723. end
  7724.  
  7725.  
  7726. end
  7727.  
  7728. function WorldQuestTracker:TAXIMAP_CLOSED()
  7729. for _, widget in ipairs (WorldQuestTracker.TaxyZoneWidgets) do
  7730. widget.LastUpdate = nil
  7731. widget.questID = nil
  7732. end
  7733. end
  7734.  
  7735. ----------------------------------------------------------------------------------------------------------------------------------------------------------------
  7736. --> world map widgets
  7737.  
  7738. --se a janela do world map esta em modo janela
  7739. WorldQuestTracker.InWindowMode = WorldMapFrame_InWindowedMode()
  7740. WorldQuestTracker.LastUpdate = 0
  7741.  
  7742. --store the amount os quests for each faction on each map
  7743. local factionAmountForEachMap = {}
  7744.  
  7745. --tabela de configura��o
  7746. WorldQuestTracker.mapTables = {
  7747. [azsuna_mapId] = {
  7748. worldMapLocation = {x = 10, y = -345, lineWidth = 233},
  7749. worldMapLocationMax = {x = 168, y = -468, lineWidth = 330},
  7750. bipAnchor = {side = "right", x = 0, y = -1},
  7751. factionAnchor = {mySide = "left", anchorSide = "right", x = 0, y = 0},
  7752. squarePoints = {mySide = "topleft", anchorSide = "bottomleft", y = -1, xDirection = 1},
  7753. widgets = azsuna_widgets,
  7754.  
  7755. Anchor_X = 0.01,
  7756. Anchor_Y = 0.52,
  7757. GrowRight = true,
  7758. },
  7759. [valsharah_mapId] = {
  7760. worldMapLocation = {x = 10, y = -218, lineWidth = 240},
  7761. worldMapLocationMax = {x = 168, y = -284, lineWidth = 340},
  7762. bipAnchor = {side = "right", x = 0, y = -1},
  7763. factionAnchor = {mySide = "left", anchorSide = "right", x = 0, y = 0},
  7764. squarePoints = {mySide = "topleft", anchorSide = "bottomleft", y = -1, xDirection = 1},
  7765. widgets = valsharah_widgets,
  7766.  
  7767. Anchor_X = 0.01,
  7768. Anchor_Y = 0.37,
  7769. GrowRight = true,
  7770. },
  7771. [highmountain_mapId] = {
  7772. worldMapLocation = {x = 10, y = -179, lineWidth = 320},
  7773. worldMapLocationMax = {x = 168, y = -230, lineWidth = 452},
  7774. bipAnchor = {side = "right", x = 0, y = -1},
  7775. factionAnchor = {mySide = "left", anchorSide = "right", x = 0, y = 0},
  7776. squarePoints = {mySide = "topleft", anchorSide = "bottomleft", y = -1, xDirection = 1},
  7777. widgets = highmountain_widgets,
  7778.  
  7779. Anchor_X = 0.01,
  7780. Anchor_Y = 0.20,
  7781. GrowRight = true,
  7782. },
  7783. [stormheim_mapId] = {
  7784. worldMapLocation = {x = 415, y = -235, lineWidth = 277},
  7785. worldMapLocationMax = {x = 747, y = -313, lineWidth = 393},
  7786. bipAnchor = {side = "left", x = 0, y = -1},
  7787. factionAnchor = {mySide = "right", anchorSide = "left", x = -0, y = 0},
  7788. squarePoints = {mySide = "topright", anchorSide = "bottomright", y = -1, xDirection = -1},
  7789. widgets = stormheim_widgets,
  7790.  
  7791. Anchor_X = 0.99,
  7792. Anchor_Y = 0.20,
  7793. },
  7794. [suramar_mapId] = {
  7795. worldMapLocation = {x = 327, y = -277, lineWidth = 365},
  7796. worldMapLocationMax = {x = 618, y = -367, lineWidth = 522},
  7797. bipAnchor = {side = "left", x = 0, y = -1},
  7798. factionAnchor = {mySide = "right", anchorSide = "left", x = -0, y = 0},
  7799. squarePoints = {mySide = "topright", anchorSide = "bottomright", y = -1, xDirection = -1},
  7800. widgets = suramar_widgets,
  7801.  
  7802. Anchor_X = 0.99,
  7803. Anchor_Y = 0.438,
  7804. },
  7805. [eoa_mapId] = {
  7806. worldMapLocation = {x = 325, y = -460, lineWidth = 50},
  7807. worldMapLocationMax = {x = 614, y = -633, lineWidth = 50},
  7808. bipAnchor = {side = "left", x = 0, y = -1},
  7809. factionAnchor = {mySide = "right", anchorSide = "left", x = -0, y = 0},
  7810. squarePoints = {mySide = "topright", anchorSide = "bottomright", y = -1, xDirection = -1},
  7811. widgets = eoa_widgets,
  7812.  
  7813. Anchor_X = 0.5,
  7814. Anchor_Y = 0.8,
  7815. GrowRight = true,
  7816. },
  7817. [WorldQuestTracker.MAPID_DALARAN] = {
  7818. worldMapLocation = {x = 325, y = -460, lineWidth = 50},
  7819. worldMapLocationMax = {x = 614, y = -633, lineWidth = 50},
  7820. bipAnchor = {side = "left", x = 0, y = -1},
  7821. factionAnchor = {mySide = "right", anchorSide = "left", x = -0, y = 0},
  7822. squarePoints = {mySide = "topright", anchorSide = "bottomright", y = -1, xDirection = -1},
  7823. widgets = eoa_widgets,
  7824.  
  7825. Anchor_X = 0.47,
  7826. Anchor_Y = 0.62,
  7827. GrowRight = true,
  7828. },
  7829.  
  7830. [1021] = { --broken shore
  7831. worldMapLocation = {x = 425, y = -480, lineWidth = 50},
  7832. worldMapLocationMax = {x = 614, y = -633, lineWidth = 50},
  7833. bipAnchor = {side = "left", x = 0, y = -1},
  7834. factionAnchor = {mySide = "right", anchorSide = "left", x = -0, y = 0},
  7835. squarePoints = {mySide = "topright", anchorSide = "bottomright", y = -1, xDirection = -1},
  7836. widgets = eoa_widgets,
  7837.  
  7838. Anchor_X = 0.62,
  7839. Anchor_Y = 0.67,
  7840. GrowRight = true,
  7841. },
  7842. }
  7843.  
  7844. --esconde todos os widgets do world map
  7845. function WorldQuestTracker.HideWorldQuestsOnWorldMap()
  7846. for _, widget in ipairs (all_widgets) do --quadrados das quests
  7847. widget:Hide()
  7848. widget.isArtifact = nil
  7849. widget.questID = nil
  7850. end
  7851. for _, widget in ipairs (extra_widgets) do --linhas e bolas de fac��es
  7852. widget:Hide()
  7853. end
  7854. end
  7855.  
  7856. -- /run WorldQuestTrackerAddon.SetTextSize ("WorldMap", 10)
  7857. function WorldQuestTracker.SetTextSize (MapType, Size)
  7858. if (not WorldQuestTracker.db) then
  7859. C_Timer.After (2, function() WorldQuestTracker.SetTextSize ("WorldMap") end)
  7860. end
  7861. if (MapType == "WorldMap") then
  7862. Size = Size or WorldQuestTracker.db.profile.worldmap_widgets.textsize
  7863. WorldQuestTracker.db.profile.worldmap_widgets.textsize = Size
  7864. local ShadowSizeH, ShadowSizeV = 32, 11
  7865. if (Size == 10) then
  7866. ShadowSizeH, ShadowSizeV = 36, 13
  7867. elseif (Size == 11) then
  7868. ShadowSizeH, ShadowSizeV = 40, 14
  7869. end
  7870. --
  7871. for mapId, configTable in pairs (WorldQuestTracker.mapTables) do
  7872. for _, widget in ipairs (configTable.widgets) do
  7873. DF:SetFontSize (widget.amountText, Size)
  7874. widget.amountBackground:SetSize (ShadowSizeH, ShadowSizeV)
  7875. end
  7876. end
  7877. return
  7878. end
  7879. if (MapType == "ZoneMap") then
  7880.  
  7881. return
  7882. end
  7883.  
  7884. end
  7885.  
  7886.  
  7887. --cria as linhas que servem de apoio para as quests no world map
  7888. local create_worldmap_line = function (lineWidth, mapId)
  7889. local line = worldFramePOIs:CreateTexture (nil, "artwork", 2)
  7890. line:SetSize (lineWidth, 2)
  7891. line:SetHorizTile (true)
  7892. line:SetAlpha (0.5)
  7893. line:SetTexture ([[Interface\AddOns\WorldQuestTracker\media\line_tiletextureT]], true)
  7894. local blip = worldFramePOIs:CreateTexture (nil, "overlay", 3)
  7895. blip:SetTexture ([[Interface\Scenarios\ScenarioIcon-Combat]], true)
  7896.  
  7897. local factionFrame = CreateFrame ("frame", "WorldQuestTrackerFactionFrame" .. mapId, worldFramePOIs)
  7898. tinsert (faction_frames, factionFrame)
  7899. factionFrame:SetSize (20, 20)
  7900.  
  7901. local factionIcon = factionFrame:CreateTexture (nil, "background")
  7902. factionIcon:SetSize (18, 18)
  7903. factionIcon:SetPoint ("center", factionFrame, "center")
  7904. factionIcon:SetDrawLayer ("background", -2)
  7905.  
  7906. local factionHighlight = factionFrame:CreateTexture (nil, "background")
  7907. factionHighlight:SetSize (36, 36)
  7908. factionHighlight:SetTexture ([[Interface\QUESTFRAME\WorldQuest]])
  7909. factionHighlight:SetTexCoord (0.546875, 0.62109375, 0.6875, 0.984375)
  7910. factionHighlight:SetDrawLayer ("background", -3)
  7911. factionHighlight:SetPoint ("center", factionFrame, "center")
  7912.  
  7913. local factionIconBorder = factionFrame:CreateTexture (nil, "artwork", 0)
  7914. factionIconBorder:SetSize (20, 20)
  7915. factionIconBorder:SetPoint ("center", factionFrame, "center")
  7916. factionIconBorder:SetTexture ([[Interface\COMMON\GoldRing]])
  7917.  
  7918. local factionQuestAmount = factionFrame:CreateFontString (nil, "overlay", "GameFontNormal")
  7919. factionQuestAmount:SetPoint ("center", factionFrame, "center")
  7920. factionQuestAmount:SetText ("")
  7921.  
  7922. local factionQuestAmountBackground = factionFrame:CreateTexture (nil, "background")
  7923. factionQuestAmountBackground:SetPoint ("center", factionFrame, "center")
  7924. factionQuestAmountBackground:SetTexture ([[Interface\AddOns\WorldQuestTracker\media\background_blackgradientT]])
  7925. --factionQuestAmountBackground:SetTexCoord (12/512, 74/512, 251/512, 281/512)
  7926. factionQuestAmountBackground:SetSize (20, 10)
  7927. factionQuestAmountBackground:SetAlpha (.7)
  7928. factionQuestAmountBackground:SetDrawLayer ("background", 3)
  7929.  
  7930. factionFrame.icon = factionIcon
  7931. factionFrame.text = factionQuestAmount
  7932. factionFrame.background = factionQuestAmountBackground
  7933. factionFrame.border = factionIconBorder
  7934. factionFrame.highlight = factionHighlight
  7935.  
  7936. tinsert (extra_widgets, line)
  7937. tinsert (extra_widgets, blip)
  7938. tinsert (extra_widgets, factionIcon)
  7939. tinsert (extra_widgets, factionIconBorder)
  7940. tinsert (extra_widgets, factionQuestAmount)
  7941. tinsert (extra_widgets, factionQuestAmountBackground)
  7942. tinsert (extra_widgets, factionHighlight)
  7943.  
  7944. WorldQuestTracker.WorldMapSupportWidgets [mapId] = {line, blip, factionIcon, factionIconBorder, factionQuestAmount, factionQuestAmountBackground, factionHighlight}
  7945.  
  7946. return line, blip, factionFrame
  7947. end
  7948.  
  7949. --hooksecurefunc ("LFGListUtil_FindQuestGroup", function (a, b)
  7950. -- print ("--> ", a, b)
  7951. --end)
  7952. --hooksecurefunc ("LFGListFrame_BeginFindQuestGroup", function (a, b)
  7953. -- print ("result> ", a, b)
  7954. --end)
  7955.  
  7956. --cria uma square widget no world map ~world ~createworld ~createworldwidget
  7957. local create_worldmap_square = function (mapName, index)
  7958. local button = CreateFrame ("button", "WorldQuestTrackerWorldMapPOI" .. mapName .. "POI" .. index, worldFramePOIs)
  7959. button:SetSize (WORLDMAP_SQUARE_SIZE, WORLDMAP_SQUARE_SIZE)
  7960. button.IsWorldQuestButton = true
  7961. button:SetFrameLevel (302)
  7962.  
  7963. button:SetScript ("OnEnter", questButton_OnEnter)
  7964. button:SetScript ("OnLeave", questButton_OnLeave)
  7965. button:SetScript ("OnClick", questButton_OnClick)
  7966.  
  7967. button:RegisterForClicks ("LeftButtonDown", "MiddleButtonDown", "RightButtonDown")
  7968.  
  7969. -- local groupButton = CreateFrame ("button", "WorldQuestTrackerWorldMapPOI" .. mapName .. "POI" .. index .. "LFG", button, "QuestObjectiveFindGroupButtonTemplate")
  7970. -- groupButton:SetPoint ("bottomright", button, "bottomright")
  7971. -- groupButton:SetSize (10, 10)
  7972. -- button.GroupButton = groupButton
  7973.  
  7974. local fadeInAnimation = button:CreateAnimationGroup()
  7975. local step1 = fadeInAnimation:CreateAnimation ("Alpha")
  7976. step1:SetOrder (1)
  7977. step1:SetFromAlpha (0)
  7978. step1:SetToAlpha (1)
  7979. step1:SetDuration (0.1)
  7980. button.fadeInAnimation = fadeInAnimation
  7981.  
  7982. tinsert (all_widgets, button)
  7983.  
  7984. local background = button:CreateTexture (nil, "background", -3)
  7985. background:SetAllPoints()
  7986.  
  7987. local texture = button:CreateTexture (nil, "background", -2)
  7988. texture:SetAllPoints()
  7989.  
  7990. local commonBorder = button:CreateTexture (nil, "artwork", 1)
  7991. commonBorder:SetPoint ("topleft", button, "topleft")
  7992. commonBorder:SetTexture ([[Interface\AddOns\WorldQuestTracker\media\border_whiteT]])
  7993. commonBorder:SetSize (WORLDMAP_SQUARE_SIZE, WORLDMAP_SQUARE_SIZE)
  7994. local rareBorder = button:CreateTexture (nil, "artwork", 1)
  7995. rareBorder:SetPoint ("topleft", button, "topleft")
  7996. rareBorder:SetTexture ([[Interface\AddOns\WorldQuestTracker\media\border_blueT]])
  7997. rareBorder:SetSize (WORLDMAP_SQUARE_SIZE, WORLDMAP_SQUARE_SIZE)
  7998. local epicBorder = button:CreateTexture (nil, "artwork", 1)
  7999. epicBorder:SetPoint ("topleft", button, "topleft")
  8000. epicBorder:SetTexture ([[Interface\AddOns\WorldQuestTracker\media\border_pinkT]])
  8001. epicBorder:SetSize (WORLDMAP_SQUARE_SIZE, WORLDMAP_SQUARE_SIZE)
  8002.  
  8003. local invasionBorder = button:CreateTexture (nil, "artwork", 1)
  8004. invasionBorder:SetPoint ("topleft", button, "topleft")
  8005. invasionBorder:SetTexture ([[Interface\AddOns\WorldQuestTracker\media\border_legionT]])
  8006. invasionBorder:SetSize (WORLDMAP_SQUARE_SIZE, WORLDMAP_SQUARE_SIZE)
  8007.  
  8008. local trackingBorder = button:CreateTexture (nil, "artwork", 1)
  8009. trackingBorder:SetPoint ("topleft", button, "topleft")
  8010. trackingBorder:SetTexture ([[Interface\Artifacts\Artifacts]])
  8011. trackingBorder:SetTexCoord (269/1024, 327/1024, 943/1024, 1001/1024)
  8012. trackingBorder:SetSize (WORLDMAP_SQUARE_SIZE, WORLDMAP_SQUARE_SIZE)
  8013.  
  8014. local borderAnimation = CreateFrame ("frame", "$parentBorderShineAnimation", button, "AutoCastShineTemplate")
  8015. borderAnimation:SetFrameLevel (303)
  8016. borderAnimation:SetPoint ("topleft", 2, -2)
  8017. borderAnimation:SetPoint ("bottomright", -2, 2)
  8018. borderAnimation:SetAlpha (.05)
  8019. borderAnimation:Hide()
  8020. button.borderAnimation = borderAnimation
  8021.  
  8022. local shineAnimation = CreateFrame ("frame", "$parentShine", button, "AnimatedShineTemplate")
  8023. shineAnimation:SetFrameLevel (303)
  8024. --shineAnimation:SetAllPoints()
  8025. shineAnimation:SetPoint ("topleft", 4, -2)
  8026. shineAnimation:SetPoint ("bottomright", 0, 1)
  8027. shineAnimation:Hide()
  8028. button.shineAnimation = shineAnimation
  8029.  
  8030. local trackingGlowBorder = button:CreateTexture (nil, "overlay", 1)
  8031. trackingGlowBorder:SetPoint ("center", button, "center")
  8032. trackingGlowBorder:SetTexture ([[Interface\AddOns\WorldQuestTracker\media\border_trackingT]])
  8033. trackingGlowBorder:SetSize (WORLDMAP_SQUARE_SIZE * 1.33, WORLDMAP_SQUARE_SIZE * 1.33)
  8034. trackingGlowBorder:Hide()
  8035.  
  8036. trackingGlowBorder:SetTexture ([[Interface\AddOns\WorldQuestTracker\media\glow_yellow_squareT]])
  8037. trackingGlowBorder:SetBlendMode ("ADD")
  8038. --trackingGlowBorder:SetDesaturated (true)
  8039. trackingGlowBorder:SetSize (55, 55)
  8040. trackingGlowBorder:SetAlpha (.6)
  8041. trackingGlowBorder:SetDrawLayer ("BACKGROUND", -5)
  8042.  
  8043. local onStartTrackAnimation = DF:CreateAnimationHub (trackingGlowBorder, onStartClickAnimation)
  8044. WorldQuestTracker:CreateAnimation (onStartTrackAnimation, "Scale", 1, .12, .9, .9, 1.1, 1.1)
  8045. WorldQuestTracker:CreateAnimation (onStartTrackAnimation, "Scale", 2, .12, 1.2, 1.2, 1, 1)
  8046.  
  8047. local onEndTrackAnimation = DF:CreateAnimationHub (trackingGlowBorder, onStartClickAnimation, onEndClickAnimation)
  8048. WorldQuestTracker:CreateAnimation (onEndTrackAnimation, "Scale", 1, .5, 1, 1, .6, .6)
  8049. button.onStartTrackAnimation = onStartTrackAnimation
  8050. button.onEndTrackAnimation = onEndTrackAnimation
  8051.  
  8052. local shadow = button:CreateTexture (nil, "BACKGROUND")
  8053. shadow:SetTexture ([[Interface\COMMON\icon-shadow]])
  8054. shadow:SetAlpha (.3)
  8055. local shadow_offset = 8
  8056. shadow:SetPoint ("topleft", -shadow_offset, shadow_offset)
  8057. shadow:SetPoint ("bottomright", shadow_offset, -shadow_offset)
  8058.  
  8059. local criteriaFrame = CreateFrame ("frame", nil, button)
  8060. local criteriaIndicator = criteriaFrame:CreateTexture (nil, "OVERLAY", 2)
  8061. criteriaIndicator:SetPoint ("bottomleft", button, "bottomleft", -2, 0)
  8062. criteriaIndicator:SetSize (23*.4, 37*.4)
  8063. criteriaIndicator:SetAlpha (.8)
  8064. criteriaIndicator:SetTexture ([[Interface\AdventureMap\AdventureMap]])
  8065. criteriaIndicator:SetTexCoord (901/1024, 924/1024, 251/1024, 288/1024)
  8066. criteriaIndicator:Hide()
  8067. criteriaFrame.Texture = criteriaIndicator
  8068. local criteriaIndicatorGlow = criteriaFrame:CreateTexture (nil, "OVERLAY", 1)
  8069. criteriaIndicatorGlow:SetPoint ("center", criteriaIndicator, "center")
  8070. criteriaIndicatorGlow:SetSize (18, 18)
  8071. criteriaIndicatorGlow:SetTexture ([[Interface\AddOns\WorldQuestTracker\media\criteriaIndicatorGlowT]])
  8072. criteriaIndicatorGlow:SetTexCoord (0, 1, 0, 1)
  8073. criteriaIndicatorGlow:Hide()
  8074. criteriaFrame.Glow = criteriaIndicatorGlow
  8075.  
  8076. local criteriaAnimation = DF:CreateAnimationHub (criteriaFrame)
  8077. DF:CreateAnimation (criteriaAnimation, "Scale", 1, .15, 1, 1, 1.1, 1.1)
  8078. DF:CreateAnimation (criteriaAnimation, "Scale", 2, .15, 1.2, 1.2, 1, 1)
  8079. button.CriteriaAnimation = criteriaAnimation
  8080.  
  8081. commonBorder:Hide()
  8082. rareBorder:Hide()
  8083. epicBorder:Hide()
  8084. trackingBorder:Hide()
  8085.  
  8086. -- local timeBlip = button:CreateTexture (nil, "overlay", 2)
  8087. -- timeBlip:SetPoint ("bottomright", button, "bottomright", 2, -2)
  8088. -- timeBlip:SetSize (WORLDMAP_SQUARE_TIMEBLIP_SIZE, WORLDMAP_SQUARE_TIMEBLIP_SIZE)
  8089.  
  8090. --blip do tempo restante
  8091. button.timeBlipRed = button:CreateTexture (nil, "OVERLAY")
  8092. button.timeBlipRed:SetPoint ("bottomright", button, "bottomright", 4, -4)
  8093. button.timeBlipRed:SetSize (WORLDMAP_SQUARE_TIMEBLIP_SIZE, WORLDMAP_SQUARE_TIMEBLIP_SIZE)
  8094. button.timeBlipRed:SetTexture ([[Interface\COMMON\Indicator-Red]])
  8095. button.timeBlipRed:SetVertexColor (1, 1, 1)
  8096. button.timeBlipRed:SetAlpha (1)
  8097.  
  8098. button.timeBlipOrange = button:CreateTexture (nil, "OVERLAY")
  8099. button.timeBlipOrange:SetPoint ("bottomright", button, "bottomright", 4, -4)
  8100. button.timeBlipOrange:SetSize (WORLDMAP_SQUARE_TIMEBLIP_SIZE, WORLDMAP_SQUARE_TIMEBLIP_SIZE)
  8101. button.timeBlipOrange:SetTexture ([[Interface\COMMON\Indicator-Yellow]])
  8102. button.timeBlipOrange:SetVertexColor (1, .7, 0)
  8103. button.timeBlipOrange:SetAlpha (.9)
  8104.  
  8105. button.timeBlipYellow = button:CreateTexture (nil, "OVERLAY")
  8106. button.timeBlipYellow:SetPoint ("bottomright", button, "bottomright", 4, -4)
  8107. button.timeBlipYellow:SetSize (WORLDMAP_SQUARE_TIMEBLIP_SIZE, WORLDMAP_SQUARE_TIMEBLIP_SIZE)
  8108. button.timeBlipYellow:SetTexture ([[Interface\COMMON\Indicator-Yellow]])
  8109. button.timeBlipYellow:SetVertexColor (1, 1, 1)
  8110. button.timeBlipYellow:SetAlpha (.8)
  8111.  
  8112. button.timeBlipGreen = button:CreateTexture (nil, "OVERLAY")
  8113. button.timeBlipGreen:SetPoint ("bottomright", button, "bottomright", 4, -4)
  8114. button.timeBlipGreen:SetSize (WORLDMAP_SQUARE_TIMEBLIP_SIZE, WORLDMAP_SQUARE_TIMEBLIP_SIZE)
  8115. button.timeBlipGreen:SetTexture ([[Interface\COMMON\Indicator-Green]])
  8116. button.timeBlipGreen:SetVertexColor (1, 1, 1)
  8117. button.timeBlipGreen:SetAlpha (.6)
  8118.  
  8119. button.questTypeBlip = button:CreateTexture (nil, "OVERLAY", 2)
  8120. button.questTypeBlip:SetPoint ("topright", button, "topright", 2, 1)
  8121. button.questTypeBlip:SetSize (12, 12)
  8122.  
  8123. --> shared on party (world map)
  8124. button.partySharedBlip = button:CreateTexture (nil, "OVERLAY", 2)
  8125. button.partySharedBlip:SetPoint ("topleft", button, "topleft", -4, 4)
  8126. button.partySharedBlip:SetSize (12, 12)
  8127. button.partySharedBlip:SetAlpha (.85)
  8128. button.partySharedBlip:SetTexture ([[Interface\AddOns\WorldQuestTracker\media\icon_party_sharedT]])
  8129.  
  8130. local amountText = button:CreateFontString (nil, "overlay", "GameFontNormal", 1)
  8131. amountText:SetPoint ("top", button, "bottom", 1, 0)
  8132. DF:SetFontSize (amountText, 9)
  8133.  
  8134. local timeLeftText = button:CreateFontString (nil, "overlay", "GameFontNormal", 1)
  8135. timeLeftText:SetPoint ("top", amountText, "bottom", 0, -2)
  8136. DF:SetFontSize (timeLeftText, 10)
  8137. DF:SetFontColor (timeLeftText, {.9, .8, .2})
  8138. DF:SetFontColor (timeLeftText, {.9, .9, .9})
  8139. --
  8140. local timeLeftBackground = button:CreateTexture (nil, "background", 0)
  8141. timeLeftBackground:SetPoint ("center", timeLeftText, "center")
  8142. timeLeftBackground:SetTexture ([[Interface\AddOns\WorldQuestTracker\media\background_blackgradientT]])
  8143. timeLeftBackground:SetSize (32, 10)
  8144. timeLeftBackground:SetAlpha (.60)
  8145.  
  8146. local amountBackground = button:CreateTexture (nil, "overlay", 0)
  8147. amountBackground:SetPoint ("center", amountText, "center")
  8148. amountBackground:SetTexture ([[Interface\AddOns\WorldQuestTracker\media\background_blackgradientT]])
  8149. amountBackground:SetSize (32, 10)
  8150. amountBackground:SetAlpha (.7)
  8151.  
  8152. local highlight = button:CreateTexture (nil, "highlight")
  8153. highlight:SetAllPoints()
  8154. highlight:SetTexCoord (10/64, 54/64, 10/64, 54/64)
  8155. highlight:SetTexture ([[Interface\Store\store-item-highlight]])
  8156.  
  8157. local criteriaHighlight = button:CreateTexture (nil, "highlight")
  8158. criteriaHighlight:SetPoint ("bottomleft", button, "bottomleft", -2, 0)
  8159. criteriaHighlight:SetSize (23*.4, 37*.4)
  8160. criteriaHighlight:SetAlpha (.8)
  8161. criteriaHighlight:SetTexture ([[Interface\AdventureMap\AdventureMap]])
  8162. criteriaHighlight:SetTexCoord (901/1024, 924/1024, 251/1024, 288/1024)
  8163.  
  8164. local new = button:CreateTexture (nil, "overlay")
  8165. --new:SetPoint ("bottom", button, "bottom", 0, -2)
  8166. --new:SetPoint ("bottom", button, "bottom", 0, -5)
  8167. new:SetPoint ("bottom", button, "top", 0, -5)
  8168. new:SetSize (64*.45, 32*.45)
  8169. new:SetAlpha (.75)
  8170. new:SetTexture ([[Interface\AddOns\WorldQuestTracker\media\new]])
  8171. new:SetTexCoord (0, 1, 0, .5)
  8172. button.newIndicator = new
  8173.  
  8174. local newFlashTexture = button:CreateTexture (nil, "overlay")
  8175. newFlashTexture:SetPoint ("bottom", new, "bottom")
  8176. newFlashTexture:SetSize (64*.45, 32*.45)
  8177. newFlashTexture:SetTexture ([[Interface\AddOns\WorldQuestTracker\media\new]])
  8178. newFlashTexture:SetTexCoord (0, 1, 0, .5)
  8179. newFlashTexture:Hide()
  8180.  
  8181. local newFlash = newFlashTexture:CreateAnimationGroup()
  8182. newFlash.In = newFlash:CreateAnimation ("Alpha")
  8183. newFlash.In:SetOrder (1)
  8184. newFlash.In:SetFromAlpha (0)
  8185. newFlash.In:SetToAlpha (1)
  8186. newFlash.In:SetDuration (.3)
  8187. newFlash.On = newFlash:CreateAnimation ("Alpha")
  8188. newFlash.On:SetOrder (2)
  8189. newFlash.On:SetFromAlpha (1)
  8190. newFlash.On:SetToAlpha (1)
  8191. newFlash.On:SetDuration (2)
  8192. newFlash.Out = newFlash:CreateAnimation ("Alpha")
  8193. newFlash.Out:SetOrder (3)
  8194. newFlash.Out:SetFromAlpha (1)
  8195. newFlash.Out:SetToAlpha (0)
  8196. newFlash.Out:SetDuration (10)
  8197. newFlash:SetScript ("OnPlay", function()
  8198. newFlashTexture:Show()
  8199. end)
  8200. newFlash:SetScript ("OnFinished", function()
  8201. newFlashTexture:Hide()
  8202. end)
  8203. button.newFlash = newFlash
  8204.  
  8205. shadow:SetDrawLayer ("BACKGROUND", -6)
  8206. trackingGlowBorder:SetDrawLayer ("BACKGROUND", -5)
  8207. --trackingGlowBorder:SetDrawLayer ("overlay", 7)
  8208. background:SetDrawLayer ("background", -3)
  8209. texture:SetDrawLayer ("background", -2)
  8210. commonBorder:SetDrawLayer ("border", 1)
  8211. rareBorder:SetDrawLayer ("border", 1)
  8212. epicBorder:SetDrawLayer ("border", 1)
  8213. trackingBorder:SetDrawLayer ("border", 2)
  8214. amountBackground:SetDrawLayer ("overlay", 0)
  8215. amountText:SetDrawLayer ("overlay", 1)
  8216. criteriaIndicatorGlow:SetDrawLayer ("OVERLAY", 1)
  8217. criteriaIndicator:SetDrawLayer ("OVERLAY", 2)
  8218. newFlashTexture:SetDrawLayer ("OVERLAY", 7)
  8219. new:SetDrawLayer ("OVERLAY", 6)
  8220.  
  8221. button.timeBlipRed:SetDrawLayer ("overlay", 2)
  8222. button.timeBlipOrange:SetDrawLayer ("overlay", 2)
  8223. button.timeBlipYellow:SetDrawLayer ("overlay", 2)
  8224. button.timeBlipGreen:SetDrawLayer ("overlay", 2)
  8225.  
  8226. highlight:SetDrawLayer ("highlight", 1)
  8227. criteriaHighlight:SetDrawLayer ("highlight", 2)
  8228.  
  8229. button.background = background
  8230. button.texture = texture
  8231. button.commonBorder = commonBorder
  8232. button.rareBorder = rareBorder
  8233. button.epicBorder = epicBorder
  8234. button.invasionBorder = invasionBorder
  8235. button.trackingBorder = trackingBorder
  8236. button.trackingGlowBorder = trackingGlowBorder
  8237.  
  8238. button.timeBlip = timeBlip
  8239. button.timeLeftText = timeLeftText
  8240. button.timeLeftBackground = timeLeftBackground
  8241. button.amountText = amountText
  8242. button.amountBackground = amountBackground
  8243. button.criteriaIndicator = criteriaIndicator
  8244. button.criteriaHighlight = criteriaHighlight
  8245. button.criteriaIndicatorGlow = criteriaIndicatorGlow
  8246. button.isWorldMapWidget = true
  8247.  
  8248. return button
  8249. end
  8250.  
  8251. WorldQuestTracker.QUEST_POI_FRAME_WIDTH = 1
  8252. WorldQuestTracker.QUEST_POI_FRAME_HEIGHT = 1
  8253. WorldQuestTracker.NextWorldMapWidget = 1
  8254. WorldQuestTracker.WorldMapSquares = {}
  8255.  
  8256. function WorldQuestTracker.UpdateAllWorldMapAnchors()
  8257. for mapId, configTable in pairs (WorldQuestTracker.mapTables) do
  8258. local x, y = configTable.Anchor_X, configTable.Anchor_Y
  8259. WorldQuestTracker.UpdateWorldMapAnchors (x, y, configTable.MapAnchor)
  8260.  
  8261. local mapName = GetMapNameByID (mapId)
  8262. configTable.MapAnchor.Title:SetText (mapName)
  8263.  
  8264. configTable.MapAnchor.Title:ClearAllPoints()
  8265. configTable.MapAnchor.Title:Show()
  8266. if (configTable.GrowRight) then
  8267. configTable.MapAnchor.Title:SetPoint ("bottomleft", configTable.MapAnchor, "topleft", 0, 0)
  8268. configTable.MapAnchor.Title:SetJustifyH ("left")
  8269. else
  8270. configTable.MapAnchor.Title:SetPoint ("bottomright", configTable.MapAnchor, "topright", 0, 0)
  8271. configTable.MapAnchor.Title:SetJustifyH ("right")
  8272. end
  8273.  
  8274. configTable.factionFrame:Show()
  8275. end
  8276. end
  8277.  
  8278. function WorldQuestTracker.UpdateWorldMapAnchors (x, y, frame)
  8279. if (WorldMapFrame_InWindowedMode()) then
  8280. WorldQuestTracker.QUEST_POI_FRAME_WIDTH = WorldMapDetailFrame:GetWidth() * WORLDMAP_WINDOWED_SIZE
  8281. WorldQuestTracker.QUEST_POI_FRAME_HEIGHT = WorldMapDetailFrame:GetHeight() * WORLDMAP_WINDOWED_SIZE
  8282. else
  8283. WorldQuestTracker.QUEST_POI_FRAME_WIDTH = WorldMapDetailFrame:GetWidth() * WORLDMAP_FULLMAP_SIZE
  8284. WorldQuestTracker.QUEST_POI_FRAME_HEIGHT = WorldMapDetailFrame:GetHeight() * WORLDMAP_FULLMAP_SIZE
  8285. end
  8286.  
  8287. local posX = x * WorldQuestTracker.QUEST_POI_FRAME_WIDTH
  8288. local posY = y * WorldQuestTracker.QUEST_POI_FRAME_HEIGHT
  8289.  
  8290. frame:ClearAllPoints()
  8291. frame:SetPoint ("TOPLEFT", WorldMapPOIFrame, "TOPLEFT", posX, -posY)
  8292. end
  8293.  
  8294. function WorldQuestTracker.GetWorldMapWidget (configTable, showTimeLeftText)
  8295. local widget = WorldQuestTracker.WorldMapSquares [WorldQuestTracker.NextWorldMapWidget]
  8296. widget:Show()
  8297. widget:ClearAllPoints()
  8298.  
  8299. tinsert (configTable.widgets, widget)
  8300.  
  8301. if (configTable.GrowRight) then
  8302. if (configTable.LastWidget) then
  8303. widget:SetPoint ("topleft", configTable.LastWidget, "topright", 1, 0)
  8304. else
  8305. widget:SetPoint ("topleft", configTable.MapAnchor, "topright", 0, 0)
  8306. end
  8307. else
  8308. if (configTable.LastWidget) then
  8309. if (configTable.WidgetNumber == 11) then
  8310. if (showTimeLeftText) then
  8311. widget:SetPoint ("topright", configTable.MapAnchor, "topleft", 0, -50)
  8312. else
  8313. widget:SetPoint ("topright", configTable.MapAnchor, "topleft", 0, -40)
  8314. end
  8315. else
  8316. widget:SetPoint ("topright", configTable.LastWidget, "topleft", -1, 0)
  8317. end
  8318. else
  8319. widget:SetPoint ("topright", configTable.MapAnchor, "topleft", 0, 0)
  8320. end
  8321. end
  8322.  
  8323. configTable.LastWidget = widget
  8324. configTable.WidgetNumber = configTable.WidgetNumber + 1
  8325.  
  8326. WorldQuestTracker.NextWorldMapWidget = WorldQuestTracker.NextWorldMapWidget + 1
  8327.  
  8328. widget:SetScale (WorldQuestTracker.db.profile.worldmap_widgets.scale)
  8329.  
  8330. return widget
  8331. end
  8332.  
  8333. function WorldQuestTracker.ClearWorldMapWidgets()
  8334. for i = 1, 120 do
  8335. local widget = WorldQuestTracker.WorldMapSquares [i]
  8336. widget:ClearAllPoints()
  8337. widget:Hide()
  8338. end
  8339.  
  8340. for mapId, configTable in pairs (WorldQuestTracker.mapTables) do
  8341. table.wipe (configTable.widgets)
  8342. configTable.LastWidget = nil
  8343. configTable.WidgetNumber = 1
  8344. end
  8345.  
  8346. WorldQuestTracker.NextWorldMapWidget = 1
  8347. end
  8348.  
  8349. local create_world_widgets = function()
  8350.  
  8351. --cria 7 ancoras (5 mapas 1 eye of azshara 1 dalaran)
  8352. --os quadrados ser�o ancorados a estas ancoras
  8353. for mapId, configTable in pairs (WorldQuestTracker.mapTables) do
  8354. local anchor = CreateFrame ("frame", nil, worldFramePOIs)
  8355. anchor:SetSize (1, 1)
  8356. local x, y = configTable.Anchor_X, configTable.Anchor_Y
  8357. configTable.MapAnchor = anchor
  8358.  
  8359. WorldQuestTracker.UpdateWorldMapAnchors (x, y, anchor)
  8360.  
  8361. local anchorText = anchor:CreateFontString (nil, "artwork", "GameFontNormal")
  8362. anchorText:SetPoint ("bottomleft", anchor, "topleft", 0, 0)
  8363. anchor.Title = anchorText
  8364.  
  8365. local factionFrame = CreateFrame ("frame", "WorldQuestTrackerFactionFrame" .. mapId, worldFramePOIs)
  8366. tinsert (faction_frames, factionFrame)
  8367. factionFrame:SetSize (20, 20)
  8368. configTable.factionFrame = factionFrame
  8369.  
  8370. tinsert (all_widgets, factionFrame)
  8371. tinsert (all_widgets, anchorText)
  8372. end
  8373.  
  8374. for i = 1, 120 do
  8375. local button = create_worldmap_square ("WorldQuestTrackerWMButton", i)
  8376. button:Hide()
  8377. tinsert (WorldQuestTracker.WorldMapSquares, button)
  8378. end
  8379.  
  8380. WorldQuestTracker.WorldMapFrameReference = WorldQuestTracker.WorldMapSquares [1]
  8381. end
  8382.  
  8383. create_world_widgets()
  8384.  
  8385. --agenda uma atualiza��o nos widgets do world map caso os dados das quests estejam indispon�veis
  8386. local do_worldmap_update = function()
  8387. if (GetCurrentMapAreaID() == MAPID_BROKENISLES) then
  8388. WorldQuestTracker.UpdateWorldQuestsOnWorldMap (true) --no cache true
  8389. else
  8390. if (WorldQuestTracker.ScheduledWorldUpdate and not WorldQuestTracker.ScheduledWorldUpdate._cancelled) then
  8391. WorldQuestTracker.ScheduledWorldUpdate:Cancel()
  8392. end
  8393. end
  8394. end
  8395. function WorldQuestTracker.ScheduleWorldMapUpdate (seconds)
  8396. if (WorldQuestTracker.ScheduledWorldUpdate and not WorldQuestTracker.ScheduledWorldUpdate._cancelled) then
  8397. WorldQuestTracker.ScheduledWorldUpdate:Cancel()
  8398. end
  8399. WorldQuestTracker.ScheduledWorldUpdate = C_Timer.NewTimer (seconds or 1, do_worldmap_update)
  8400. end
  8401.  
  8402. local re_check_for_questcompleted = function()
  8403. WorldQuestTracker.UpdateWorldQuestsOnWorldMap (true, true, true)
  8404. end
  8405.  
  8406. -- ~filter
  8407. function WorldQuestTracker.GetQuestFilterTypeAndOrder (worldQuestType, gold, rewardName, itemName, isArtifact, stackAmount, numRewardItems, rewardTexture)
  8408. local filter, order
  8409.  
  8410. if (worldQuestType == LE_QUEST_TAG_TYPE_PET_BATTLE) then
  8411. return FILTER_TYPE_PET_BATTLES, WorldQuestTracker.db.profile.sort_order [WQT_QUESTTYPE_PETBATTLE]
  8412. elseif (worldQuestType == LE_QUEST_TAG_TYPE_PVP) then
  8413. return FILTER_TYPE_PVP, WorldQuestTracker.db.profile.sort_order [WQT_QUESTTYPE_PVP]
  8414. elseif (worldQuestType == LE_QUEST_TAG_TYPE_PROFESSION) then
  8415. return FILTER_TYPE_PROFESSION, WorldQuestTracker.db.profile.sort_order [WQT_QUESTTYPE_PROFESSION]
  8416. elseif (worldQuestType == LE_QUEST_TAG_TYPE_DUNGEON) then
  8417. filter = FILTER_TYPE_DUNGEON
  8418. order = WorldQuestTracker.db.profile.sort_order [WQT_QUESTTYPE_DUNGEON]
  8419. end
  8420.  
  8421. if (gold and gold > 0) then
  8422. order = WorldQuestTracker.db.profile.sort_order [WQT_QUESTTYPE_GOLD]
  8423. filter = FILTER_TYPE_GOLD
  8424. end
  8425.  
  8426. -- if (type (rewardTexture) == "number") then
  8427. -- print (rewardName, rewardTexture)
  8428. -- end
  8429. -- Legionfall War Supplies 1017868
  8430.  
  8431. -- check if this is a order hall resource
  8432. -- = to string since legionfall resource icons is number
  8433. --if (rewardName and (type (rewardTexture) == "string" and rewardTexture:find ("inv_orderhall_orderresources"))) then
  8434. --1397630 = order hall resource icon - since 7.2.5 is a number
  8435. if (rewardName and ((type(rewardTexture) == "string" and rewardTexture:find("inv_orderhall_orderresources")) or (type(rewardTexture) == "number" and rewardTexture == 1397630))) then --thanks @TOM_RUS on curseforge
  8436. --if (numRewardItems and numRewardItems > 1) then
  8437. --can be an invasion quest
  8438. -- if (rewardTexture and rewardTexture:find ("inv_misc_summonable_boss_token")) then
  8439. --> is an invasion quest, need to see which are the real reward
  8440.  
  8441. -- end
  8442. --
  8443. --end
  8444. order = WorldQuestTracker.db.profile.sort_order [WQT_QUESTTYPE_RESOURCE]
  8445. filter = FILTER_TYPE_GARRISON_RESOURCE
  8446. end
  8447.  
  8448. if (isArtifact) then
  8449. order = WorldQuestTracker.db.profile.sort_order [WQT_QUESTTYPE_APOWER]
  8450. filter = FILTER_TYPE_ARTIFACT_POWER
  8451. elseif (itemName) then
  8452. if (stackAmount > 1) then
  8453. order = WorldQuestTracker.db.profile.sort_order [WQT_QUESTTYPE_TRADE]
  8454. filter = FILTER_TYPE_TRADESKILL
  8455. else
  8456. order = WorldQuestTracker.db.profile.sort_order [WQT_QUESTTYPE_EQUIPMENT]
  8457. filter = FILTER_TYPE_EQUIPMENT
  8458. end
  8459. end
  8460.  
  8461. --> if dungeons are disabled, override the quest type to dungeon
  8462. if (worldQuestType == LE_QUEST_TAG_TYPE_DUNGEON) then
  8463. if (not WorldQuestTracker.db.profile.filters [FILTER_TYPE_DUNGEON]) then
  8464. filter = FILTER_TYPE_DUNGEON
  8465. end
  8466. end
  8467.  
  8468. return filter, order
  8469. end
  8470.  
  8471. local quest_bugged = {}
  8472.  
  8473. function WorldQuestTracker.GetWorldWidgetForQuest (questID)
  8474. for i = 1, #all_widgets do
  8475. local widget = all_widgets [i]
  8476. if (widget:IsShown() and widget.questID == questID) then
  8477. return widget
  8478. end
  8479. end
  8480. end
  8481.  
  8482. function WorldQuestTracker.UpdateWorldQuestsOnWorldMap (noCache, showFade, isQuestFlaggedRecheck, forceCriteriaAnimation)
  8483.  
  8484. if (UnitLevel ("player") < 110) then
  8485. WorldQuestTracker.HideWorldQuestsOnWorldMap()
  8486. return
  8487. elseif (not IsQuestFlaggedCompleted (WORLD_QUESTS_AVAILABLE_QUEST_ID)) then
  8488. WorldQuestTracker.HideWorldQuestsOnWorldMap()
  8489. --print ("quest nao completada...")
  8490. if (not isQuestFlaggedRecheck) then
  8491. C_Timer.After (3, re_check_for_questcompleted)
  8492. end
  8493. return
  8494.  
  8495. elseif (WorldQuestTracker.db.profile.disable_world_map_widgets) then
  8496. WorldQuestTracker.HideWorldQuestsOnWorldMap()
  8497. return
  8498. end
  8499.  
  8500. WorldQuestTracker.RefreshStatusBar()
  8501.  
  8502. WorldQuestTracker.ClearZoneSummaryButtons()
  8503.  
  8504. WorldQuestTracker.LastUpdate = GetTime()
  8505. wipe (factionAmountForEachMap)
  8506.  
  8507. --mostrar os widgets extras
  8508. -- for _, widget in ipairs (extra_widgets) do
  8509. -- widget:Show()
  8510. -- end
  8511.  
  8512. --limpa todos os widgets no world map
  8513. WorldQuestTracker.ClearWorldMapWidgets()
  8514. --
  8515. if (WorldQuestTracker.WorldWidgets_NeedFullRefresh) then
  8516. WorldQuestTracker.WorldWidgets_NeedFullRefresh = nil
  8517. noCache = true
  8518. end
  8519.  
  8520. local questsAvailable = {}
  8521. local needAnotherUpdate = false
  8522. local filters = WorldQuestTracker.db.profile.filters
  8523. local timePriority = WorldQuestTracker.db.profile.sort_time_priority and WorldQuestTracker.db.profile.sort_time_priority * 60 --4 8 12 16 24
  8524. local showTimeLeftText = WorldQuestTracker.db.profile.show_timeleft
  8525. local forceShowBrokenShore = WorldQuestTracker.db.profile.filter_force_show_brokenshore
  8526.  
  8527. local sortByTimeLeft = WorldQuestTracker.db.profile.force_sort_by_timeleft
  8528. local worldMapID = GetCurrentMapAreaID()
  8529.  
  8530. for mapId, configTable in pairs (WorldQuestTracker.mapTables) do
  8531.  
  8532. --PTR
  8533. questsAvailable [mapId] = {}
  8534.  
  8535. --local taskInfo = GetQuestsForPlayerByMapID (mapId, 1007)
  8536. local taskInfo = GetQuestsForPlayerByMapID (mapId, worldMapID)
  8537.  
  8538. local shownQuests = 0
  8539. -- /dump #GetQuestsForPlayerByMapID (1015)
  8540.  
  8541. if (taskInfo and #taskInfo > 0) then
  8542. for i, info in ipairs (taskInfo) do
  8543.  
  8544. local questID = info.questId
  8545. if (HaveQuestData (questID)) then
  8546. local isWorldQuest = QuestMapFrame_IsQuestWorldQuest (questID)
  8547. if (isWorldQuest) then
  8548. local timeLeft = WorldQuestTracker.GetQuest_TimeLeft (questID)
  8549. if (timeLeft and timeLeft > 0) then
  8550.  
  8551. --gold
  8552. local gold, goldFormated = WorldQuestTracker.GetQuestReward_Gold (questID)
  8553. --class hall resource
  8554. local rewardName, rewardTexture, numRewardItems = WorldQuestTracker.GetQuestReward_Resource (questID)
  8555. --item
  8556. local itemName, itemTexture, itemLevel, quantity, quality, isUsable, itemID, isArtifact, artifactPower, isStackable, stackAmount = WorldQuestTracker.GetQuestReward_Item (questID)
  8557. --type
  8558. local title, factionID, tagID, tagName, worldQuestType, rarity, isElite, tradeskillLineIndex = WorldQuestTracker.GetQuest_Info (questID)
  8559.  
  8560. --print (tradeskillLineIndex)
  8561. --tradeskillLineIndex = usado pra essa fun��o GetProfessionInfo (tradeskillLineIndex)
  8562. --WORLD_QUEST_ICONS_BY_PROFESSION[tradeskillLineID]
  8563. --local tradeskillLineID = tradeskillLineIndex and select(7, GetProfessionInfo(tradeskillLineIndex));
  8564.  
  8565. if ((not gold or gold <= 0) and not rewardName and not itemName) then
  8566. needAnotherUpdate = true
  8567. end
  8568.  
  8569. --~sort
  8570. --if (numRewardItems and numRewardItems > 1) then
  8571. -- print (rewardName, rewardTexture, numRewardItems)
  8572. --end
  8573.  
  8574. local filter, order = WorldQuestTracker.GetQuestFilterTypeAndOrder (worldQuestType, gold, rewardName, itemName, isArtifact, stackAmount, numRewardItems, rewardTexture)
  8575. order = order or 1
  8576.  
  8577. if (sortByTimeLeft) then
  8578. order = abs (timeLeft - 10000)
  8579. elseif (timePriority) then --timePriority j� multiplicado por 60
  8580. if (timeLeft < timePriority) then
  8581. order = abs (timeLeft - 1000)
  8582. end
  8583. end
  8584.  
  8585. if (filters [filter] or rarity == LE_WORLD_QUEST_QUALITY_EPIC or (forceShowBrokenShore and mapId == 1021)) then --force show broken shore quests
  8586. tinsert (questsAvailable [mapId], {questID, order, info.numObjectives})
  8587. shownQuests = shownQuests + 1
  8588.  
  8589. elseif (WorldQuestTracker.db.profile.filter_always_show_faction_objectives) then
  8590. local isCriteria = WorldMapFrame.UIElementsFrame.BountyBoard:IsWorldQuestCriteriaForSelectedBounty (questID)
  8591. if (isCriteria) then
  8592. tinsert (questsAvailable [mapId], {questID, order, info.numObjectives})
  8593. shownQuests = shownQuests + 1
  8594. end
  8595. --end
  8596. else
  8597. --if (mapId == 1033) then
  8598. -- print ("DENIED:", i, title, filter)
  8599. --end
  8600. end
  8601. end
  8602. end
  8603. else
  8604. quest_bugged [questID] = (quest_bugged [questID] or 0) + 1
  8605. if (quest_bugged [questID] < 20) then
  8606. needAnotherUpdate = true
  8607. end
  8608. end
  8609. end
  8610.  
  8611. table.sort (questsAvailable [mapId], function (t1, t2) return t1[2] < t2[2] end)
  8612.  
  8613. if (shownQuests == 0) then
  8614. --hidar os widgets extras mque pertencem a zone sem quests
  8615. --for o = 1, #WorldQuestTracker.WorldMapSupportWidgets [mapId] do
  8616. -- WorldQuestTracker.WorldMapSupportWidgets [mapId] [o]:Hide()
  8617. --end
  8618. end
  8619. else
  8620. if (not taskInfo) then
  8621. needAnotherUpdate = true
  8622. elseif (#taskInfo == 0) then
  8623. --hidar os widgets extras mque pertencem a zone sem quests
  8624. --if (WorldQuestTracker.WorldMapSupportWidgets [mapId]) then
  8625. -- for o = 1, #WorldQuestTracker.WorldMapSupportWidgets [mapId] do
  8626. -- WorldQuestTracker.WorldMapSupportWidgets [mapId] [o]:Hide()
  8627. -- end
  8628. --end
  8629. end
  8630. end
  8631. end
  8632.  
  8633. --
  8634.  
  8635. local availableQuests = 0
  8636. local total_Gold = 0
  8637. local total_Resources = 0
  8638. local total_APower = 0
  8639.  
  8640. local isUsingTracker = WorldQuestTracker.db.profile.use_tracker
  8641. local timePriority = WorldQuestTracker.db.profile.sort_time_priority
  8642. local UseTimePriorityAlpha = WorldQuestTracker.db.profile.alpha_time_priority
  8643. if (timePriority) then
  8644. if (timePriority == 4) then
  8645. timePriority = 60*4
  8646. elseif (timePriority == 8) then
  8647. timePriority = 60*8
  8648. elseif (timePriority == 12) then
  8649. timePriority = 60*12
  8650. elseif (timePriority == 16) then
  8651. timePriority = 60*16
  8652. elseif (timePriority == 24) then
  8653. timePriority = 60*24
  8654. end
  8655. end
  8656.  
  8657. wipe (WorldQuestTracker.Cache_ShownQuestOnWorldMap)
  8658. WorldQuestTracker.Cache_ShownQuestOnWorldMap [WQT_QUESTTYPE_GOLD] = {}
  8659. WorldQuestTracker.Cache_ShownQuestOnWorldMap [WQT_QUESTTYPE_RESOURCE] = {}
  8660. WorldQuestTracker.Cache_ShownQuestOnWorldMap [WQT_QUESTTYPE_APOWER] = {}
  8661.  
  8662. local research_nameLoc, research_timeleftString, research_timeLeft, research_elapsedTime, shipmentsReady = WorldQuestTracker:GetNextResearchNoteTime()
  8663. if (research_timeLeft and research_timeLeft > 60) then
  8664. research_timeLeft = research_timeLeft / 60 --convert in minutes
  8665. end
  8666. local hasArtifactUnderpower
  8667. if (shipmentsReady and shipmentsReady > 0) then
  8668. --> already loaded?
  8669. if (WorldQuestTracker.ShowResearchNoteReady) then
  8670. WorldQuestTracker.ShowResearchNoteReady (research_nameLoc)
  8671. end
  8672. else
  8673. if (WorldQuestTracker.HideResearchNoteReady) then
  8674. WorldQuestTracker.HideResearchNoteReady()
  8675. end
  8676. end
  8677.  
  8678. local worldMapID = GetCurrentMapAreaID()
  8679.  
  8680. for mapId, configTable in pairs (WorldQuestTracker.mapTables) do
  8681. --local taskInfo = GetQuestsForPlayerByMapID (mapId, 1007)
  8682. local taskInfo = GetQuestsForPlayerByMapID (mapId, worldMapID)
  8683. local taskIconIndex = 1
  8684. local widgets = configTable.widgets
  8685.  
  8686. if (taskInfo and #taskInfo > 0) then
  8687. availableQuests = availableQuests + #taskInfo
  8688.  
  8689. --for i, info in ipairs (taskInfo) do
  8690. for i, quest in ipairs (questsAvailable [mapId]) do
  8691. --print (i, quest)
  8692. --local questID = info.questId
  8693.  
  8694. local questID = quest [1]
  8695. local numObjectives = quest [3]
  8696.  
  8697. if (HaveQuestData (questID)) then
  8698. local isWorldQuest = QuestMapFrame_IsQuestWorldQuest (questID)
  8699. if (isWorldQuest) then
  8700.  
  8701. C_TaskQuest.RequestPreloadRewardData (questID)
  8702.  
  8703. --se � nova
  8704. local isNew = WorldQuestTracker.SavedQuestList_IsNew (questID)
  8705. --isNew = true --debug
  8706.  
  8707. --info
  8708. local title, factionID, tagID, tagName, worldQuestType, rarity, isElite, tradeskillLineIndex = WorldQuestTracker.GetQuest_Info (questID)
  8709. --tempo restante
  8710. local timeLeft = WorldQuestTracker.GetQuest_TimeLeft (questID)
  8711.  
  8712. if (timeLeft and timeLeft > 0) then
  8713. local isCriteria = WorldMapFrame.UIElementsFrame.BountyBoard:IsWorldQuestCriteriaForSelectedBounty (questID)
  8714. if (isCriteria) then
  8715. factionAmountForEachMap [mapId] = (factionAmountForEachMap [mapId] or 0) + 1
  8716. end
  8717.  
  8718. --local widget = widgets [taskIconIndex]
  8719. local widget = WorldQuestTracker.GetWorldMapWidget (configTable, showTimeLeftText)
  8720.  
  8721. if (not widget) then
  8722. --se n�o tiver o widget, o jogador abriu o mapa muito rapidamente
  8723. if (WorldMapFrame:IsShown()) then
  8724. WorldQuestTracker.ScheduleWorldMapUpdate (1.5)
  8725. WorldQuestTracker.PlayLoadingAnimation()
  8726. end
  8727. return
  8728. end
  8729.  
  8730. if (timePriority and UseTimePriorityAlpha) then
  8731. if (timeLeft < timePriority) then
  8732. widget:SetAlpha (1)
  8733. else
  8734. widget:SetAlpha (.4)
  8735. end
  8736. else
  8737. widget:SetAlpha (1)
  8738. end
  8739.  
  8740. if (widget) then
  8741.  
  8742. widget.timeBlipRed:Hide()
  8743. widget.timeBlipOrange:Hide()
  8744. widget.timeBlipYellow:Hide()
  8745. widget.timeBlipGreen:Hide()
  8746. widget.partySharedBlip:Hide()
  8747.  
  8748. if (showTimeLeftText) then
  8749. widget.timeLeftText:Show()
  8750. widget.timeLeftBackground:Show()
  8751. widget.timeLeftText:SetText (timeLeft > 1440 and floor (timeLeft/1440) .. "d" or timeLeft > 60 and floor (timeLeft/60) .. "h" or timeLeft .. "m")
  8752. else
  8753. widget.timeLeftBackground:Hide()
  8754. widget.timeLeftText:Hide()
  8755. end
  8756.  
  8757. if (widget.lastQuestID == questID and not noCache) then
  8758. --precisa apenas atualizar o tempo
  8759. WorldQuestTracker.SetTimeBlipColor (widget, timeLeft)
  8760. widget.questID = questID
  8761. widget.mapID = mapId
  8762.  
  8763. --WorldQuestTracker.SetIconTexture (widget, false, false, false)
  8764. widget:Show()
  8765.  
  8766. if (widget.texture:GetTexture() == nil) then
  8767. WorldQuestTracker.ScheduleWorldMapUpdate()
  8768. end
  8769.  
  8770. if (isCriteria) then
  8771. if (not widget.criteriaIndicator:IsShown() or forceCriteriaAnimation) then
  8772. widget.CriteriaAnimation:Play()
  8773. end
  8774. widget.criteriaIndicator:Show()
  8775. widget.criteriaHighlight:Show()
  8776. widget.criteriaIndicatorGlow:Show()
  8777. else
  8778. widget.criteriaIndicator:Hide()
  8779. widget.criteriaHighlight:Hide()
  8780. widget.criteriaIndicatorGlow:Hide()
  8781. end
  8782.  
  8783. if (isNew) then
  8784. widget.newIndicator:Show()
  8785. widget.newFlash:Play()
  8786. else
  8787. widget.newIndicator:Hide()
  8788. end
  8789.  
  8790. if (not isUsingTracker) then
  8791. if (WorldQuestTracker.IsQuestOnObjectiveTracker (questID)) then
  8792. widget.trackingGlowBorder:Show()
  8793. else
  8794. widget.trackingGlowBorder:Hide()
  8795. end
  8796. else
  8797. if (WorldQuestTracker.IsQuestBeingTracked (questID)) then
  8798. widget.trackingGlowBorder:Show()
  8799. else
  8800. --widget.trackingGlowBorder:Hide()
  8801. end
  8802. end
  8803.  
  8804. if (widget.QuestType == QUESTTYPE_ARTIFACTPOWER) then
  8805. total_APower = total_APower + widget.Amount
  8806. tinsert (WorldQuestTracker.Cache_ShownQuestOnWorldMap [WQT_QUESTTYPE_APOWER], questID)
  8807. elseif (widget.QuestType == QUESTTYPE_GOLD) then
  8808. total_Gold = total_Gold + widget.Amount
  8809. tinsert (WorldQuestTracker.Cache_ShownQuestOnWorldMap [WQT_QUESTTYPE_GOLD], questID)
  8810. elseif (widget.QuestType == QUESTTYPE_RESOURCE) then
  8811. total_Resources = total_Resources + widget.Amount
  8812. tinsert (WorldQuestTracker.Cache_ShownQuestOnWorldMap [WQT_QUESTTYPE_RESOURCE], questID)
  8813. end
  8814.  
  8815. --party shared (world)
  8816. if (WorldQuestTracker.IsPartyQuest (questID)) then
  8817. widget.partySharedBlip:Show()
  8818. end
  8819.  
  8820. else
  8821. --faz uma atualiza��o total do bloco
  8822. widget:Show()
  8823.  
  8824. --gold
  8825. local gold, goldFormated = WorldQuestTracker.GetQuestReward_Gold (questID)
  8826. --class hall resource
  8827. local rewardName, rewardTexture, numRewardItems = WorldQuestTracker.GetQuestReward_Resource (questID)
  8828. --item
  8829. local itemName, itemTexture, itemLevel, quantity, quality, isUsable, itemID, isArtifact, artifactPower, isStackable = WorldQuestTracker.GetQuestReward_Item (questID)
  8830.  
  8831. --atualiza o widget
  8832. widget.isArtifact = nil
  8833. widget.questID = questID
  8834. widget.lastQuestID = questID
  8835. widget.worldQuest = true
  8836. --widget.numObjectives = info.numObjectives
  8837. widget.numObjectives = numObjectives
  8838. widget.amountText:SetText ("")
  8839. widget.amountBackground:Hide()
  8840. widget.mapID = mapId
  8841. widget.IconTexture = nil
  8842. widget.IconText = nil
  8843. widget.QuestType = nil
  8844. widget.Amount = 0
  8845.  
  8846. if (isCriteria) then
  8847. widget.criteriaIndicator:Show()
  8848. widget.criteriaHighlight:Show()
  8849. widget.criteriaIndicatorGlow:Show()
  8850. else
  8851. widget.criteriaIndicator:Hide()
  8852. widget.criteriaHighlight:Hide()
  8853. widget.criteriaIndicatorGlow:Hide()
  8854. end
  8855.  
  8856. if (isNew) then
  8857. widget.newIndicator:Show()
  8858. widget.newFlash:Play()
  8859. else
  8860. widget.newIndicator:Hide()
  8861. end
  8862.  
  8863. if (not isUsingTracker) then
  8864. if (WorldQuestTracker.IsQuestOnObjectiveTracker (questID)) then
  8865. widget.trackingGlowBorder:Show()
  8866. else
  8867. widget.trackingGlowBorder:Hide()
  8868. end
  8869. else
  8870. if (WorldQuestTracker.IsQuestBeingTracked (questID)) then
  8871. widget.trackingGlowBorder:Show()
  8872. else
  8873. widget.trackingGlowBorder:Hide()
  8874. end
  8875. end
  8876.  
  8877. WorldQuestTracker.SetTimeBlipColor (widget, timeLeft)
  8878. widget.amountBackground:SetWidth (32)
  8879.  
  8880. if (worldQuestType == LE_QUEST_TAG_TYPE_PVP) then
  8881. widget.questTypeBlip:Show()
  8882. widget.questTypeBlip:SetTexture ([[Interface\PVPFrame\Icon-Combat]])
  8883. widget.questTypeBlip:SetTexCoord (0, 1, 0, 1)
  8884. widget.questTypeBlip:SetAlpha (.74)
  8885.  
  8886. elseif (worldQuestType == LE_QUEST_TAG_TYPE_PET_BATTLE) then
  8887. widget.questTypeBlip:Show()
  8888. widget.questTypeBlip:SetTexture ([[Interface\MINIMAP\ObjectIconsAtlas]])
  8889. --widget.questTypeBlip:SetTexCoord (172/512, 201/512, 273/512, 301/512)
  8890. widget.questTypeBlip:SetTexCoord (376/512, 403/512, 239/512, 265/512) -- left right top botton
  8891. widget.questTypeBlip:SetAlpha (.85)
  8892.  
  8893. elseif (worldQuestType == LE_QUEST_TAG_TYPE_DUNGEON) then
  8894. widget.questTypeBlip:Show()
  8895. widget.questTypeBlip:SetTexture ([[Interface\Scenarios\ScenarioIcon-Boss]])
  8896. widget.questTypeBlip:SetTexCoord (0, 1, 0, 1)
  8897. widget.questTypeBlip:SetAlpha (.80)
  8898.  
  8899. else
  8900. widget.questTypeBlip:Hide()
  8901. end
  8902.  
  8903. --party shared (world)
  8904. if (WorldQuestTracker.IsPartyQuest (questID)) then
  8905. widget.partySharedBlip:Show()
  8906. end
  8907.  
  8908. local okey = false
  8909.  
  8910. if (gold > 0) then
  8911. local texture, coords = WorldQuestTracker.GetGoldIcon()
  8912. widget.texture:SetTexture (texture)
  8913. --WorldQuestTracker.SetIconTexture (widget.texture, texture, false, false)
  8914.  
  8915. widget.amountText:SetText (goldFormated)
  8916. widget.amountBackground:Show()
  8917.  
  8918. widget.IconTexture = texture
  8919. widget.IconText = goldFormated
  8920. widget.QuestType = QUESTTYPE_GOLD
  8921. widget.Amount = gold
  8922. total_Gold = total_Gold + gold
  8923. tinsert (WorldQuestTracker.Cache_ShownQuestOnWorldMap [WQT_QUESTTYPE_GOLD], questID)
  8924. okey = true
  8925. end
  8926.  
  8927. if (rewardName and not okey) then
  8928. widget.texture:SetTexture (rewardTexture)
  8929. --WorldQuestTracker.SetIconTexture (widget.texture, rewardTexture, false, false)
  8930. --widget.texture:SetTexCoord (0, 1, 0, 1)
  8931. if (numRewardItems >= 1000) then
  8932. widget.amountText:SetText (format ("%.1fK", numRewardItems/1000))
  8933. widget.amountBackground:SetWidth (40)
  8934. else
  8935. widget.amountText:SetText (numRewardItems)
  8936. end
  8937. widget.amountBackground:Show()
  8938.  
  8939. widget.IconTexture = rewardTexture
  8940. widget.IconText = numRewardItems
  8941. widget.QuestType = QUESTTYPE_RESOURCE
  8942. widget.Amount = numRewardItems
  8943. total_Resources = total_Resources + numRewardItems
  8944. tinsert (WorldQuestTracker.Cache_ShownQuestOnWorldMap [WQT_QUESTTYPE_RESOURCE], questID)
  8945. okey = true
  8946. end
  8947.  
  8948. if (itemName) then
  8949. if (isArtifact) then
  8950. local artifactIcon = WorldQuestTracker.GetArtifactPowerIcon (artifactPower)
  8951.  
  8952. if (research_timeLeft and research_timeLeft < timeLeft) then
  8953. widget.texture:SetTexture ([[Interface\AddOns\WorldQuestTracker\media\icon_artifactpower_blueT]])
  8954. hasArtifactUnderpower = true
  8955. else
  8956. widget.texture:SetTexture (artifactIcon)
  8957. end
  8958.  
  8959. --WorldQuestTracker.SetIconTexture (widget.texture, artifactIcon, false, false)
  8960. widget.isArtifact = true
  8961. if (artifactPower >= 1000) then
  8962. if (artifactPower > 999999) then
  8963. --widget.amountText:SetText (format ("%.1fM", artifactPower/1000000))
  8964. widget.amountText:SetText (WorldQuestTracker.ToK (artifactPower))
  8965.  
  8966. elseif (artifactPower > 9999) then
  8967. --widget.amountText:SetText (format ("%.0fK", artifactPower/1000))
  8968. widget.amountText:SetText (WorldQuestTracker.ToK (artifactPower))
  8969. else
  8970. widget.amountText:SetText (format ("%.1fK", artifactPower/1000))
  8971. end
  8972. widget.amountBackground:SetWidth (36)
  8973. else
  8974. widget.amountText:SetText (artifactPower)
  8975. end
  8976. widget.amountBackground:Show()
  8977.  
  8978. local artifactIcon = WorldQuestTracker.GetArtifactPowerIcon (artifactPower, true)
  8979. widget.IconTexture = artifactIcon
  8980. widget.IconText = artifactPower
  8981. widget.QuestType = QUESTTYPE_ARTIFACTPOWER
  8982. widget.Amount = artifactPower
  8983. tinsert (WorldQuestTracker.Cache_ShownQuestOnWorldMap [WQT_QUESTTYPE_APOWER], questID)
  8984. total_APower = total_APower + artifactPower
  8985. else
  8986. widget.texture:SetTexture (itemTexture)
  8987. --WorldQuestTracker.SetIconTexture (widget.texture, itemTexture, false, false)
  8988. --widget.texture:SetTexCoord (0, 1, 0, 1)
  8989. if (itemLevel > 600 and itemLevel < 780) then
  8990. itemLevel = 810
  8991. end
  8992.  
  8993. local color = ""
  8994. if (quality == 4 or quality == 3) then
  8995. color = WorldQuestTracker.RarityColors [quality]
  8996. end
  8997. widget.amountText:SetText ((isStackable and quantity and quantity >= 1 and quantity or false) or (itemLevel and itemLevel > 5 and (color) .. itemLevel) or "")
  8998.  
  8999. if (widget.amountText:GetText() and widget.amountText:GetText() ~= "") then
  9000. widget.amountBackground:Show()
  9001. else
  9002. widget.amountBackground:Hide()
  9003. end
  9004.  
  9005. widget.IconTexture = itemTexture
  9006. widget.IconText = widget.amountText:GetText()
  9007. widget.QuestType = QUESTTYPE_ITEM
  9008. end
  9009.  
  9010. WorldQuestTracker.AllCharactersQuests_Add (questID, timeLeft, widget.IconTexture, widget.IconText)
  9011.  
  9012. okey = true
  9013.  
  9014. else
  9015. --unknown quest?
  9016. end
  9017.  
  9018. if (not okey) then
  9019. needAnotherUpdate = true
  9020. end
  9021. end
  9022. end
  9023.  
  9024. WorldQuestTracker.UpdateBorder (widget, rarity, worldQuestType)
  9025. taskIconIndex = taskIconIndex + 1
  9026. end
  9027. end
  9028. else
  9029. --nao tem os dados da quest ainda
  9030. needAnotherUpdate = true
  9031. end
  9032. end
  9033.  
  9034. -- for i = taskIconIndex, 20 do
  9035. -- widgets[i]:Hide()
  9036. -- end
  9037. else
  9038. if (not taskInfo) then
  9039. needAnotherUpdate = true
  9040. else
  9041. -- for i = taskIconIndex, 20 do
  9042. -- widgets[i]:Hide()
  9043. -- end
  9044. end
  9045. end
  9046.  
  9047. --quantidade de quest para a faccao
  9048. configTable.factionFrame.amount = factionAmountForEachMap [mapId]
  9049. end
  9050.  
  9051. if (WorldQuestTracker.WorldMap_GoldIndicator) then
  9052. WorldQuestTracker.WorldMap_GoldIndicator.text = floor (total_Gold / 10000)
  9053. WorldQuestTracker.WorldMap_ResourceIndicator.text = WorldQuestTracker.ToK (total_Resources)
  9054. WorldQuestTracker.WorldMap_APowerIndicator.text = WorldQuestTracker.ToK (total_APower)
  9055. WorldQuestTracker.WorldMap_APowerIndicator.Amount = total_APower
  9056.  
  9057. if (hasArtifactUnderpower) then
  9058. WorldQuestTracker.WorldMap_APowerIndicator.textcolor = "darkorange"
  9059. end
  9060. end
  9061.  
  9062. if (needAnotherUpdate) then
  9063. if (WorldMapFrame:IsShown()) then
  9064. WorldQuestTracker.ScheduleWorldMapUpdate (1.5)
  9065. WorldQuestTracker.PlayLoadingAnimation()
  9066. end
  9067. else
  9068. if (WorldQuestTracker.QueuedRefresh > 0) then
  9069. WorldQuestTracker.ScheduleWorldMapUpdate (1.5)
  9070. WorldQuestTracker.QueuedRefresh = WorldQuestTracker.QueuedRefresh - 1
  9071. else
  9072. if (WorldQuestTracker.IsPlayingLoadAnimation()) then
  9073. WorldQuestTracker.StopLoadingAnimation()
  9074. end
  9075. end
  9076. end
  9077. if (showFade) then
  9078. worldFramePOIs.fadeInAnimation:Play()
  9079. end
  9080. if (availableQuests == 0 and (WorldQuestTracker.InitAt or 0) + 10 > GetTime()) then
  9081. WorldQuestTracker.ScheduleWorldMapUpdate()
  9082. end
  9083.  
  9084. --> update na ancora caso foi de window mode para fullscreen
  9085. WorldQuestTracker.UpdateAllWorldMapAnchors()
  9086.  
  9087. WorldQuestTracker.HideZoneWidgets()
  9088. WorldQuestTracker.SavedQuestList_CleanUp()
  9089.  
  9090. calcPerformance.DumpTime = 0
  9091. end
  9092.  
  9093. --quando clicar no bot�o de por o world map em fullscreen ou window mode, reajustar a posi��o dos widgets
  9094. WorldMapFrameSizeDownButton:HookScript ("OnClick", function() --window mode
  9095. if (WorldQuestTracker.UpdateWorldQuestsOnWorldMap) then
  9096. if (GetCurrentMapAreaID() == MAPID_BROKENISLES) then
  9097. WorldQuestTracker.UpdateWorldQuestsOnWorldMap (false, true)
  9098. WorldQuestTracker.RefreshStatusBar()
  9099. C_Timer.After (1, WorldQuestTracker.RefreshStatusBar)
  9100. end
  9101. end
  9102. end)
  9103. WorldMapFrameSizeUpButton:HookScript ("OnClick", function() --full screen
  9104. if (WorldQuestTracker.UpdateWorldQuestsOnWorldMap) then
  9105. if (GetCurrentMapAreaID() == MAPID_BROKENISLES) then
  9106. WorldQuestTracker.UpdateWorldQuestsOnWorldMap (false, true)
  9107. C_Timer.After (1, WorldQuestTracker.RefreshStatusBar)
  9108. end
  9109. end
  9110. end)
  9111.  
  9112. --atualiza a quantidade de alpha nos widgets que mostram quantas quests ha para a fac��o
  9113. function WorldQuestTracker.UpdateFactionAlpha()
  9114. for _, factionFrame in ipairs (faction_frames) do
  9115. if (factionFrame.enabled) then
  9116. factionFrame:SetAlpha (1)
  9117. else
  9118. factionFrame:SetAlpha (.65)
  9119. end
  9120. end
  9121. end
  9122.  
  9123. function WorldQuestTracker.UpdateLoadingIconAnchor()
  9124. local adjust_anchor = false
  9125. if (GetCVarBool ("questLogOpen")) then
  9126. if (WorldMapFrame_InWindowedMode()) then
  9127. adjust_anchor = true
  9128. end
  9129. end
  9130.  
  9131. if (adjust_anchor) then
  9132. WorldQuestTracker.LoadingAnimation:SetPoint ("bottom", WorldMapScrollFrame, "top", 0, -75)
  9133. else
  9134. WorldQuestTracker.LoadingAnimation:SetPoint ("bottom", WorldMapScrollFrame, "top", 0, -75)
  9135. end
  9136. end
  9137. function WorldQuestTracker.NeedUpdateLoadingIconAnchor()
  9138. if (WorldQuestTracker.LoadingAnimation.FadeIN:IsPlaying()) then
  9139. WorldQuestTracker.UpdateLoadingIconAnchor()
  9140. elseif (WorldQuestTracker.LoadingAnimation.FadeOUT:IsPlaying()) then
  9141. WorldQuestTracker.UpdateLoadingIconAnchor()
  9142. elseif (WorldQuestTracker.LoadingAnimation.Loop:IsPlaying()) then
  9143. WorldQuestTracker.UpdateLoadingIconAnchor()
  9144. end
  9145. end
  9146. hooksecurefunc ("QuestMapFrame_Open", function()
  9147. WorldQuestTracker.NeedUpdateLoadingIconAnchor()
  9148. end)
  9149. hooksecurefunc ("QuestMapFrame_Close", function()
  9150. WorldQuestTracker.NeedUpdateLoadingIconAnchor()
  9151. end)
  9152.  
  9153. --C_Timer.NewTicker (5, function()WorldQuestTracker.PlayLoadingAnimation()end)
  9154. function WorldQuestTracker.CreateLoadingIcon()
  9155. local f = CreateFrame ("frame", nil, WorldMapFrame)
  9156. f:SetSize (48, 48)
  9157. f:SetPoint ("bottom", WorldMapScrollFrame, "top", 0, -75) --289/2 = 144
  9158. f:SetFrameLevel (3000)
  9159.  
  9160. local animGroup1 = f:CreateAnimationGroup()
  9161. local anim1 = animGroup1:CreateAnimation ("Alpha")
  9162. anim1:SetOrder (1)
  9163. anim1:SetFromAlpha (0)
  9164. anim1:SetToAlpha (1)
  9165. anim1:SetDuration (2)
  9166. f.FadeIN = animGroup1
  9167.  
  9168. local animGroup2 = f:CreateAnimationGroup()
  9169. local anim2 = animGroup2:CreateAnimation ("Alpha")
  9170. f.FadeOUT = animGroup2
  9171. anim2:SetOrder (2)
  9172. anim2:SetFromAlpha (1)
  9173. anim2:SetToAlpha (0)
  9174. anim2:SetDuration (4)
  9175. animGroup2:SetScript ("OnFinished", function()
  9176. f:Hide()
  9177. end)
  9178.  
  9179. f.Text = f:CreateFontString (nil, "overlay", "GameFontNormal")
  9180. f.Text:SetText ("please wait...")
  9181. f.Text:SetPoint ("left", f, "right", -5, 1)
  9182. f.TextBackground = f:CreateTexture (nil, "background")
  9183. f.TextBackground:SetPoint ("left", f, "right", -20, 0)
  9184. f.TextBackground:SetSize (160, 14)
  9185. f.TextBackground:SetTexture ([[Interface\COMMON\ShadowOverlay-Left]])
  9186.  
  9187. f.Text:Hide()
  9188. f.TextBackground:Hide()
  9189.  
  9190. f.CircleAnimStatic = CreateFrame ("frame", nil, f)
  9191. f.CircleAnimStatic:SetAllPoints()
  9192. f.CircleAnimStatic.Alpha = f.CircleAnimStatic:CreateTexture (nil, "overlay")
  9193. f.CircleAnimStatic.Alpha:SetTexture ([[Interface\COMMON\StreamFrame]])
  9194. f.CircleAnimStatic.Alpha:SetAllPoints()
  9195. f.CircleAnimStatic.Background = f.CircleAnimStatic:CreateTexture (nil, "background")
  9196. f.CircleAnimStatic.Background:SetTexture ([[Interface\COMMON\StreamBackground]])
  9197. f.CircleAnimStatic.Background:SetAllPoints()
  9198.  
  9199. f.CircleAnim = CreateFrame ("frame", nil, f)
  9200. f.CircleAnim:SetAllPoints()
  9201. f.CircleAnim.Spinner = f.CircleAnim:CreateTexture (nil, "artwork")
  9202. f.CircleAnim.Spinner:SetTexture ([[Interface\COMMON\StreamCircle]])
  9203. f.CircleAnim.Spinner:SetVertexColor (.5, 1, .5, 1)
  9204. f.CircleAnim.Spinner:SetAllPoints()
  9205. f.CircleAnim.Spark = f.CircleAnim:CreateTexture (nil, "overlay")
  9206. f.CircleAnim.Spark:SetTexture ([[Interface\COMMON\StreamSpark]])
  9207. f.CircleAnim.Spark:SetAllPoints()
  9208.  
  9209. local animGroup3 = f.CircleAnim:CreateAnimationGroup()
  9210. animGroup3:SetLooping ("Repeat")
  9211. local animLoop = animGroup3:CreateAnimation ("Rotation")
  9212. f.Loop = animGroup3
  9213. animLoop:SetOrder (1)
  9214. animLoop:SetDuration (6)
  9215. animLoop:SetDegrees (-360)
  9216. animLoop:SetTarget (f.CircleAnim)
  9217.  
  9218. WorldQuestTracker.LoadingAnimation = f
  9219. WorldQuestTracker.UpdateLoadingIconAnchor()
  9220.  
  9221. f:Hide()
  9222. end
  9223.  
  9224. function WorldQuestTracker.IsPlayingLoadAnimation()
  9225. return WorldQuestTracker.LoadingAnimation.IsPlaying
  9226. end
  9227. function WorldQuestTracker.PlayLoadingAnimation()
  9228. if (not WorldQuestTracker.IsPlayingLoadAnimation()) then
  9229. WorldQuestTracker.LoadingAnimation:Show()
  9230. WorldQuestTracker.LoadingAnimation.FadeIN:Play()
  9231. WorldQuestTracker.LoadingAnimation.Loop:Play()
  9232. WorldQuestTracker.LoadingAnimation.IsPlaying = true
  9233. end
  9234. end
  9235. function WorldQuestTracker.StopLoadingAnimation()
  9236. WorldQuestTracker.LoadingAnimation.FadeOUT:Play()
  9237. WorldQuestTracker.LoadingAnimation.IsPlaying = false
  9238. end
  9239.  
  9240.  
  9241. ----------------------------------------------------------------------------------------------------------------------------------------------------------------
  9242. --> faction bounty
  9243.  
  9244. --coloca a quantidade de quests completas para cada fac��o em cima do icone da fac��o
  9245. function WorldQuestTracker.SetBountyAmountCompleted (self, numCompleted, numTotal)
  9246. if (not self.objectiveCompletedText) then
  9247. self.objectiveCompletedText = self:CreateFontString (nil, "overlay", "GameFontNormal")
  9248. self.objectiveCompletedText:SetPoint ("bottom", self, "top", 1, 0)
  9249. self.objectiveCompletedBackground = self:CreateTexture (nil, "background")
  9250. self.objectiveCompletedBackground:SetPoint ("bottom", self, "top", 0, -1)
  9251. self.objectiveCompletedBackground:SetTexture ([[Interface\AddOns\WorldQuestTracker\media\background_blackgradientT]])
  9252. self.objectiveCompletedBackground:SetSize (42, 12)
  9253. end
  9254. if (numCompleted) then
  9255. self.objectiveCompletedText:SetText (numCompleted .. "/" .. numTotal)
  9256. self.objectiveCompletedBackground:SetAlpha (.4)
  9257. else
  9258. self.objectiveCompletedText:SetText ("")
  9259. self.objectiveCompletedBackground:SetAlpha (0)
  9260. end
  9261. end
  9262.  
  9263. --quando selecionar uma fac��o, atualizar todas as quests no world map para que seja atualiza a quiantidade de quests que ha em cada mapa para esta fac�ao
  9264. hooksecurefunc (WorldMapFrame.UIElementsFrame.BountyBoard, "SetSelectedBountyIndex", function (self)
  9265. if (WorldMapFrame.mapID == MAPID_BROKENISLES) then
  9266. WorldQuestTracker.UpdateWorldQuestsOnWorldMap (false, false, false, true)
  9267. end
  9268. end)
  9269.  
  9270. --> do not switch the map if we are in the world map
  9271. --world quest tracker is replacing the function "FindBestMapForSelectedBounty"
  9272. --if you need to use this function, call directly from the mixin: WorldMapBountyBoardMixin.FindBestMapForSelectedBounty
  9273. --or WorldQuestTrackerAddon.FindBestMapForSelectedBounty_Original()
  9274.  
  9275. WorldQuestTracker.FindBestMapForSelectedBounty_Original = WorldMapFrame.UIElementsFrame.BountyBoard.FindBestMapForSelectedBounty
  9276. WorldMapFrame.UIElementsFrame.BountyBoard.FindBestMapForSelectedBounty = function()end
  9277.  
  9278. hooksecurefunc (WorldMapFrame.UIElementsFrame.BountyBoard, "OnTabClick", function (...)
  9279. if (WorldQuestTrackerAddon.GetCurrentZoneType() == "zone") then
  9280. WorldQuestTracker.FindBestMapForSelectedBounty_Original (...)
  9281. WorldQuestTracker.LastMapID = GetCurrentMapAreaID()
  9282. C_Timer.After (1, WorldQuestTracker.UpdateZoneWidgets)
  9283. end
  9284. end)
  9285.  
  9286. hooksecurefunc (WorldMapFrame.UIElementsFrame.BountyBoard, "AnchorBountyTab", function (self, tab)
  9287. local bountyData = self.bounties [tab.bountyIndex]
  9288. if (bountyData) then
  9289. local numCompleted, numTotal = self:CalculateBountySubObjectives (bountyData)
  9290. if (numCompleted and numTotal) then
  9291. WorldQuestTracker.SetBountyAmountCompleted (tab, numCompleted, numTotal)
  9292. end
  9293. else
  9294. WorldQuestTracker.SetBountyAmountCompleted (tab, false)
  9295. end
  9296. end)
  9297.  
  9298. -- doq dow endf
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement