Advertisement
Wetxius

Untitled

May 6th, 2016
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 7.36 KB | None | 0 0
  1. local T, C, L, _ = unpack(select(2, ...))
  2.  
  3. ----------------------------------------------------------------------------------------
  4. -- Move ObjectiveTrackerFrame
  5. ----------------------------------------------------------------------------------------
  6. local frame = CreateFrame("Frame", "ObjectiveTrackerAnchor", UIParent)
  7. frame:SetPoint(unpack(C.position.quest))
  8. frame:SetHeight(150)
  9. frame:SetWidth(224)
  10.  
  11. ObjectiveTrackerFrame:ClearAllPoints()
  12. ObjectiveTrackerFrame:SetPoint("TOPLEFT", frame, "TOPLEFT", 20, 0)
  13. ObjectiveTrackerFrame:SetHeight(T.getscreenheight / 1.6)
  14.  
  15. hooksecurefunc(ObjectiveTrackerFrame, "SetPoint", function(_, _, parent)
  16. if parent ~= frame then
  17. ObjectiveTrackerFrame:ClearAllPoints()
  18. ObjectiveTrackerFrame:SetPoint("TOPLEFT", frame, "TOPLEFT", 20, 0)
  19. end
  20. end)
  21.  
  22. for _, headerName in pairs({"QuestHeader", "AchievementHeader", "ScenarioHeader"}) do
  23. ObjectiveTrackerFrame.BlocksFrame[headerName].Background:Hide()
  24. end
  25. BONUS_OBJECTIVE_TRACKER_MODULE.Header.Background:Hide()
  26.  
  27. ObjectiveTrackerFrame.HeaderMenu.Title:SetAlpha(0)
  28. OBJECTIVE_TRACKER_DOUBLE_LINE_HEIGHT = 30
  29.  
  30. -- Kill reward animation when finished dungeon or bonus objectives
  31. local HiddenFrame = CreateFrame("Frame")
  32. HiddenFrame:Hide()
  33. ObjectiveTrackerScenarioRewardsFrame.Show = T.dummy
  34. -- ObjectiveTrackerBonusRewardsFrame.Show = T.dummy
  35. hooksecurefunc("BonusObjectiveTracker_AnimateReward", function()
  36. ObjectiveTrackerBonusRewardsFrame:SetParent(HiddenFrame)
  37. end)
  38.  
  39. ----------------------------------------------------------------------------------------
  40. -- Skin ObjectiveTrackerFrame item buttons
  41. ----------------------------------------------------------------------------------------
  42. hooksecurefunc(QUEST_TRACKER_MODULE, "SetBlockHeader", function(_, block)
  43. local item = block.itemButton
  44.  
  45. if item and not item.skinned then
  46. item:SetSize(C.actionbar.button_size, C.actionbar.button_size)
  47. item:SetTemplate("Default")
  48. item:StyleButton()
  49.  
  50. item:SetNormalTexture(nil)
  51.  
  52. item.icon:SetTexCoord(0.1, 0.9, 0.1, 0.9)
  53. item.icon:SetPoint("TOPLEFT", item, 2, -2)
  54. item.icon:SetPoint("BOTTOMRIGHT", item, -2, 2)
  55.  
  56. item.Cooldown:SetAllPoints(item.icon)
  57.  
  58. item.Count:ClearAllPoints()
  59. item.Count:SetPoint("TOPLEFT", 1, -1)
  60. item.Count:SetFont(C.font.action_bars_font, C.font.action_bars_font_size, C.font.action_bars_font_style)
  61. item.Count:SetShadowOffset(C.font.action_bars_font_shadow and 1 or 0, C.font.action_bars_font_shadow and -1 or 0)
  62.  
  63. item.skinned = true
  64. end
  65. end)
  66.  
  67. ----------------------------------------------------------------------------------------
  68. -- Difficulty color for ObjectiveTrackerFrame lines
  69. ----------------------------------------------------------------------------------------
  70. hooksecurefunc(QUEST_TRACKER_MODULE, "Update", function()
  71. for i = 1, GetNumQuestWatches() do
  72. local questID, _, questIndex = GetQuestWatchInfo(i)
  73. if not questID then
  74. break
  75. end
  76. local _, level = GetQuestLogTitle(questIndex)
  77. local col = GetQuestDifficultyColor(level)
  78. local block = QUEST_TRACKER_MODULE:GetExistingBlock(questID)
  79. if block then
  80. block.HeaderText:SetTextColor(col.r, col.g, col.b)
  81. block.HeaderText.col = col
  82. end
  83. end
  84. end)
  85.  
  86. hooksecurefunc(DEFAULT_OBJECTIVE_TRACKER_MODULE, "AddObjective", function(self, block)
  87. if block.module == ACHIEVEMENT_TRACKER_MODULE then
  88. block.HeaderText:SetTextColor(0.75, 0.61, 0)
  89. block.HeaderText.col = nil
  90. end
  91. end)
  92.  
  93. hooksecurefunc("ObjectiveTrackerBlockHeader_OnLeave", function(self)
  94. local block = self:GetParent()
  95. if block.HeaderText.col then
  96. block.HeaderText:SetTextColor(block.HeaderText.col.r, block.HeaderText.col.g, block.HeaderText.col.b)
  97. end
  98. end)
  99.  
  100. ----------------------------------------------------------------------------------------
  101. -- Skin ObjectiveTrackerFrame.HeaderMenu.MinimizeButton
  102. ----------------------------------------------------------------------------------------
  103. if C.skins.blizzard_frames == true then
  104. local button = ObjectiveTrackerFrame.HeaderMenu.MinimizeButton
  105. button:SetSize(17, 17)
  106. button:StripTextures()
  107. button:SetTemplate("Overlay")
  108.  
  109. button.minus = button:CreateTexture(nil, "OVERLAY")
  110. button.minus:SetSize(5, 1)
  111. button.minus:SetPoint("CENTER")
  112. button.minus:SetTexture(C.media.blank)
  113.  
  114. button.plus = button:CreateTexture(nil, "OVERLAY")
  115. button.plus:SetSize(1, 5)
  116. button.plus:SetPoint("CENTER")
  117. button.plus:SetTexture(C.media.blank)
  118.  
  119. button:HookScript("OnEnter", T.SetModifiedBackdrop)
  120. button:HookScript("OnLeave", T.SetOriginalBackdrop)
  121.  
  122. button.plus:Hide()
  123. hooksecurefunc("ObjectiveTracker_Collapse", function()
  124. button.plus:Show()
  125. end)
  126.  
  127. hooksecurefunc("ObjectiveTracker_Expand", function()
  128. button.plus:Hide()
  129. end)
  130. end
  131.  
  132. ----------------------------------------------------------------------------------------
  133. -- Auto collapse ObjectiveTrackerFrame
  134. ----------------------------------------------------------------------------------------
  135. if C.automation.auto_collapse_reload then
  136. local collapse = CreateFrame("Frame")
  137. collapse:RegisterEvent("PLAYER_ENTERING_WORLD")
  138. collapse:SetScript("OnEvent", function(self, event)
  139. ObjectiveTracker_Collapse()
  140. end)
  141. end
  142.  
  143. ----------------------------------------------------------------------------------------
  144. -- Mouseover for ObjectiveTrackerFrame.HeaderMenu.MinimizeButton
  145. ----------------------------------------------------------------------------------------
  146. if C.misc.minimize_mouseover then
  147. local MinimizeButton = ObjectiveTrackerFrame.HeaderMenu.MinimizeButton
  148. MinimizeButton:SetAlpha(0)
  149. MinimizeButton:HookScript("OnEnter", function() MinimizeButton:SetAlpha(1) end)
  150. MinimizeButton:HookScript("OnLeave", function() MinimizeButton:SetAlpha(0) end)
  151. end
  152.  
  153. ----------------------------------------------------------------------------------------
  154. -- Skin bonus objective progress bar
  155. ----------------------------------------------------------------------------------------
  156. hooksecurefunc(BONUS_OBJECTIVE_TRACKER_MODULE, "AddProgressBar", function(self, block, line)
  157. local progressBar = line.ProgressBar
  158. local bar = progressBar.Bar
  159. local icon = bar.Icon
  160.  
  161. if not progressBar.styled then
  162. local label = bar.Label
  163.  
  164. bar.BarFrame:Hide()
  165. bar.BarGlow:Kill()
  166. bar.IconBG:Kill()
  167. bar:SetSize(200, 20)
  168. bar:SetStatusBarTexture(C.media.texture)
  169. bar:SetTemplate("Transparent")
  170. bar:SetBackdropColor(0, 0, 0, 0)
  171.  
  172. label:ClearAllPoints()
  173. label:SetPoint("CENTER", 0, -1)
  174. label:SetFont(C.media.pixel_font, C.media.pixel_font_size, C.media.pixel_font_style)
  175.  
  176. icon:SetPoint("RIGHT", 24, 0)
  177. icon:SetSize(20, 20)
  178.  
  179. local border = CreateFrame("Frame", "$parentBorder", bar)
  180. border:SetAllPoints(icon)
  181. border:SetTemplate("Transparent")
  182. border:SetBackdropColor(0, 0, 0, 0)
  183. bar.newIconBg = border
  184.  
  185. BonusObjectiveTrackerProgressBar_PlayFlareAnim = T.dummy
  186. progressBar.styled = true
  187. end
  188.  
  189. bar.newIconBg:SetShown(icon:IsShown())
  190. end)
  191.  
  192. local function IsFramePositionedLeft(frame)
  193. local x = frame:GetCenter()
  194. local screenWidth = GetScreenWidth()
  195. local screenHeight = GetScreenHeight()
  196. local positionedLeft = false
  197.  
  198. if x and x < (screenWidth / 2) then
  199. positionedLeft = true
  200. end
  201.  
  202. return positionedLeft
  203. end
  204.  
  205. hooksecurefunc("BonusObjectiveTracker_ShowRewardsTooltip", function(block)
  206. if IsFramePositionedLeft(ObjectiveTrackerFrame) then
  207. GameTooltip:ClearAllPoints()
  208. GameTooltip:SetPoint("TOPLEFT", block, "TOPRIGHT", 0, 0)
  209. end
  210. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement