Mercurial > wow > buffalo2
comparison ObjectiveFrame.lua @ 3:3397aae1f44d
- use the correct key value when searching for action buttons
- handle pre-built frames from XML
| author | Nenue |
|---|---|
| date | Thu, 31 Mar 2016 07:32:05 -0400 |
| parents | a2396b03ce63 |
| children | 18eee961038e |
comparison
equal
deleted
inserted
replaced
| 2:a2396b03ce63 | 3:3397aae1f44d |
|---|---|
| 52 Font = {wrapperHeadFont, wrapperHeadSize, wrapperHeadOutline} | 52 Font = {wrapperHeadFont, wrapperHeadSize, wrapperHeadOutline} |
| 53 } | 53 } |
| 54 }, | 54 }, |
| 55 ObjectiveHeaderStyle = { | 55 ObjectiveHeaderStyle = { |
| 56 Normal = { | 56 Normal = { |
| 57 Gradient = {MinColor = {0,0,0,0.5}, MaxColor = {0,0,0,1}}, | 57 Gradient = {MinColor = {0,0,0,0.5}, MaxColor = {0,0,0,.25}}, |
| 58 Font = {headerFont, headerSize, headerOutline}, Spacing = headerSpacing, | 58 Font = {headerFont, headerSize, headerOutline}, Spacing = headerSpacing, |
| 59 } | 59 } |
| 60 }, | 60 }, |
| 61 ObjectiveTrackerStyle = { | 61 ObjectiveTrackerStyle = { |
| 62 Normal = { | 62 Normal = { |
| 107 } | 107 } |
| 108 }, | 108 }, |
| 109 } | 109 } |
| 110 } | 110 } |
| 111 | 111 |
| 112 local FontBank = { | |
| 113 ['Normal'] = VeneerCriteriaFontNormal, | |
| 114 ['Progress'] = VeneerCriteriaFontProgress, | |
| 115 ['Complete'] = VeneerCriteriaFontComplete, | |
| 116 ['Failed'] = VeneerCriteriaFontFailed, | |
| 117 } | |
| 118 | |
| 112 local Scroller_OnShow = function() | 119 local Scroller_OnShow = function() |
| 113 Wrapper.watchMoneyReasons = 0; | 120 Wrapper.watchMoneyReasons = 0; |
| 114 mod.UpdateWrapper() | 121 mod.UpdateWrapper() |
| 115 mod.SetEvents() | 122 mod.SetEvents() |
| 116 for i, region in ipairs(Wrapper.header) do | 123 for i, region in ipairs(Wrapper.header) do |
| 225 end | 232 end |
| 226 | 233 |
| 227 if rest then | 234 if rest then |
| 228 XPBar.rested:ClearAllPoints() | 235 XPBar.rested:ClearAllPoints() |
| 229 if xp == 0 then | 236 if xp == 0 then |
| 230 XPBar.rested:SetPoint('LEFT', XPBar, 'LEFT', 0, 0) | 237 XPBar.rested:SetPoint('TOPLEFT', XPBar, 'TOPLEFT', 0, 0) |
| 231 else | 238 else |
| 232 XPBar.rested:SetPoint('LEFT', XPBar.fg, 'RIGHT', 0, 0) | 239 XPBar.rested:SetPoint('TOPLEFT', XPBar.fg, 'TOPRIGHT', 0, 0) |
| 233 end | 240 end |
| 234 | 241 |
| 235 if (xp + rest) > xpmax then | 242 if (xp + rest) > xpmax then |
| 236 XPBar.rested:SetPoint('RIGHT', XPBar, 'RIGHT', 0, 0) | 243 XPBar.rested:SetPoint('BOTTOMRIGHT', XPBar, 'BOTTOMRIGHT', 0, 0) |
| 237 else | 244 else |
| 238 XPBar.rested:SetWidth((xp/xpmax) * XPBar:GetWidth()) | 245 XPBar.rested:SetWidth((rest/xpmax) * XPBar:GetWidth()) |
| 239 end | 246 end |
| 247 XPBar.rested:SetPoint('BOTTOM', XPBar, 'BOTTOM') | |
| 240 XPBar.rested:Show() | 248 XPBar.rested:Show() |
| 241 else | 249 else |
| 242 XPBar.rested:Hide() | 250 XPBar.rested:Hide() |
| 243 end | 251 end |
| 244 | 252 |
| 365 t.objectives:Show() | 373 t.objectives:Show() |
| 366 t.objectives:SetText(info.completionText) | 374 t.objectives:SetText(info.completionText) |
| 367 elseif info.numObjectives >= 1 then | 375 elseif info.numObjectives >= 1 then |
| 368 t.objectives:Show() | 376 t.objectives:Show() |
| 369 print(' - objective lines:', info.numObjectives, 'can wrap:', t.objectives:CanWordWrap()) | 377 print(' - objective lines:', info.numObjectives, 'can wrap:', t.objectives:CanWordWrap()) |
| 378 | |
| 370 local text = '' | 379 local text = '' |
| 380 if info.description then | |
| 381 print(' -- has description text:', select('#', info.description), info.description) | |
| 382 text = info.description | |
| 383 end | |
| 384 | |
| 385 --- todo: implement objective displays | |
| 386 -- in an accumulator loop, call upon handler for the appropriate display frame, each defining: | |
| 387 -- * height of whatever display widget is involved in conveying the task | |
| 388 -- * number of non-wrapped text lines to account for line space; may be discarded depending on things | |
| 389 -- * boolean that determines listening for money events or not | |
| 390 t.attachmentHeight = 0 | |
| 371 for o, obj in ipairs(t.info.objectives) do | 391 for o, obj in ipairs(t.info.objectives) do |
| 372 local line = obj.text | 392 --- achievement criteria |
| 373 if obj.type == 'monster' then | 393 if obj.flags then |
| 374 line = '|cFFFFFF00' .. line .. '|r' | 394 |
| 375 elseif obj.type == 'item' then | 395 if bit.band(obj.flags, 0x00000001) > 0 then |
| 376 line = '|cFF44BBFF' .. line .. '|r' | 396 obj.type = 'ProgressBar' |
| 377 elseif obj.type == 'object' then | 397 obj.widget = mod.SetWidget(obj, info) |
| 378 line = '|cFFFFFFFF' .. line .. '|r' | 398 elseif bit.band(obj.flags, 0x00000002) then |
| 399 obj.type = 'Hidden' | |
| 400 obj.widget = nil | |
| 401 else | |
| 402 obj.type = 'Text' | |
| 403 obj.widget = nil | |
| 404 text = text .. ((text == '') and "" or "\n") .. obj.text | |
| 405 end | |
| 406 | |
| 407 print(obj.type, obj.text, obj.quantityString) | |
| 408 --- none of the above (most quests) | |
| 409 else | |
| 410 local line = obj.text | |
| 411 if obj.type == 'monster' then | |
| 412 line = '|cFFFFFF00' .. line .. '|r' | |
| 413 elseif obj.type == 'item' then | |
| 414 line = '|cFF44BBFF' .. line .. '|r' | |
| 415 elseif obj.type == 'object' then | |
| 416 line = '|cFFFFFFFF' .. line .. '|r' | |
| 417 end | |
| 418 text = text .. ((text == '') and "" or "\n") .. line | |
| 379 end | 419 end |
| 380 text = text .. ((text == '') and "" or "\n") .. line | 420 |
| 421 if obj.widget then | |
| 422 t.attachmentHeight = t.attachmentHeight + obj.widget.height | |
| 423 end | |
| 424 | |
| 381 end | 425 end |
| 382 t.objectives:SetText(text) | 426 t.objectives:SetText(text) |
| 427 t.objectives:SetWordWrap(true) | |
| 383 | 428 |
| 384 | 429 |
| 385 -- todo: set up a SecureActionButton template | 430 -- todo: set up a SecureActionButton template |
| 386 if info.specialItem and not info.itemButton then | 431 if info.specialItem and not info.itemButton then |
| 387 print(' - |cFF00FFFFupdate item button') | 432 print(' - |cFF00FFFFupdate item button') |
| 400 style = 'Complete' | 445 style = 'Complete' |
| 401 elseif info.superTracked then | 446 elseif info.superTracked then |
| 402 style = 'Super' | 447 style = 'Super' |
| 403 end | 448 end |
| 404 | 449 |
| 450 --- metrics are calculated in SetStyle | |
| 405 t:SetStyle(style) | 451 t:SetStyle(style) |
| 406 | |
| 407 | |
| 408 local fullheight = t:GetHeight() | |
| 409 t:Show() | 452 t:Show() |
| 410 print(' |cFF00FFFF)|r -> ', t, t:GetHeight(), fullheight) | 453 |
| 454 print(' |cFF00FFFF)|r -> ', t, t:GetHeight()) | |
| 411 return t | 455 return t |
| 412 end | 456 end |
| 413 | 457 |
| 414 mod.UpdateTracker = function(handler) | 458 mod.UpdateTracker = function(handler) |
| 415 print('|cFF00FF88UpdateTracker(|r|cFFFF4400' .. type(handler) .. '|r :: |cFF88FFFF' .. tostring(handler) .. '|r') | 459 print('|cFF00FF88UpdateTracker(|r|cFFFF4400' .. type(handler) .. '|r :: |cFF88FFFF' .. tostring(handler) .. '|r') |
| 556 --- Queue any active item buttons for update for that frame | 600 --- Queue any active item buttons for update for that frame |
| 557 mod.UpdateActionButtons = function() | 601 mod.UpdateActionButtons = function() |
| 558 local previousItem | 602 local previousItem |
| 559 for questID, itemButton in pairs(usedButtons) do | 603 for questID, itemButton in pairs(usedButtons) do |
| 560 local questIndex = mod.Quest.Info[questID].questLogIndex | 604 local questIndex = mod.Quest.Info[questID].questLogIndex |
| 561 print('|cFF00FFFF', questIndex, itemButton:GetName()) | 605 print('|cFF00FFFF', questID, itemButton:GetName()) |
| 562 local block = mod.Quest.LogBlock[questIndex] | 606 local block = mod.Quest.LogBlock[questID] |
| 563 print(block:GetTop()) | 607 print(block:GetTop()) |
| 564 if block then | 608 if block then |
| 565 if IsQuestWatched(questIndex) then | 609 if IsQuestWatched(questIndex) then |
| 566 -- Dispatch the probe | 610 -- Dispatch the probe |
| 567 block:SetScript('OnUpdate', function() | 611 block:SetScript('OnUpdate', function() |
