comparison ObjectiveFrame.lua @ 16:880828018bf4

ObjectiveEvents - trim down the number of events that fire full updates - begin the general outline for determining which trackers need to refresh - handlers for accepting and completing auto-popup quests ObjectiveFrame - correct variables for money reward calculation - make sure everythign is scaling to the font strings and that the font strings aren't being pinned by SetSize ObjectiveInfo - implementation of autoquest popups - discern between internal and client bonus objective indexes - acquire the correct data set from bonus objective query ObjectiveStyle - look for a style table under the previously interpreted set before deferring standard options - horizontal/vertical options in gradient - remove height-fixing for font strings
author Nenue
date Tue, 05 Apr 2016 00:39:12 -0400
parents f660f1c1e0aa
children d1812fb10ae6
comparison
equal deleted inserted replaced
15:f660f1c1e0aa 16:880828018bf4
79 XPBar:Hide() 79 XPBar:Hide()
80 return 80 return
81 end 81 end
82 82
83 --- xp bar 83 --- xp bar
84 XPBar:SetWidth(wrapperWidth - Wrapper.close:GetWidth()) 84 XPBar:SetWidth(mod.Conf.Wrapper.WrapperWidth - Wrapper.CloseButton:GetWidth())
85 XPBar.statusbg:SetAllPoints(XPBar) 85 XPBar.statusbg:SetAllPoints(XPBar)
86 XPBar:RegisterEvent('DISABLE_XP_GAIN') 86 XPBar:RegisterEvent('DISABLE_XP_GAIN')
87 XPBar:RegisterEvent('ENABLE_XP_GAIN') 87 XPBar:RegisterEvent('ENABLE_XP_GAIN')
88 XPBar:SetScript('OnEvent', mod.UpdateXP) 88 XPBar:SetScript('OnEvent', mod.UpdateXP)
89 89
241 --t.status:Show() 241 --t.status:Show()
242 --t.status:SetText(info.completionText) 242 --t.status:SetText(info.completionText)
243 --end 243 --end
244 244
245 if info.numObjectives >= 1 then 245 if info.numObjectives >= 1 then
246 t.attachmentHeight = textSpacing 246 t.attachmentHeight = 0
247 t.status:Show() 247 t.status:Show()
248 print(' lines to build:', info.numObjectives) 248 print(' lines to build:', info.numObjectives)
249 249
250 local text = '' 250 local text = ''
251 251
254 t.status:SetText(info.description) 254 t.status:SetText(info.description)
255 else 255 else
256 t.status:SetText(nil) 256 t.status:SetText(nil)
257 end 257 end
258 t.title:SetText(info.title) 258 t.title:SetText(info.title)
259 print(' ', t.status:CanWordWrap(), t.status:GetStringHeight())
259 260
260 261
261 if info.specialItem and not info.itemButton then 262 if info.specialItem and not info.itemButton then
262 print(' - |cFF00FFFFgenerating item button for info set') 263 print(' - |cFF00FFFFgenerating item button for info set')
263 info.itemButton = mod.SetItemButton(t, info) 264 info.itemButton = mod.SetItemButton(t, info)
271 t:SetPoint('TOPLEFT', previousBlock, 'BOTTOMLEFT', 0, 0) 272 t:SetPoint('TOPLEFT', previousBlock, 'BOTTOMLEFT', 0, 0)
272 t:SetPoint('RIGHT', tracker,'RIGHT', 0, 0) 273 t:SetPoint('RIGHT', tracker,'RIGHT', 0, 0)
273 print(' anchor to|cFF0088FF', previousBlock:GetName()) 274 print(' anchor to|cFF0088FF', previousBlock:GetName())
274 end 275 end
275 276
277
276 --- metrics are calculated in SetStyle 278 --- metrics are calculated in SetStyle
277 t:SetStyle('TrackerBlock', handler.name, t.mainStyle, t.subStyle) 279 t:SetStyle('TrackerBlock', handler.name, t.mainStyle, t.subStyle)
278 t:Show() 280 t:Show()
279 281
280 print(' |cFF00FFFF)|r -> ', t, t:GetHeight()) 282 print(' |cFF00FFFF)|r -> ', t, t:GetHeight())
281 283
284 if info.rewardInfo then
285 print('has immediate reward')
286 if info.rewardInfo[1].type == 'currency' or info.rewardInfo[1].type == 'item' then
287 t.icon:Show()
288 t.iconLabel:SetText(info.rewardInfo[1].count)
289 t.icon:SetSize(t.height, t.height)
290 t.icon:SetTexture(info.rewardInfo[1].texture)
291 end
292
293 else
294 t.icon:Hide()
295 end
282 296
283 if Devian and Devian.InWorkspace() then 297 if Devian and Devian.InWorkspace() then
284 t.debugText:Show() 298 t.debugText:Show()
285 t.debugText:SetText(tostring(blockIndex) .. '\n' .. tostring(info.itemButton and info.itemButton:GetName()) .. "\n" .. (tostring(t.mainStyle) .. '/' .. tostring(t.subStyle))) 299 t.debugText:SetText(tostring(blockIndex) .. '\n' .. tostring(info.itemButton and info.itemButton:GetName()) .. "\n" .. (tostring(t.mainStyle) .. '/' .. tostring(t.subStyle)))
286 end 300 end
307 line.title = nil 321 line.title = nil
308 end 322 end
309 323
310 324
311 if line.widget then 325 if line.widget then
326 if attachmentHeight == 0 then
327 attachmentHeight = block.status.spacing
328 end
329
312 line.widget:Show() 330 line.widget:Show()
313 line.widget:SetParent(block) 331 line.widget:SetParent(block)
314 line.widget:SetPoint('TOPLEFT', block.status, 'BOTTOMLEFT', 0, -attachmentHeight ) 332 line.widget:SetPoint('TOPLEFT', block.status, 'BOTTOMLEFT', 0, -attachmentHeight )
315 print(' has a widget, height is', line.widget.height) 333 print(' has a widget, height is', line.widget.height)
316 attachmentHeight = attachmentHeight + line.widget.height 334 attachmentHeight = attachmentHeight + line.widget.height
327 345
328 block.completionScore = completionScore / completionMax 346 block.completionScore = completionScore / completionMax
329 block.attachmentHeight = attachmentHeight 347 block.attachmentHeight = attachmentHeight
330 348
331 block.status:SetText(text) 349 block.status:SetText(text)
350 block.status:SetWordWrap(true)
332 end 351 end
333 352
334 --- Objective parsers 353 --- Objective parsers
335 -- defines the following variables 354 -- defines the following variables
336 -- * height - height of whatever display widget is involved in conveying the task 355 -- * height - height of whatever display widget is involved in conveying the task
349 368
350 end 369 end
351 370
352 Bonus.ParseObjective = function(line, info) 371 Bonus.ParseObjective = function(line, info)
353 local print = B.print('BonusLine') 372 local print = B.print('BonusLine')
354 for k,v in pairs(line) do 373
355 print(k, v)
356 end
357 374
358 line.displayColor = 'FFFFFF' 375 line.displayColor = 'FFFFFF'
359 if line.text and not info.title then 376 if line.text and not info.title then
360 line.title = line.text 377 line.title = line.text
361 else 378 else
423 440
424 441
425 mod.Quest.numButtons = 0 442 mod.Quest.numButtons = 0
426 local usedButtons = mod.Quest.itemButtons 443 local usedButtons = mod.Quest.itemButtons
427 local freeButtons = mod.Quest.freeButtons 444 local freeButtons = mod.Quest.freeButtons
428 mod.UpdateWrapper = function() 445 mod.UpdateWrapper = function(reason)
446 print('|cFF00FFFFUpdateWrapper:|r', reason)
429 unitLevel = UnitLevel('player') 447 unitLevel = UnitLevel('player')
430 wrapperWidth = mod.Conf.Wrapper.WrapperWidth 448 wrapperWidth = mod.Conf.Wrapper.WrapperWidth
431 scrollWidth = mod.Conf.Wrapper.WrapperWidth 449 scrollWidth = mod.Conf.Wrapper.WrapperWidth
432 local wrapperBlocks = 0 450 local wrapperBlocks = 0
433 -- Update scroll child vertical size 451 -- Update scroll child vertical size