vanilla-wow-addons – Blame information for rev 1
?pathlinks?
Rev | Author | Line No. | Line |
---|---|---|---|
1 | office | 1 | |
2 | UBERQUEST_VERSION = "Reborn 1.11.9" |
||
3 | |||
4 | UIPanelWindows["UberQuest_List"] = {area = "doublewide", pushable = 997} |
||
5 | BINDING_HEADER_UBERQUEST_SEP = "Uber Quest Reborn" |
||
6 | BINDING_NAME_UBERQUEST_CONFIG = BINDING_NAME_UBERQUEST_CONFIG |
||
7 | BINDING_NAME_UBERQUEST_CONFIG2 = BINDING_NAME_UBERQUEST_CONFIG2 |
||
8 | |||
9 | UBERQUEST_QUESTS_DISPLAYED = 22 |
||
10 | UBERQUEST_QUESTLINE_HEIGHT = 16 |
||
11 | |||
12 | UberQuest_Player = nil --global |
||
13 | UberQuest_Minion_ColorPicker = { r = 1, g = 1, b = 1 } -- global |
||
14 | UBERQUEST_MINIONSCALE = 100 |
||
15 | local UberQuest_Config_Loaded = nil |
||
16 | local UberQuest_ThereAreQuests = nil |
||
17 | local UberQuest_MinionSetOnce = nil |
||
18 | local UberQuest_QuestTitles = nil |
||
19 | local UberQuest_SelectedQuest = nil |
||
20 | local UberQuest_ActivityTracker = {} |
||
21 | local UberQuest_GotFullList = nil |
||
22 | local UberQuest_DelayedConfigInit = nil |
||
23 | local UberQuest_InfoRequested = {} |
||
24 | local UberQuest_WatchTextIndex = 1 |
||
25 | |||
26 | UberQuestDetails = { |
||
27 | name = "UberQuest", |
||
28 | version = UBERQUEST_VERSION, |
||
29 | releaseDate = "2006.08.22", |
||
30 | author = "Saien (Modded by BanMan)", |
||
31 | email = "Woosleyt@gmail.com", |
||
32 | website = "http://ui.worldofwar.net/ui.php?id=2780", |
||
33 | category = MYADDONS_CATEGORY_QUESTS |
||
34 | } |
||
35 | |||
36 | |||
37 | |||
38 | function UberQuest_Minion_Reset() |
||
39 | UberQuest_Minion:ClearAllPoints() |
||
40 | UberQuest_Minion:SetPoint("CENTER","UIParent","CENTER",0,0) |
||
41 | if (not UberQuest_Minion:IsVisible()) then |
||
42 | UberQuest_MinionShowHide() |
||
43 | end |
||
44 | end |
||
45 | |||
46 | local function UberQuest_Items_Update(questState) |
||
47 | local isQuestLog = 0 |
||
48 | if (questState == "UberQuest_Details_ScrollChild_") then -- that's one change |
||
49 | isQuestLog = 1 |
||
50 | end |
||
51 | local numQuestRewards |
||
52 | local numQuestChoices |
||
53 | local numQuestSpellRewards = 0 |
||
54 | local money |
||
55 | local spacerFrame |
||
56 | if (isQuestLog == 1) then |
||
57 | numQuestRewards = GetNumQuestLogRewards() |
||
58 | numQuestChoices = GetNumQuestLogChoices() |
||
59 | if ( GetQuestLogRewardSpell() ) then |
||
60 | numQuestSpellRewards = 1 |
||
61 | end |
||
62 | money = GetQuestLogRewardMoney() |
||
63 | spacerFrame = UberQuest_Details_ScrollChild_SpacerFrame -- that's two! |
||
64 | -- All this crap copied for TWO changes. |
||
65 | else |
||
66 | numQuestRewards = GetNumQuestRewards() |
||
67 | numQuestChoices = GetNumQuestChoices() |
||
68 | if ( GetRewardSpell() ) then |
||
69 | numQuestSpellRewards = 1 |
||
70 | end |
||
71 | money = GetRewardMoney() |
||
72 | spacerFrame = QuestSpacerFrame |
||
73 | end |
||
74 | |||
75 | local totalRewards = numQuestRewards + numQuestChoices + numQuestSpellRewards |
||
76 | local questItemName = questState.."Item" |
||
77 | local material = QuestFrame_GetMaterial() |
||
78 | local questItemReceiveText = getglobal(questState.."ItemReceiveText") |
||
79 | if (totalRewards == 0 and money == 0) then |
||
80 | getglobal(questState.."RewardTitleText"):Hide() |
||
81 | else |
||
82 | getglobal(questState.."RewardTitleText"):Show() |
||
83 | QuestFrame_SetTitleTextColor(getglobal(questState.."RewardTitleText"), material) |
||
84 | QuestFrame_SetAsLastShown(getglobal(questState.."RewardTitleText"), spacerFrame) |
||
85 | end |
||
86 | if (money == 0) then |
||
87 | getglobal(questState.."MoneyFrame"):Hide() |
||
88 | else |
||
89 | getglobal(questState.."MoneyFrame"):Show() |
||
90 | QuestFrame_SetAsLastShown(getglobal(questState.."MoneyFrame"), spacerFrame) |
||
91 | MoneyFrame_Update(questState.."MoneyFrame", money) |
||
92 | end |
||
93 | |||
94 | for i=totalRewards + 1, MAX_NUM_ITEMS, 1 do |
||
95 | getglobal(questItemName..i):Hide() |
||
96 | end |
||
97 | local questItem, name, texture, quality, isUsable, numItems = 1 |
||
98 | if ( numQuestChoices > 0 ) then |
||
99 | getglobal(questState.."ItemChooseText"):Show() |
||
100 | QuestFrame_SetTextColor(getglobal(questState.."ItemChooseText"), material) |
||
101 | QuestFrame_SetAsLastShown(getglobal(questState.."ItemChooseText"), spacerFrame) |
||
102 | for i=1, numQuestChoices, 1 do |
||
103 | questItem = getglobal(questItemName..i) |
||
104 | questItem.type = "choice" |
||
105 | numItems = 1 |
||
106 | if ( isQuestLog == 1 ) then |
||
107 | name, texture, numItems, quality, isUsable = GetQuestLogChoiceInfo(i) |
||
108 | else |
||
109 | name, texture, numItems, quality, isUsable = GetQuestItemInfo(questItem.type, i) |
||
110 | end |
||
111 | questItem:SetID(i) |
||
112 | questItem:Show() |
||
113 | -- For the tooltip |
||
114 | questItem.rewardType = "item" |
||
115 | QuestFrame_SetAsLastShown(questItem, spacerFrame) |
||
116 | getglobal(questItemName..i.."Name"):SetText(name) |
||
117 | SetItemButtonCount(questItem, numItems) |
||
118 | SetItemButtonTexture(questItem, texture) |
||
119 | if ( isUsable ) then |
||
120 | SetItemButtonTextureVertexColor(questItem, 1.0, 1.0, 1.0) |
||
121 | SetItemButtonNameFrameVertexColor(questItem, 1.0, 1.0, 1.0) |
||
122 | else |
||
123 | SetItemButtonTextureVertexColor(questItem, 0.9, 0, 0) |
||
124 | SetItemButtonNameFrameVertexColor(questItem, 0.9, 0, 0) |
||
125 | end |
||
126 | if ( i > 1 ) then |
||
127 | if ( mod(i,2) == 1 ) then |
||
128 | questItem:SetPoint("TOPLEFT", questItemName..(i - 2), "BOTTOMLEFT", 0, -2) |
||
129 | else |
||
130 | questItem:SetPoint("TOPLEFT", questItemName..(i - 1), "TOPRIGHT", 1, 0) |
||
131 | end |
||
132 | else |
||
133 | questItem:SetPoint("TOPLEFT", questState.."ItemChooseText", "BOTTOMLEFT", -3, -5) |
||
134 | end |
||
135 | |||
136 | end |
||
137 | else |
||
138 | getglobal(questState.."ItemChooseText"):Hide() |
||
139 | end |
||
140 | local rewardsCount = 0 |
||
141 | if ( numQuestRewards > 0 or money > 0 or numQuestSpellRewards > 0) then |
||
142 | QuestFrame_SetTextColor(questItemReceiveText, material) |
||
143 | -- Anchor the reward text differently if there are choosable rewards |
||
144 | if ( numQuestChoices > 0 ) then |
||
145 | questItemReceiveText:SetText(TEXT(REWARD_ITEMS)) |
||
146 | local index = numQuestChoices |
||
147 | if ( mod(index, 2) == 0 ) then |
||
148 | index = index - 1 |
||
149 | end |
||
150 | questItemReceiveText:SetPoint("TOPLEFT", questItemName..index, "BOTTOMLEFT", 3, -5) |
||
151 | else |
||
152 | questItemReceiveText:SetText(TEXT(REWARD_ITEMS_ONLY)) |
||
153 | questItemReceiveText:SetPoint("TOPLEFT", questState.."RewardTitleText", "BOTTOMLEFT", 3, -5) |
||
154 | end |
||
155 | questItemReceiveText:Show() |
||
156 | QuestFrame_SetAsLastShown(questItemReceiveText, spacerFrame) |
||
157 | -- Setup mandatory rewards |
||
158 | for i=1, numQuestRewards, 1 do |
||
159 | questItem = getglobal(questItemName..(i + numQuestChoices)) |
||
160 | questItem.type = "reward" |
||
161 | numItems = 1 |
||
162 | if ( isQuestLog == 1 ) then |
||
163 | name, texture, numItems, quality, isUsable = GetQuestLogRewardInfo(i) |
||
164 | else |
||
165 | name, texture, numItems, quality, isUsable = GetQuestItemInfo(questItem.type, i) |
||
166 | end |
||
167 | questItem:SetID(i) |
||
168 | questItem:Show() |
||
169 | -- For the tooltip |
||
170 | questItem.rewardType = "item" |
||
171 | QuestFrame_SetAsLastShown(questItem, spacerFrame) |
||
172 | getglobal(questItemName..(i + numQuestChoices).."Name"):SetText(name) |
||
173 | SetItemButtonCount(questItem, numItems) |
||
174 | SetItemButtonTexture(questItem, texture) |
||
175 | if ( isUsable ) then |
||
176 | SetItemButtonTextureVertexColor(questItem, 1.0, 1.0, 1.0) |
||
177 | SetItemButtonNameFrameVertexColor(questItem, 1.0, 1.0, 1.0) |
||
178 | else |
||
179 | SetItemButtonTextureVertexColor(questItem, 0.5, 0, 0) |
||
180 | SetItemButtonNameFrameVertexColor(questItem, 1.0, 0, 0) |
||
181 | end |
||
182 | |||
183 | if ( i > 1 ) then |
||
184 | if ( mod(i,2) == 1 ) then |
||
185 | questItem:SetPoint("TOPLEFT", questItemName..((i + numQuestChoices) - 2), "BOTTOMLEFT", 0, -2) |
||
186 | else |
||
187 | questItem:SetPoint("TOPLEFT", questItemName..((i + numQuestChoices) - 1), "TOPRIGHT", 1, 0) |
||
188 | end |
||
189 | else |
||
190 | questItem:SetPoint("TOPLEFT", questState.."ItemReceiveText", "BOTTOMLEFT", -3, -5) |
||
191 | end |
||
192 | rewardsCount = rewardsCount + 1 |
||
193 | end |
||
194 | -- Setup spell reward |
||
195 | if ( numQuestSpellRewards > 0 ) then |
||
196 | if ( isQuestLog == 1 ) then |
||
197 | texture, name = GetQuestLogRewardSpell() |
||
198 | else |
||
199 | texture, name = GetRewardSpell() |
||
200 | end |
||
201 | questItem = getglobal(questItemName..(rewardsCount + numQuestChoices + 1)) |
||
202 | questItem:Show() |
||
203 | -- For the tooltip |
||
204 | questItem.rewardType = "spell" |
||
205 | SetItemButtonCount(questItem, 0) |
||
206 | SetItemButtonTexture(questItem, texture) |
||
207 | getglobal(questItemName..(rewardsCount + numQuestChoices + 1).."Name"):SetText(name) |
||
208 | if ( rewardsCount > 0 ) then |
||
209 | if ( mod(rewardsCount,2) == 0 ) then |
||
210 | questItem:SetPoint("TOPLEFT", questItemName..((rewardsCount + numQuestChoices) - 1), "BOTTOMLEFT", 0, -2) |
||
211 | else |
||
212 | questItem:SetPoint("TOPLEFT", questItemName..((rewardsCount + numQuestChoices)), "TOPRIGHT", 1, 0) |
||
213 | end |
||
214 | else |
||
215 | questItem:SetPoint("TOPLEFT", questState.."ItemReceiveText", "BOTTOMLEFT", -3, -5) |
||
216 | end |
||
217 | end |
||
218 | else |
||
219 | questItemReceiveText:Hide() |
||
220 | end |
||
221 | if ( questState == "QuestReward" ) then |
||
222 | QuestFrameCompleteQuestButton:Enable() |
||
223 | QuestFrameRewardPanel.itemChoice = 0 |
||
224 | QuestRewardItemHighlight:Hide() |
||
225 | end |
||
226 | end |
||
227 | |||
228 | local function UberQuest_Details_Update() |
||
229 | local questID = GetQuestLogSelection() |
||
230 | local questTitle = GetQuestLogTitle(questID) |
||
231 | if ( not questTitle ) then |
||
232 | questTitle = "" |
||
233 | end |
||
234 | if ( IsCurrentQuestFailed() ) then |
||
235 | questTitle = questTitle.." - ("..TEXT(FAILED)..")" |
||
236 | end |
||
237 | UberQuest_Details_ScrollChild_QuestTitle:SetText(questTitle) |
||
238 | |||
239 | local questDescription |
||
240 | local questObjectives |
||
241 | questDescription, questObjectives = GetQuestLogQuestText() |
||
242 | UberQuest_Details_ScrollChild_ObjectivesText:SetText(questObjectives) |
||
243 | |||
244 | local questTimer = GetQuestLogTimeLeft() |
||
245 | if ( questTimer ) then |
||
246 | UberQuest_Details.hasTimer = 1 |
||
247 | UberQuest_Details.timePassed = 0 |
||
248 | UberQuest_Details_ScrollChild_TimerText:Show() |
||
249 | UberQuest_Details_ScrollChild_TimerText:SetText(TEXT(TIME_REMAINING).." "..SecondsToTime(questTimer)) |
||
250 | UberQuest_Details_ScrollChild_Objective1:SetPoint("TOPLEFT", "UberQuest_Details_ScrollChild_TimerText", "BOTTOMLEFT", 0, -10) |
||
251 | else |
||
252 | UberQuest_Details.hasTimer = nil |
||
253 | UberQuest_Details_ScrollChild_TimerText:Hide() |
||
254 | UberQuest_Details_ScrollChild_Objective1:SetPoint("TOPLEFT", "UberQuest_Details_ScrollChild_ObjectivesText", "BOTTOMLEFT", 0, -10) |
||
255 | end |
||
256 | |||
257 | local numObjectives = GetNumQuestLeaderBoards() |
||
258 | for i=1, numObjectives, 1 do |
||
259 | local string = getglobal("UberQuest_Details_ScrollChild_Objective"..i) |
||
260 | local text |
||
261 | local type |
||
262 | local finished |
||
263 | text, type, finished = GetQuestLogLeaderBoard(i) |
||
264 | if ( not text or strlen(text) == 0 ) then |
||
265 | text = type |
||
266 | end |
||
267 | if ( finished ) then |
||
268 | string:SetTextColor(0.2, 0.2, 0.2) |
||
269 | text = text.." ("..TEXT(COMPLETE)..")" |
||
270 | else |
||
271 | string:SetTextColor(0, 0, 0) |
||
272 | end |
||
273 | string:SetText(text) |
||
274 | string:Show() |
||
275 | QuestFrame_SetAsLastShown(string,UberQuest_Details_ScrollChild_SpacerFrame) |
||
276 | end |
||
277 | |||
278 | for i=numObjectives + 1, MAX_OBJECTIVES, 1 do |
||
279 | getglobal("UberQuest_Details_ScrollChild_Objective"..i):Hide() |
||
280 | end |
||
281 | |||
282 | -- If there's money required then anchor and display it |
||
283 | if ( GetQuestLogRequiredMoney() > 0 ) then |
||
284 | if ( numObjectives > 0 ) then |
||
285 | UberQuest_Details_ScrollChild_RequiredMoneyText:SetPoint("TOPLEFT", "UberQuest_Details_ScrollChild_Objective"..numObjectives, "BOTTOMLEFT", 0, -4) |
||
286 | else |
||
287 | UberQuest_Details_ScrollChild_RequiredMoneyText:SetPoint("TOPLEFT", "UberQuest_Details_ScrollChild_ObjectivesText", "BOTTOMLEFT", 0, -10) |
||
288 | end |
||
289 | |||
290 | MoneyFrame_Update("UberQuest_Details_ScrollChild_RequiredMoneyFrame", GetQuestLogRequiredMoney()) |
||
291 | |||
292 | if ( GetQuestLogRequiredMoney() > GetMoney() ) then |
||
293 | -- Not enough money |
||
294 | UberQuest_Details_ScrollChild_RequiredMoneyText:SetTextColor(0, 0, 0) |
||
295 | SetMoneyFrameColor("UberQuest_Details_ScrollChild_RequiredMoneyFrame", 1.0, 0.1, 0.1) |
||
296 | else |
||
297 | UberQuest_Details_ScrollChild_RequiredMoneyText:SetTextColor(0.2, 0.2, 0.2) |
||
298 | SetMoneyFrameColor("UberQuest_Details_ScrollChild_RequiredMoneyFrame", 1.0, 1.0, 1.0) |
||
299 | end |
||
300 | UberQuest_Details_ScrollChild_RequiredMoneyText:Show() |
||
301 | UberQuest_Details_ScrollChild_RequiredMoneyFrame:Show() |
||
302 | else |
||
303 | UberQuest_Details_ScrollChild_RequiredMoneyText:Hide() |
||
304 | UberQuest_Details_ScrollChild_RequiredMoneyFrame:Hide() |
||
305 | end |
||
306 | |||
307 | if ( GetQuestLogRequiredMoney() > 0 ) then |
||
308 | UberQuest_Details_ScrollChild_DescriptionTitle:SetPoint("TOPLEFT", "UberQuest_Details_ScrollChild_RequiredMoneyText", "BOTTOMLEFT", 0, -10) |
||
309 | elseif ( numObjectives > 0 ) then |
||
310 | UberQuest_Details_ScrollChild_DescriptionTitle:SetPoint("TOPLEFT", "UberQuest_Details_ScrollChild_Objective"..numObjectives, "BOTTOMLEFT", 0, -10) |
||
311 | else |
||
312 | if ( questTimer ) then |
||
313 | UberQuest_Details_ScrollChild_DescriptionTitle:SetPoint("TOPLEFT", "UberQuest_Details_ScrollChild_TimerText", "BOTTOMLEFT", 0, -10) |
||
314 | else |
||
315 | UberQuest_Details_ScrollChild_DescriptionTitle:SetPoint("TOPLEFT", "UberQuest_Details_ScrollChild_ObjectivesText", "BOTTOMLEFT", 0, -10) |
||
316 | end |
||
317 | end |
||
318 | if ( questDescription ) then |
||
319 | UberQuest_Details_ScrollChild_QuestDescription:SetText(questDescription) |
||
320 | QuestFrame_SetAsLastShown(UberQuest_Details_ScrollChild_QuestDescription,UberQuest_Details_ScrollChild_SpacerFrame) |
||
321 | end |
||
322 | local numRewards = GetNumQuestLogRewards() |
||
323 | local numChoices = GetNumQuestLogChoices() |
||
324 | local money = GetQuestLogRewardMoney() |
||
325 | |||
326 | if ( (numRewards + numChoices + money) > 0 ) then |
||
327 | UberQuest_Details_ScrollChild_RewardTitleText:Show() |
||
328 | QuestFrame_SetAsLastShown(UberQuest_Details_ScrollChild_RewardTitleText,UberQuest_Details_ScrollChild_SpacerFrame) |
||
329 | else |
||
330 | UberQuest_Details_ScrollChild_RewardTitleText:Hide() |
||
331 | end |
||
332 | |||
333 | UberQuest_Items_Update("UberQuest_Details_ScrollChild_") |
||
334 | UberQuest_Details_ScrollScrollBar:SetValue(0) |
||
335 | UberQuest_Details_Scroll:UpdateScrollChildRect() |
||
336 | end |
||
337 | |||
338 | local function UberQuest_List_SetSelection(questID) |
||
339 | local selectedQuest |
||
340 | if ( questID == 0 ) then |
||
341 | UberQuest_Details_Scroll:Hide() |
||
342 | return |
||
343 | end |
||
344 | UberQuest_Details_Scroll:Show() |
||
345 | |||
346 | -- Get xml id |
||
347 | local id = questID - FauxScrollFrame_GetOffset(UberQuest_List_Scroll) |
||
348 | |||
349 | UberQuest_SelectedQuest = questID |
||
350 | SelectQuestLogEntry(questID) |
||
351 | local titleButton = getglobal("UberQuest_List_Title"..id) |
||
352 | local titleButtonTag = getglobal("UberQuest_List_Title"..id.."Tag") |
||
353 | local questLogTitleText, level, questTag, isHeader, isCollapsed = GetQuestLogTitle(questID) |
||
354 | if ( isHeader ) then |
||
355 | if ( isCollapsed ) then |
||
356 | ExpandQuestHeader(questID) |
||
357 | return |
||
358 | else |
||
359 | CollapseQuestHeader(questID) |
||
360 | return |
||
361 | end |
||
362 | else |
||
363 | -- Set newly selected quest and highlight it |
||
364 | UberQuest_List.selectedButtonID = questID |
||
365 | local scrollFrameOffset = FauxScrollFrame_GetOffset(UberQuest_List_Scroll) |
||
366 | if ( questID > scrollFrameOffset and questID <= (scrollFrameOffset + UBERQUEST_QUESTS_DISPLAYED) and questID <= GetNumQuestLogEntries() ) then |
||
367 | titleButton:LockHighlight() |
||
368 | titleButtonTag:SetTextColor(HIGHLIGHT_FONT_COLOR.r, HIGHLIGHT_FONT_COLOR.g, HIGHLIGHT_FONT_COLOR.b) |
||
369 | UberQuest_List_HighlightFrame_SkillHighlight:SetVertexColor(titleButton.r, titleButton.g, titleButton.b) |
||
370 | UberQuest_List_HighlightFrame:SetPoint("TOPLEFT", "UberQuest_List_Title"..id, "TOPLEFT", 5, 0) |
||
371 | UberQuest_List_HighlightFrame:Show() |
||
372 | end |
||
373 | end |
||
374 | if ( GetQuestLogSelection() > GetNumQuestLogEntries() ) then |
||
375 | return |
||
376 | end |
||
377 | UberQuest_Details_Title:SetText ("Uber Quest ("..UBERQUEST_VERSION..")") |
||
378 | UberQuest_Details:Show() |
||
379 | UberQuest_Details_Update() |
||
380 | end |
||
381 | |||
382 | local function UberQuest_SetFirstValidSelection() |
||
383 | -- Intentionally left at QuestLog_ |
||
384 | local selectableQuest = QuestLog_GetFirstSelectableQuest() |
||
385 | UberQuest_List_SetSelection(selectableQuest) |
||
386 | end |
||
387 | |||
388 | |||
389 | local function UberQuest_ConfigInit() |
||
390 | UberQuest_Config_Loaded = 1 |
||
391 | if (not UberQuest_Config) then |
||
392 | UberQuest_Config = {} |
||
393 | UberQuest_Config.showquestlevels = 1 |
||
394 | UberQuest_Config.useminion = 1 |
||
395 | UberQuest_Config.addnewquests = 1 |
||
396 | UberQuest_Config.UberMinionScale = 100 |
||
397 | end |
||
398 | -- In General: No reason, IMO, for per-player config options since |
||
399 | -- people are going to want consistant QuestLog views anyways. Or at least I do. |
||
400 | -- The exception is for options regarding onscreen placement, and (duh) |
||
401 | -- Quests selected for minion |
||
402 | if (not UberQuest_Config[UberQuest_Player]) then |
||
403 | UberQuest_Config[UberQuest_Player] = {} |
||
404 | end |
||
405 | if (not UberQuest_Config[UberQuest_Player].selected) then |
||
406 | UberQuest_Config[UberQuest_Player].selected = {} |
||
407 | end |
||
408 | |||
409 | UberQuest_Config.speedquest = nil |
||
410 | if (UberQuest_Config.useminion) then |
||
411 | if (UberQuest_Config[UberQuest_Player].minionvisible) then |
||
412 | if (not UberQuest_Minion:IsVisible()) then |
||
413 | UberQuest_MinionShowHide() |
||
414 | end |
||
415 | end |
||
416 | if (UberQuest_Config[UberQuest_Player].lockminion) then |
||
417 | UberQuest_Minion_Move:Hide() |
||
418 | else |
||
419 | UberQuest_Minion_Move:Show() |
||
420 | end |
||
421 | if (UberQuest_Config.color and UberQuest_Config.color.r and UberQuest_Config.color.g and UberQuest_Config.color.b and UberQuest_Config.color.opacity) then |
||
422 | UberQuest_MinionBackdrop:SetBackdropColor(UberQuest_Config.color.r, UberQuest_Config.color.g, UberQuest_Config.color.b) |
||
423 | local alpha = 1.0 - UberQuest_Config.color.opacity |
||
424 | UberQuest_MinionBackdrop:SetAlpha(alpha) |
||
425 | else |
||
426 | UberQuest_MinionBackdrop:SetBackdropColor(TOOLTIP_DEFAULT_BACKGROUND_COLOR.r, TOOLTIP_DEFAULT_BACKGROUND_COLOR.g, TOOLTIP_DEFAULT_BACKGROUND_COLOR.b) |
||
427 | UberQuest_MinionBackdrop:SetAlpha(1) |
||
428 | end |
||
429 | if (UberQuest_Config[UberQuest_Player].lock and |
||
430 | UberQuest_Config[UberQuest_Player].lock.corner and |
||
431 | UberQuest_Config[UberQuest_Player].lock.pointone and |
||
432 | UberQuest_Config[UberQuest_Player].lock.pointtwo) then |
||
433 | UberQuest_Minion:ClearAllPoints() |
||
434 | UberQuest_Minion:SetPoint(UberQuest_Config[UberQuest_Player].lock.corner,"UIParent","BOTTOMLEFT",UberQuest_Config[UberQuest_Player].lock.pointone,UberQuest_Config[UberQuest_Player].lock.pointtwo) |
||
435 | end |
||
436 | |||
437 | -- Load Scale settings |
||
438 | |||
439 | if (UberQuest_Config[UberQuest_Player]["scale"]) then |
||
440 | local scale = 1 |
||
441 | scale = UberQuest_Config[UberQuest_Player]["scale"] |
||
442 | UberQuest_Minion:SetScale(UIParent:GetScale() * scale) |
||
443 | UberMinionScale:SetValue(scale * 100) |
||
444 | end |
||
445 | |||
446 | end |
||
447 | UberQuest_List_ConfigButton:Enable() |
||
448 | UberQuest_List_SummonMinion:Enable() |
||
449 | end |
||
450 | |||
451 | function UberQuest_DelayedConfigInit_OnUpdate(elapsed) |
||
452 | if (UberQuest_DelayedConfigInit) then |
||
453 | UberQuest_DelayedConfigInit = UberQuest_DelayedConfigInit - elapsed |
||
454 | if (UberQuest_DelayedConfigInit < 0) then |
||
455 | UberQuest_ConfigInit() |
||
456 | UberQuest_DelayedConfigInit = nil |
||
457 | UberQuest:Hide() |
||
458 | end |
||
459 | else -- Stop receiving OnUpdates |
||
460 | UberQuest:Hide() |
||
461 | end |
||
462 | end |
||
463 | |||
464 | function UberQuest_OnLoad() |
||
465 | this:RegisterEvent("PLAYER_ENTERING_WORLD") |
||
466 | this:RegisterEvent("QUEST_LOG_UPDATE") |
||
467 | this:RegisterEvent("PARTY_MEMBERS_CHANGED") |
||
468 | this:RegisterEvent("ADDON_LOADED") |
||
469 | |||
470 | DEFAULT_CHAT_FRAME:AddMessage("UberQuest ("..UBERQUEST_VERSION..") loaded.") |
||
471 | |||
472 | UberQuest_oldToggleQuestLog = ToggleQuestLog |
||
473 | ToggleQuestLog = UberQuest_ListShowHide |
||
474 | |||
475 | local playerName = UnitName("player") |
||
476 | if (playerName ~= UKNOWNBEING and playerName ~= UNKNOWNOBJECT) then |
||
477 | UberQuest_Player = playerName |
||
478 | end |
||
479 | end |
||
480 | |||
481 | function UberQuest_OnEvent() |
||
482 | if(event == "ADDON_LOADED" and myAddOnsFrame_Register) then |
||
483 | myAddOnsFrame_Register(UberQuestDetails) |
||
484 | end |
||
485 | if (event == "PLAYER_ENTERING_WORLD") then |
||
486 | if (UberQuest_Player and not UberQuest_Config_Loaded) then |
||
487 | UberQuest_DelayedConfigInit = 10 |
||
488 | UberQuest:Show() |
||
489 | end |
||
490 | elseif (UberQuest_Config_Loaded and event == "QUEST_LOG_UPDATE") then |
||
491 | UberQuest_List_Update() |
||
492 | if (UberQuest_Details:IsVisible()) then |
||
493 | UberQuest_Details_Update() |
||
494 | end |
||
495 | if (UberQuest_Minion:IsVisible() and UberQuest_Config[UberQuest_Player].selected) then |
||
496 | UberQuest_Minion_Update() |
||
497 | end |
||
498 | elseif ( event == "PARTY_MEMBERS_CHANGED" ) then |
||
499 | -- Pushable == Sharable. Blizzard likes things straight forward |
||
500 | if ( GetQuestLogPushable() and GetNumPartyMembers() > 0 ) then |
||
501 | UberQuest_List_ShareButton:Enable() |
||
502 | else |
||
503 | UberQuest_List_ShareButton:Disable() |
||
504 | end |
||
505 | end |
||
506 | end |
||
507 | |||
508 | function UberQuest_List_OnLoad() |
||
509 | this.selectedButtonID = 2 |
||
510 | end |
||
511 | |||
512 | function UberQuest_ListShowHide() |
||
513 | if (UberQuest_List:IsVisible()) then |
||
514 | HideUIPanel(UberQuest_List) |
||
515 | PlaySound("igQuestLogClose") |
||
516 | else |
||
517 | UberQuest_List_Title:SetText ("Uber Quest ("..UBERQUEST_VERSION..")") |
||
518 | ShowUIPanel(UberQuest_List) |
||
519 | UberQuest_List_Update() |
||
520 | PlaySound("igQuestLogOpen") |
||
521 | if (UberQuest_Details:IsVisible()) then |
||
522 | UberQuest_Details_Update() |
||
523 | end |
||
524 | end |
||
525 | end |
||
526 | |||
527 | function UberQuest_Minion_ShowHide() |
||
528 | if (UberQuest_Minion:IsVisible() and UberQuest_Config[UberQuest_Player].selected) then |
||
529 | UberQuest_Minion_Update() |
||
530 | else |
||
531 | UberQuest_Minion:Hide() |
||
532 | end |
||
533 | end |
||
534 | |||
535 | |||
536 | function UberQuest_List_Update() |
||
537 | local i |
||
538 | UberQuest_QuestTitles = {} |
||
539 | if (UberQuest_Config.useminion) then |
||
540 | UberQuest_List_SummonMinion:Show() |
||
541 | else |
||
542 | UberQuest_List_SummonMinion:Hide() |
||
543 | UberQuest_Minion:Hide() |
||
544 | end |
||
545 | -- Copied muchly from QuestLog_Update(), Blizzard code, with updates for sexual prowess. |
||
546 | local numEntries, numQuests = GetNumQuestLogEntries() |
||
547 | if ( numEntries == 0 ) then |
||
548 | --EmptyQuestLogFrame:Show() |
||
549 | UberQuest_List_AbandonButton:Disable() |
||
550 | UberQuest_List.hasTimer = nil |
||
551 | UberQuest_List_ExpandButtonFrame:Hide() |
||
552 | else |
||
553 | --EmptyQuestLogFrame:Hide() |
||
554 | UberQuest_List_AbandonButton:Enable() |
||
555 | UberQuest_List_ExpandButtonFrame:Show() |
||
556 | -- UberQuest_Details_Title:SetText ("Uber Quest ("..UBERQUEST_VERSION..")") |
||
557 | -- UberQuest_Details:Show() |
||
558 | -- UberQuest_Details_Update() |
||
559 | end |
||
560 | -- Update Quest Count |
||
561 | UberQuest_List_QuestCount:SetText(format(QUEST_LOG_COUNT_TEMPLATE, numQuests, MAX_QUESTLOG_QUESTS)) |
||
562 | UberQuest_List_CountMiddle:SetWidth(UberQuest_List_QuestCount:GetWidth()) |
||
563 | |||
564 | -- ScrollFrame update |
||
565 | FauxScrollFrame_Update(UberQuest_List_Scroll, numEntries, UBERQUEST_QUESTS_DISPLAYED, UBERQUEST_QUESTLINE_HEIGHT, nil, nil, nil, UberQuest_List_HighlightFrame, 293, 316 ) |
||
566 | |||
567 | if (numQuests and numQuests > 0) then |
||
568 | local i |
||
569 | for i=1, numEntries, 1 do |
||
570 | local index = i |
||
571 | local quest, level, questTag, isHeader, isCollapsed = GetQuestLogTitle(i) |
||
572 | if (quest and not isHeader) then |
||
573 | if (UberQuest_GotFullList and UberQuest_Config.addnewquests and not UberQuest_ActivityTracker[quest]) then |
||
574 | UberQuest_Config[UberQuest_Player].selected[quest] = 1 |
||
575 | end |
||
576 | if (not UberQuest_ActivityTracker[quest]) then |
||
577 | UberQuest_ActivityTracker[quest] = {} |
||
578 | end |
||
579 | end |
||
580 | end |
||
581 | if (UberQuest_ActivityTracker ~= {}) then |
||
582 | UberQuest_GotFullList = true |
||
583 | end |
||
584 | end |
||
585 | local numPartyMembers = GetNumPartyMembers() |
||
586 | -- Update the quest listing |
||
587 | UberQuest_List_HighlightFrame:Hide() |
||
588 | for i=1, UBERQUEST_QUESTS_DISPLAYED, 1 do |
||
589 | local questIndex = i + FauxScrollFrame_GetOffset(UberQuest_List_Scroll) |
||
590 | local questLogTitle = getglobal("UberQuest_List_Title"..i) |
||
591 | local questTitleTag = getglobal("UberQuest_List_Title"..i.."Tag") |
||
592 | local questNormalText = getglobal("UberQuest_List_Title"..i.."NormalText") |
||
593 | local questHighlightText = getglobal("UberQuest_List_Title"..i.."NormalText") |
||
594 | local questDisabledText = getglobal("UberQuest_List_Title"..i.."NormalText") |
||
595 | local questNumGroupMates = getglobal("UberQuest_List_Title"..i.."GroupMates") |
||
596 | if ( questIndex <= numEntries ) then |
||
597 | local questLogTitleText, level, questTag, isHeader, isCollapsed, isComplete = GetQuestLogTitle(questIndex) |
||
598 | local color |
||
599 | if ( isHeader ) then |
||
600 | if ( questLogTitleText ) then |
||
601 | questLogTitle:SetText(questLogTitleText) |
||
602 | else |
||
603 | questLogTitle:SetText("") |
||
604 | end |
||
605 | |||
606 | if ( isCollapsed ) then |
||
607 | questLogTitle:SetNormalTexture("Interface\\Buttons\\UI-PlusButton-Up") |
||
608 | else |
||
609 | questLogTitle:SetNormalTexture("Interface\\Buttons\\UI-MinusButton-Up") |
||
610 | end |
||
611 | questNumGroupMates:SetText("") |
||
612 | getglobal("UberQuest_List_Title"..i.."Highlight"):SetTexture("Interface\\Buttons\\UI-PlusButton-Hilight") |
||
613 | getglobal("UberQuest_List_Title"..i.."_MinionSelect"):Hide() |
||
614 | else |
||
615 | UberQuest_QuestTitles[i] = questLogTitleText |
||
616 | if (UberQuest_Config.useminion) then |
||
617 | getglobal("UberQuest_List_Title"..i.."_MinionSelect"):Show() |
||
618 | getglobal("UberQuest_List_Title"..i.."_MinionSelect"):SetChecked(UberQuest_Config[UberQuest_Player].selected[questLogTitleText]) |
||
619 | else |
||
620 | getglobal("UberQuest_List_Title"..i.."_MinionSelect"):Hide() |
||
621 | end |
||
622 | |||
623 | if ( UberQuest_Config.showquestlevels == 1 ) then |
||
624 | if ( questTag == ELITE ) then |
||
625 | questLogTitle:SetText(" ["..level.."+] "..questLogTitleText) |
||
626 | else |
||
627 | |||
628 | if ( questTag == RAID or questTag == "Schlachtzug" ) then |
||
629 | questLogTitle:SetText(" ["..level.."R] "..questLogTitleText) |
||
630 | |||
631 | else |
||
632 | if ( questTag == "Dungeon" or questTag == "Donjon" or questTag == "Instanz" ) then |
||
633 | questLogTitle:SetText(" ["..level.."D] "..questLogTitleText) |
||
634 | else |
||
635 | if ( questTag == "PvP" ) then |
||
636 | questLogTitle:SetText(" ["..level.."P] "..questLogTitleText) |
||
637 | else |
||
638 | questLogTitle:SetText(" ["..level.."] "..questLogTitleText) |
||
639 | end |
||
640 | end |
||
641 | end |
||
642 | end |
||
643 | |||
644 | |||
645 | else |
||
646 | questLogTitle:SetText(" "..questLogTitleText) |
||
647 | |||
648 | |||
649 | end |
||
650 | |||
651 | questLogTitle:SetNormalTexture("") |
||
652 | getglobal("UberQuest_List_Title"..i.."Highlight"):SetTexture("") |
||
653 | local partyMembersOnQuest = 0 |
||
654 | for j=1, numPartyMembers do |
||
655 | local isOnQuest = IsUnitOnQuest(questIndex, "party"..j) |
||
656 | if ( isOnQuest and isOnQuest == 1 ) then |
||
657 | partyMembersOnQuest = partyMembersOnQuest + 1 |
||
658 | end |
||
659 | end |
||
660 | if ( partyMembersOnQuest > 0 ) then |
||
661 | questNumGroupMates:SetText("["..partyMembersOnQuest.."]") |
||
662 | else |
||
663 | questNumGroupMates:SetText("") |
||
664 | end |
||
665 | end |
||
666 | -- Set the quest tag |
||
667 | if ( isComplete ) then |
||
668 | questTag = COMPLETE |
||
669 | end |
||
670 | if ( questTag ) then |
||
671 | questTitleTag:SetText("("..questTag..")") |
||
672 | -- Shrink text to accomdate quest tags without wrapping |
||
673 | -- This is just wrong, so very very wrong. |
||
674 | -- (Elite) is coming out at width 80 |
||
675 | if (questTag == "Elite" or questTag == "Raid" or questTag == "Fertig" or questTag == "PvP" ) then |
||
676 | questNormalText:SetWidth(225) |
||
677 | elseif (questTag == "Complete" or questTag == "Dungeon" or questTag == "Instanz") then |
||
678 | questHighlightText:SetWidth(225) |
||
679 | questDisabledText:SetWidth(225) |
||
680 | elseif (questTag == "Schlachtzug") then |
||
681 | questNormalText:SetWidth(205) |
||
682 | questHighlightText:SetWidth(205) |
||
683 | questDisabledText:SetWidth(205) |
||
684 | else |
||
685 | questNormalText:SetWidth(275 - 5 - questTitleTag:GetWidth()) |
||
686 | questHighlightText:SetWidth(275 - 5 - questTitleTag:GetWidth()) |
||
687 | questDisabledText:SetWidth(275 - 5 - questTitleTag:GetWidth()) |
||
688 | end |
||
689 | else |
||
690 | questTitleTag:SetText("") |
||
691 | -- Reset to max text width |
||
692 | questNormalText:SetWidth(275) |
||
693 | questHighlightText:SetWidth(275) |
||
694 | questDisabledText:SetWidth(275) |
||
695 | end |
||
696 | |||
697 | -- Color the quest title and highlight according to the difficulty level |
||
698 | local playerLevel = UnitLevel("player") |
||
699 | if ( isHeader ) then |
||
700 | color = QuestDifficultyColor["header"] |
||
701 | else |
||
702 | color = GetDifficultyColor(level) |
||
703 | end |
||
704 | questTitleTag:SetTextColor(color.r, color.g, color.b) |
||
705 | questLogTitle:SetTextColor(color.r, color.g, color.b) |
||
706 | questNumGroupMates:SetTextColor(color.r, color.g, color.b) |
||
707 | questLogTitle.r = color.r |
||
708 | questLogTitle.g = color.g |
||
709 | questLogTitle.b = color.b |
||
710 | questLogTitle:Show() |
||
711 | |||
712 | -- Place the highlight and lock the highlight state |
||
713 | if ( UberQuest_List.selectedButtonID and GetQuestLogSelection() == questIndex ) then |
||
714 | UberQuest_List_HighlightFrame:SetPoint("TOPLEFT", "UberQuest_List_Title"..i, "TOPLEFT", 0, 0) |
||
715 | UberQuest_List_HighlightFrame:Show() |
||
716 | questTitleTag:SetTextColor(HIGHLIGHT_FONT_COLOR.r, HIGHLIGHT_FONT_COLOR.g, HIGHLIGHT_FONT_COLOR.b) |
||
717 | questLogTitle:LockHighlight() |
||
718 | else |
||
719 | questLogTitle:UnlockHighlight() |
||
720 | end |
||
721 | else |
||
722 | questLogTitle:Hide() |
||
723 | end |
||
724 | end |
||
725 | |||
726 | -- Set the expand/collapse all button texture |
||
727 | local numHeaders = 0 |
||
728 | local notExpanded = 0 |
||
729 | -- Somewhat redundant loop, but cleaner than the alternatives |
||
730 | for i=1, numEntries, 1 do |
||
731 | local index = i |
||
732 | local questLogTitleText, level, questTag, isHeader, isCollapsed = GetQuestLogTitle(i) |
||
733 | if ( questLogTitleText and isHeader ) then |
||
734 | numHeaders = numHeaders + 1 |
||
735 | if ( isCollapsed ) then |
||
736 | notExpanded = notExpanded + 1 |
||
737 | end |
||
738 | end |
||
739 | end |
||
740 | -- If all headers are not expanded then show collapse button, otherwise show the expand button |
||
741 | if ( notExpanded ~= numHeaders ) then |
||
742 | UberQuest_List_ExpandButtonFrame_CollapseAllButton.collapsed = nil |
||
743 | UberQuest_List_ExpandButtonFrame_CollapseAllButton:SetNormalTexture("Interface\\Buttons\\UI-MinusButton-Up") |
||
744 | else |
||
745 | UberQuest_List_ExpandButtonFrame_CollapseAllButton.collapsed = 1 |
||
746 | UberQuest_List_ExpandButtonFrame_CollapseAllButton:SetNormalTexture("Interface\\Buttons\\UI-PlusButton-Up") |
||
747 | end |
||
748 | |||
749 | -- Update Quest Count |
||
750 | UberQuest_List_QuestCount:SetText(format(QUEST_LOG_COUNT_TEMPLATE, numQuests, MAX_QUESTLOG_QUESTS)) |
||
751 | UberQuest_List_CountMiddle:SetWidth(UberQuest_List_QuestCount:GetWidth()) |
||
752 | |||
753 | -- If no selection then set it to the first available quest |
||
754 | if ( GetQuestLogSelection() == 0 ) then |
||
755 | UberQuest_SetFirstValidSelection() |
||
756 | end |
||
757 | |||
758 | -- Determine whether the selected quest is pushable or not |
||
759 | if ( numEntries == 0 ) then |
||
760 | UberQuest_List_ShareButton:Disable() |
||
761 | elseif ( GetQuestLogPushable() and GetNumPartyMembers() > 0 ) then |
||
762 | UberQuest_List_ShareButton:Enable() |
||
763 | else |
||
764 | UberQuest_List_ShareButton:Disable() |
||
765 | end |
||
766 | end |
||
767 | |||
768 | function UberQuest_DetailsShowHide() |
||
769 | if (UberQuest_Details:IsVisible()) then |
||
770 | UberQuest_Details:Hide() |
||
771 | else |
||
772 | UberQuest_Details_Title:SetText ("Uber Quest ("..UBERQUEST_VERSION..")") |
||
773 | UberQuest_Details:Show() |
||
774 | UberQuest_Details_Update() |
||
775 | end |
||
776 | end |
||
777 | |||
778 | function UberQuest_ConfigShowHide() |
||
779 | if (UberQuest_ConfigFrame:IsVisible()) then |
||
780 | UberQuest_ConfigFrame:Hide() |
||
781 | else |
||
782 | UberQuest_ConfigFrame:Show() |
||
783 | UberQuest_Config_Update() |
||
784 | end |
||
785 | end |
||
786 | |||
787 | function UberQuest_Config_Update() |
||
788 | UberQuest_ConfigFrame_ShowQuestLevels:SetChecked(UberQuest_Config.showquestlevels) |
||
789 | UberQuest_ConfigFrame_UseMinion:SetChecked(UberQuest_Config.useminion) |
||
790 | UberQuest_ConfigFrame_LockMinion:SetChecked(UberQuest_Config[UberQuest_Player].lockminion) |
||
791 | UberQuest_ConfigFrame_MinionAddNew:SetChecked(UberQuest_Config.addnewquests) |
||
792 | UberQuest_ConfigFrame_ColorizeObjective:SetChecked(UberQuest_Config[UberQuest_Player].colorizeobjectives) |
||
793 | UberQuest_ConfigFrame_ExpireObjective:SetChecked(UberQuest_Config[UberQuest_Player].expireobjectives) -- EMERALD |
||
794 | UberQuest_ConfigFrame_ExpireQuest:SetChecked(UberQuest_Config[UberQuest_Player].expirequests) -- EMERALD |
||
795 | UberQuest_ConfigFrame_ToggleMinionText:SetChecked(UberQuest_Config[UberQuest_Player].hidetext) -- D.I. |
||
796 | |||
797 | if (UberQuest_Config.useminion) then |
||
798 | UberQuest_ConfigFrame_LockMinion:Enable() |
||
799 | UberQuest_ConfigFrame_MinionAddNew:Enable() |
||
800 | UberQuest_ConfigFrame_ColorizeObjective:Enable() |
||
801 | UberQuest_ConfigFrame_ExpireObjective:Enable() -- EMERALD |
||
802 | UberQuest_ConfigFrame_ExpireQuest:Enable() -- EMERALD |
||
803 | else |
||
804 | UberQuest_ConfigFrame_LockMinion:Disable() |
||
805 | UberQuest_ConfigFrame_MinionAddNew:Disable() |
||
806 | UberQuest_ConfigFrame_ColorizeObjective:Disable() |
||
807 | UberQuest_ConfigFrame_ExpireObjective:Disable() -- EMERALD |
||
808 | UberQuest_ConfigFrame_ExpireQuest:Disable() -- EMERALD |
||
809 | end |
||
810 | |||
811 | if (UberQuest_Config.color and UberQuest_Config.color.r and UberQuest_Config.color.g and UberQuest_Config.color.b and UberQuest_Config.color.opacity) then |
||
812 | UberQuest_Minion_ColorPicker = { r = UberQuest_Config.color.r, |
||
813 | g = UberQuest_Config.color.g, |
||
814 | b = UberQuest_Config.color.b } |
||
815 | UberQuest_ConfigFrame_BGColorSwatchBg:SetVertexColor(UberQuest_Config.color.r, |
||
816 | UberQuest_Config.color.g, |
||
817 | UberQuest_Config.color.b) |
||
818 | else |
||
819 | UberQuest_Minion_ColorPicker = { r = TOOLTIP_DEFAULT_BACKGROUND_COLOR.r, |
||
820 | g = TOOLTIP_DEFAULT_BACKGROUND_COLOR.g, |
||
821 | b = TOOLTIP_DEFAULT_BACKGROUND_COLOR.b } |
||
822 | UberQuest_ConfigFrame_BGColorSwatchBg:SetVertexColor(TOOLTIP_DEFAULT_BACKGROUND_COLOR.r, |
||
823 | TOOLTIP_DEFAULT_BACKGROUND_COLOR.g, |
||
824 | TOOLTIP_DEFAULT_BACKGROUND_COLOR.b) |
||
825 | end |
||
826 | end |
||
827 | |||
828 | function UberQuest_Minion_OnOff(val) |
||
829 | if (val) then |
||
830 | else |
||
831 | if (UberQuest_Minion:IsVisible()) then |
||
832 | UberQuest_MinionShowHide() |
||
833 | end |
||
834 | end |
||
835 | end |
||
836 | |||
837 | function UberQuest_MinionSelect_OnClick() |
||
838 | if (UberQuest_QuestTitles[this:GetParent():GetID()]) then |
||
839 | if (this:GetChecked()) then |
||
840 | UberQuest_Config[UberQuest_Player].selected[UberQuest_QuestTitles[this:GetParent():GetID()]] = 1 |
||
841 | else |
||
842 | UberQuest_Config[UberQuest_Player].selected[UberQuest_QuestTitles[this:GetParent():GetID()]] = nil |
||
843 | end |
||
844 | if (UberQuest_Minion:IsVisible()) then |
||
845 | UberQuest_Minion_Update() |
||
846 | end |
||
847 | end |
||
848 | end |
||
849 | |||
850 | function UberQuest_MinionShowHide() |
||
851 | if (UberQuest_Config and UberQuest_Player and UberQuest_Config[UberQuest_Player]) then |
||
852 | if (UberQuest_Minion:IsVisible()) then |
||
853 | UberQuest_Minion:Hide() |
||
854 | UberQuest_List_SummonMinion:SetText(UBERQUEST_SUMMONMINION) |
||
855 | UberQuest_Config[UberQuest_Player].minionvisible = nil |
||
856 | else |
||
857 | UberQuest_Minion:Show() |
||
858 | UberQuest_List_SummonMinion:SetText(UBERQUEST_DISMISSMINION) |
||
859 | UberQuest_Minion_Update() |
||
860 | UberQuest_Config[UberQuest_Player].minionvisible = 1 |
||
861 | end |
||
862 | end |
||
863 | end |
||
864 | |||
865 | function UberQuest_Minion_Update() |
||
866 | local function ConvertColorFormat(color) |
||
867 | local function dec2hex(decnum) |
||
868 | if (decnum == 0) then return "00" end |
||
869 | local hexnum="" |
||
870 | local tempval |
||
871 | decnum = 255*decnum |
||
872 | if ((decnum-math.floor(decnum)) > 0) then |
||
873 | decnum = decnum + 1 |
||
874 | end |
||
875 | decnum = math.floor(decnum) |
||
876 | while (decnum ~= 0) do |
||
877 | tempval = math.mod(decnum,16) |
||
878 | if (tempval > 9) then |
||
879 | tempval = string.char(tempval + 55) |
||
880 | end |
||
881 | hexnum = tempval..hexnum |
||
882 | decnum = math.floor(decnum / 16) |
||
883 | if (decnum < 16) then |
||
884 | if (decnum > 9) then |
||
885 | decnum = string.char(decnum + 55) |
||
886 | end |
||
887 | hexnum = decnum..hexnum |
||
888 | decnum = 0 |
||
889 | end |
||
890 | end |
||
891 | return hexnum |
||
892 | end |
||
893 | return (dec2hex(color.r)..dec2hex(color.g)..dec2hex(color.b)) |
||
894 | end |
||
895 | local function DifficultyColor(now,max) |
||
896 | local startrange = QuestDifficultyColor["impossible"] |
||
897 | local midrange = QuestDifficultyColor["difficult"] |
||
898 | local endrange = QuestDifficultyColor["standard"] |
||
899 | now = tonumber(now) |
||
900 | max = tonumber(max) |
||
901 | if (not now or now == 0 or now > max) then |
||
902 | return ConvertColorFormat(startrange) |
||
903 | elseif (now == (max / 2)) then |
||
904 | return ConvertColorFormat(midrange) |
||
905 | elseif (now == max) then |
||
906 | return ConvertColorFormat(endrange) |
||
907 | elseif (now <= (max / 2)) then |
||
908 | local color = {} |
||
909 | local percent = now / max |
||
910 | color.r = startrange.r |
||
911 | color.g = startrange.g + ((midrange.g - startrange.g) * percent) |
||
912 | color.b = startrange.b - ((startrange.b - midrange.b) * percent) |
||
913 | return ConvertColorFormat(color) |
||
914 | else |
||
915 | local color = {} |
||
916 | local percent = now / max |
||
917 | color.r = midrange.r - ((midrange.r - endrange.r) * percent) |
||
918 | color.g = midrange.g - ((midrange.g - endrange.g) * percent) |
||
919 | color.b = midrange.b + ((endrange.b - midrange.b) * percent) |
||
920 | return ConvertColorFormat(color) |
||
921 | end |
||
922 | end |
||
923 | local applytext = "" |
||
924 | local questlist = {} |
||
925 | local i = 1 |
||
926 | local j |
||
927 | if (UberQuest_Config and UberQuest_Player and UberQuest_Config[UberQuest_Player] and UberQuest_Config[UberQuest_Player].selected and UberQuest_Config[UberQuest_Player].selected ~= {}) then |
||
928 | local category = nil |
||
929 | local questLogTitleText, level, questTag, isHeader, isCollapsed, isComplete = GetQuestLogTitle(i) |
||
930 | while (questLogTitleText) do |
||
931 | if (isHeader) then |
||
932 | category = questLogTitleText |
||
933 | elseif (UberQuest_Config[UberQuest_Player].selected[questLogTitleText]) then |
||
934 | questlist[questLogTitleText] = i |
||
935 | UberQuests_ThereAreQuests = 1 |
||
936 | |||
937 | --[[ |
||
938 | |||
939 | if (applytext ~= "") then |
||
940 | applytext = applytext.."\n" |
||
941 | end |
||
942 | local color = ConvertColorFormat(GetDifficultyColor(level)) |
||
943 | |||
944 | -- Better Questlevels to Minion |
||
945 | |||
946 | if ( UberQuest_Config.showquestlevels == 1 ) then |
||
947 | if ( questTag == ELITE ) then |
||
948 | applytext = applytext.."|cff"..color.."["..level.."+] "..questLogTitleText.."|r" |
||
949 | else |
||
950 | |||
951 | if ( questTag == RAID or questTag == "Schlachtzug") then |
||
952 | applytext = applytext.."|cff"..color.."["..level.."R] "..questLogTitleText.."|r" |
||
953 | |||
954 | else |
||
955 | if ( questTag == "Dungeon" or questTag == "Donjon" or questTag == "Instanz") then |
||
956 | applytext = applytext.."|cff"..color.."["..level.."D] "..questLogTitleText.."|r" |
||
957 | else |
||
958 | if ( questTag == "PvP") then |
||
959 | applytext = applytext.."|cff"..color.."["..level.."P] "..questLogTitleText.."|r" |
||
960 | else |
||
961 | applytext = applytext.."|cff"..color.."["..level.."] "..questLogTitleText.."|r" |
||
962 | end |
||
963 | end |
||
964 | end |
||
965 | end |
||
966 | |||
967 | else |
||
968 | |||
969 | applytext = applytext.."|cff"..color..questLogTitleText.."|r" |
||
970 | |||
971 | end |
||
972 | |||
973 | if (isComplete) then |
||
974 | color = ConvertColorFormat(QuestDifficultyColor["header"]) |
||
975 | applytext = applytext.." |cff"..color.."("..UBERQUEST_QCOMPLETE..")|r" |
||
976 | else |
||
977 | ]]-- |
||
978 | |||
979 | -- EMERALD START |
||
980 | local color = ConvertColorFormat(GetDifficultyColor(level)) |
||
981 | |||
982 | if (isComplete) then |
||
983 | if (not UberQuest_Config[UberQuest_Player].expirequests) then |
||
984 | if (applytext ~= "") then |
||
985 | applytext = applytext.."\n" |
||
986 | end |
||
987 | if (UberQuest_Config.showquestlevels ==1) then |
||
988 | |||
989 | if ( questTag == ELITE ) then |
||
990 | applytext = applytext.."|cff"..color.."["..level.."+] "..questLogTitleText.."|r" |
||
991 | else |
||
992 | |||
993 | if ( questTag == RAID or questTag == "Schlachtzug") then |
||
994 | applytext = applytext.."|cff"..color.."["..level.."R] "..questLogTitleText.."|r" |
||
995 | |||
996 | else |
||
997 | if ( questTag == "Dungeon" or questTag == "Donjon" or questTag == "Instanz") then |
||
998 | applytext = applytext.."|cff"..color.."["..level.."D] "..questLogTitleText.."|r" |
||
999 | else |
||
1000 | if ( questTag == "PvP") then |
||
1001 | applytext = applytext.."|cff"..color.."["..level.."P] "..questLogTitleText.."|r" |
||
1002 | else |
||
1003 | applytext = applytext.."|cff"..color.."["..level.."] "..questLogTitleText.."|r" |
||
1004 | end |
||
1005 | end |
||
1006 | end |
||
1007 | end |
||
1008 | |||
1009 | end |
||
1010 | color = ConvertColorFormat(QuestDifficultyColor["header"]) |
||
1011 | applytext = applytext.." |cff"..color.."("..UBERQUEST_QCOMPLETE..")|r" |
||
1012 | end |
||
1013 | else |
||
1014 | if (applytext ~= "") then |
||
1015 | applytext = applytext.."\n" |
||
1016 | end |
||
1017 | if (UberQuest_Config.showquestlevels) then |
||
1018 | if ( questTag == ELITE ) then |
||
1019 | applytext = applytext.."|cff"..color.."["..level.."+] "..questLogTitleText.."|r" |
||
1020 | else |
||
1021 | |||
1022 | if ( questTag == RAID or questTag == "Schlachtzug") then |
||
1023 | applytext = applytext.."|cff"..color.."["..level.."R] "..questLogTitleText.."|r" |
||
1024 | else |
||
1025 | if ( questTag == "Dungeon" or questTag == "Donjon" or questTag == "Instanz") then |
||
1026 | applytext = applytext.."|cff"..color.."["..level.."D] "..questLogTitleText.."|r" |
||
1027 | else |
||
1028 | if ( questTag == "PvP") then |
||
1029 | applytext = applytext.."|cff"..color.."["..level.."P] "..questLogTitleText.."|r" |
||
1030 | else |
||
1031 | applytext = applytext.."|cff"..color.."["..level.."] "..questLogTitleText.."|r" |
||
1032 | end |
||
1033 | end |
||
1034 | end |
||
1035 | end |
||
1036 | else |
||
1037 | applytext = applytext.."|cff"..color..questLogTitleText.."|r" |
||
1038 | |||
1039 | end -- EMERALD END |
||
1040 | |||
1041 | |||
1042 | SelectQuestLogEntry(i) |
||
1043 | for j = 1, GetNumQuestLeaderBoards(), 1 do |
||
1044 | local text, typ, finished = GetQuestLogLeaderBoard(j) |
||
1045 | if ( not text or strlen(text) == 0 ) then |
||
1046 | text = typ |
||
1047 | end |
||
1048 | if (finished) then -- EMERALD START |
||
1049 | if (not UberQuest_Config[UberQuest_Player].expireobjectives) then |
||
1050 | color = ConvertColorFormat(QuestDifficultyColor["header"]) |
||
1051 | applytext = applytext.."\n |cff"..color..text.." ("..UBERQUEST_QCOMPLETE..")|r" |
||
1052 | end |
||
1053 | else -- EMERALD END |
||
1054 | local item, now, max |
||
1055 | for item, now, max in string.gfind(text,"([^:]+): (%d+)/(%d+)$") do |
||
1056 | if (item and now and max) then |
||
1057 | if (UberQuest_Config[UberQuest_Player].colorizeobjectives) then |
||
1058 | color = DifficultyColor(now,max) |
||
1059 | else |
||
1060 | color = "ffffff" |
||
1061 | end |
||
1062 | |||
1063 | end |
||
1064 | end |
||
1065 | applytext = applytext.."\n |cff"..color..text.."|r" |
||
1066 | end |
||
1067 | end |
||
1068 | end |
||
1069 | end |
||
1070 | i = i + 1 |
||
1071 | questLogTitleText, level, questTag, isHeader, isCollapsed, isComplete = GetQuestLogTitle(i) |
||
1072 | end |
||
1073 | if (applytext == "") then |
||
1074 | if (UberQuest_Config[UberQuest_Player].hidetext) then |
||
1075 | UberQuest_Minion_Text:SetText("") |
||
1076 | else |
||
1077 | UberQuest_Minion_Text:SetText(UBERQUEST_MINION_NOQUESTS) |
||
1078 | end |
||
1079 | else |
||
1080 | UberQuest_Minion_Text:SetText(applytext) |
||
1081 | end |
||
1082 | if (UberQuests_ThereAreQuests) then |
||
1083 | for i in UberQuest_Config[UberQuest_Player].selected do |
||
1084 | if (not questlist[i]) then |
||
1085 | UberQuest_Config[UberQuest_Player].selected[i] = nil |
||
1086 | UberQuest_ActivityTracker[i] = nil |
||
1087 | end |
||
1088 | end |
||
1089 | end |
||
1090 | else |
||
1091 | if (UberQuest_Config[UberQuest_Player].hidetext) then |
||
1092 | UberQuest_Minion_Text:SetText("") |
||
1093 | else |
||
1094 | UberQuest_Minion_Text:SetText(UBERQUEST_MINION_NOQUESTS) |
||
1095 | end |
||
1096 | end |
||
1097 | if (UberQuest_SelectedQuest) then |
||
1098 | SelectQuestLogEntry(UberQuest_SelectedQuest) |
||
1099 | end |
||
1100 | local width = UberQuest_Minion_Text:GetWidth() + 15 |
||
1101 | local height = UberQuest_Minion_Text:GetHeight() + 15 |
||
1102 | if (width < 100) then width = 100 end |
||
1103 | if (height < 30) then height = 30 end |
||
1104 | if (UberQuest_MinionSetOnce) then |
||
1105 | -- Running this before the Width and Height are set at least once always |
||
1106 | -- screws up the corner locking. |
||
1107 | UberQuest_Minion_LockCornerForGrowth() |
||
1108 | end |
||
1109 | UberQuest_MinionSetOnce = 1 |
||
1110 | UberQuest_Minion:SetWidth(width) |
||
1111 | UberQuest_Minion:SetHeight(height) |
||
1112 | end |
||
1113 | |||
1114 | function UberQuest_Minion_LockCornerForGrowth() |
||
1115 | local Left = UberQuest_Minion:GetLeft() |
||
1116 | local Right = UberQuest_Minion:GetRight() |
||
1117 | local Top = UberQuest_Minion:GetTop() |
||
1118 | local Bottom = UberQuest_Minion:GetBottom() |
||
1119 | local lock |
||
1120 | local pointone |
||
1121 | local pointtwo |
||
1122 | local TOPBOTTOM_MEDIAN = 384 |
||
1123 | local LEFTRIGHT_MEDIAN = 512 |
||
1124 | if (Left and Right and Top and Bottom) then |
||
1125 | if (Bottom < TOPBOTTOM_MEDIAN and Top > TOPBOTTOM_MEDIAN) then |
||
1126 | local topcross = Top - TOPBOTTOM_MEDIAN |
||
1127 | local bottomcross = TOPBOTTOM_MEDIAN - Bottom |
||
1128 | if (bottomcross > topcross) then |
||
1129 | lock = "BOTTOM" |
||
1130 | pointtwo = Bottom |
||
1131 | else |
||
1132 | lock = "TOP" |
||
1133 | pointtwo = Top |
||
1134 | end |
||
1135 | elseif (Top > TOPBOTTOM_MEDIAN) then |
||
1136 | lock = "TOP" |
||
1137 | pointtwo = Top |
||
1138 | elseif (Bottom < TOPBOTTOM_MEDIAN) then |
||
1139 | lock = "BOTTOM" |
||
1140 | pointtwo = Bottom |
||
1141 | end |
||
1142 | if (Left < LEFTRIGHT_MEDIAN and Right > LEFTRIGHT_MEDIAN) then |
||
1143 | -- Minion crossed the LEFT/RIGHT median |
||
1144 | local leftcross = LEFTRIGHT_MEDIAN - Left |
||
1145 | local rightcross = Right - LEFTRIGHT_MEDIAN |
||
1146 | if (rightcross > leftcross) then |
||
1147 | lock = lock.."RIGHT" |
||
1148 | pointone = Right |
||
1149 | else |
||
1150 | lock = lock.."LEFT" |
||
1151 | pointone = Left |
||
1152 | end |
||
1153 | elseif (Left < LEFTRIGHT_MEDIAN) then |
||
1154 | lock = lock.."LEFT" |
||
1155 | pointone = Left |
||
1156 | elseif (Right > LEFTRIGHT_MEDIAN) then |
||
1157 | lock = lock.."RIGHT" |
||
1158 | pointone = Right |
||
1159 | end |
||
1160 | if (lock and lock ~= "" and pointone and pointtwo) then |
||
1161 | UberQuest_Minion:ClearAllPoints() |
||
1162 | UberQuest_Minion:SetPoint(lock,"UIParent","BOTTOMLEFT",pointone,pointtwo) |
||
1163 | UberQuest_Config[UberQuest_Player].lock = {} |
||
1164 | UberQuest_Config[UberQuest_Player].lock.corner = lock |
||
1165 | UberQuest_Config[UberQuest_Player].lock.pointone = pointone |
||
1166 | UberQuest_Config[UberQuest_Player].lock.pointtwo = pointtwo |
||
1167 | elseif (UberQuests_ThereAreQuests and |
||
1168 | UberQuest_Config[UberQuest_Player].lock and |
||
1169 | UberQuest_Config[UberQuest_Player].lock.corner and |
||
1170 | UberQuest_Config[UberQuest_Player].lock.pointone and |
||
1171 | UberQuest_Config[UberQuest_Player].lock.pointtwo) then |
||
1172 | UberQuest_Minion:ClearAllPoints() |
||
1173 | UberQuest_Minion:SetPoint(UberQuest_Config[UberQuest_Player].lock.corner,"UIParent","BOTTOMLEFT",UberQuest_Config[UberQuest_Player].lock.pointone,UberQuest_Config[UberQuest_Player].lock.pointtwo) |
||
1174 | end |
||
1175 | end |
||
1176 | end |
||
1177 | |||
1178 | function UberQuest_TitleButton_OnClick(button) |
||
1179 | if ( button == "LeftButton" ) then |
||
1180 | if ( IsShiftKeyDown() and ChatFrameEditBox:IsVisible() ) then |
||
1181 | ChatFrameEditBox:Insert(this:GetText()) |
||
1182 | end |
||
1183 | UberQuest_List_SetSelection(this:GetID() + FauxScrollFrame_GetOffset(UberQuest_List_Scroll)) |
||
1184 | UberQuest_List_Update() |
||
1185 | end |
||
1186 | end |
||
1187 | |||
1188 | function UberQuest_Minion_ColorPick() |
||
1189 | ColorPickerFrame.func = UberQuest_Minion_SetColor |
||
1190 | ColorPickerFrame.hasOpacity = 1 |
||
1191 | ColorPickerFrame.opacityFunc = UberQuest_Minion_SetOpacity |
||
1192 | ColorPickerFrame.cancelFunc = UberQuest_Minion_Cancel |
||
1193 | if (UberQuest_Config.color and UberQuest_Config.color.r and UberQuest_Config.color.g and UberQuest_Config.color.b and UberQuest_Config.color.opacity) then |
||
1194 | ColorPickerFrame:SetColorRGB( UberQuest_Config.color.r, |
||
1195 | UberQuest_Config.color.g, |
||
1196 | UberQuest_Config.color.b) |
||
1197 | ColorPickerFrame.opacity = UberQuest_Config.color.opacity |
||
1198 | ColorPickerFrame.previousValues = {r=UberQuest_Config.color.r, g=UberQuest_Config.color.g, b=UberQuest_Config.color.b, opacity=UberQuest_Config.color.opacity} |
||
1199 | else |
||
1200 | ColorPickerFrame:SetColorRGB(TOOLTIP_DEFAULT_BACKGROUND_COLOR.r,TOOLTIP_DEFAULT_BACKGROUND_COLOR.g,TOOLTIP_DEFAULT_BACKGROUND_COLOR.b) |
||
1201 | ColorPickerFrame.previousValues = {r=TOOLTIP_DEFAULT_BACKGROUND_COLOR.r, g=TOOLTIP_DEFAULT_BACKGROUND_COLOR.g, b=TOOLTIP_DEFAULT_BACKGROUND_COLOR.b, opacity=0} |
||
1202 | ColorPickerFrame.opacity = 0 |
||
1203 | end |
||
1204 | ShowUIPanel(ColorPickerFrame) |
||
1205 | end |
||
1206 | |||
1207 | function UberQuest_Minion_SetColor() |
||
1208 | local r,g,b = ColorPickerFrame:GetColorRGB() |
||
1209 | UberQuest_MinionBackdrop:SetBackdropColor(r, g, b) |
||
1210 | if (not UberQuest_Config.color) then |
||
1211 | UberQuest_Config.color = {} |
||
1212 | end |
||
1213 | UberQuest_Config.color.r = r |
||
1214 | UberQuest_Config.color.g = g |
||
1215 | UberQuest_Config.color.b = b |
||
1216 | UberQuest_Config_Update() |
||
1217 | end |
||
1218 | |||
1219 | function UberQuest_Minion_SetOpacity() |
||
1220 | local alpha = 1.0 - OpacitySliderFrame:GetValue() |
||
1221 | UberQuest_MinionBackdrop:SetAlpha(alpha) |
||
1222 | if (not UberQuest_Config.color) then |
||
1223 | UberQuest_Config.color = {} |
||
1224 | end |
||
1225 | UberQuest_Config.color.opacity = OpacitySliderFrame:GetValue() |
||
1226 | end |
||
1227 | |||
1228 | function UberQuest_Minion_Cancel(previousValues) |
||
1229 | if (not UberQuest_Config.color) then |
||
1230 | UberQuest_Config.color = {} |
||
1231 | end |
||
1232 | if (previousValues.r and previousValues.g and previousValues.b) then |
||
1233 | UberQuest_MinionBackdrop:SetBackdropColor(previousValues.r, previousValues.g, previousValues.b) |
||
1234 | UberQuest_Config.color.r = previousValues.r |
||
1235 | UberQuest_Config.color.g = previousValues.g |
||
1236 | UberQuest_Config.color.b = previousValues.b |
||
1237 | end |
||
1238 | if (previousValues.opacity) then |
||
1239 | local alpha = 1.0 - previousValues.opacity |
||
1240 | UberQuest_MinionBackdrop:SetAlpha(alpha) |
||
1241 | UberQuest_Config.color.opacity = previousValues.opacity |
||
1242 | end |
||
1243 | UberQuest_Config_Update() |
||
1244 | end |
||
1245 | |||
1246 | function UberMinion_Scale_Update() |
||
1247 | local scale = UberMinionScale:GetValue() / 100 |
||
1248 | UberQuest_Minion:SetScale(UIParent:GetScale() * scale) |
||
1249 | UberQuest_Config[UberQuest_Player]["scale"] = scale |
||
1250 | UberQuest_Minion_Update() |
||
1251 | end |
||
1252 | |||
1253 | |||
1254 | function QuestLogTitleButton_OnEnter() |
||
1255 | -- Set highlight |
||
1256 | getglobal(this:GetName().."Tag"):SetTextColor(HIGHLIGHT_FONT_COLOR.r, HIGHLIGHT_FONT_COLOR.g, HIGHLIGHT_FONT_COLOR.b) |
||
1257 | |||
1258 | -- Set group info tooltip |
||
1259 | QuestLog_UpdatePartyInfoTooltip() |
||
1260 | end |
||
1261 | |||
1262 | |||
1263 | function QuestLog_UpdatePartyInfoTooltip() |
||
1264 | local index = this:GetID() + FauxScrollFrame_GetOffset(UberQuest_List_Scroll) |
||
1265 | local numPartyMembers = GetNumPartyMembers() |
||
1266 | if ( numPartyMembers == 0 or this.isHeader ) then |
||
1267 | return |
||
1268 | end |
||
1269 | GameTooltip_SetDefaultAnchor(GameTooltip, this) |
||
1270 | |||
1271 | local questLogTitleText = GetQuestLogTitle(index) |
||
1272 | GameTooltip:SetText(questLogTitleText) |
||
1273 | |||
1274 | local isOnQuest, unitName, partyMemberOnQuest |
||
1275 | for i=1, numPartyMembers do |
||
1276 | isOnQuest = IsUnitOnQuest( index, "party"..i) |
||
1277 | unitName = UnitName("party"..i) |
||
1278 | if ( isOnQuest and isOnQuest == 1 ) then |
||
1279 | if ( not partyMemberOnQuest ) then |
||
1280 | GameTooltip:AddLine(HIGHLIGHT_FONT_COLOR_CODE..PARTY_QUEST_STATUS_ON..FONT_COLOR_CODE_CLOSE) |
||
1281 | partyMemberOnQuest = 1 |
||
1282 | end |
||
1283 | GameTooltip:AddLine(LIGHTYELLOW_FONT_COLOR_CODE..unitName..FONT_COLOR_CODE_CLOSE) |
||
1284 | end |
||
1285 | end |
||
1286 | if ( not partyMemberOnQuest ) then |
||
1287 | GameTooltip:AddLine(HIGHLIGHT_FONT_COLOR_CODE..PARTY_QUEST_STATUS_NONE..FONT_COLOR_CODE_CLOSE) |
||
1288 | end |
||
1289 | GameTooltip:Show() |
||
1290 | end |