Mercurial > wow > worldplan
comparison ClassPlan.lua @ 95:b29b35cb8539
- Fixed quest completion checking and handling
- Changed animation method to hopefully stop weird flickering.
- Pins are now visible before full reward data is loaded
- Filter bar redesigned:
- aligned horizontally along the top of the map display
- filter buttons display a '+' when there are matches in both current and other zones, and '*' when there only matches in other zones
- button tooltips separate local and global quests
- button categories are highlighted and labeled when the cursor is over them
- Fixed invalid POI targets appearing when the spell targeting cursor is active
- ClassOrderPlan can be closed with the game menu button
| author | Nenue |
|---|---|
| date | Mon, 08 May 2017 22:38:52 -0400 |
| parents | 79e5e96e5f18 |
| children | 4d1520186ea4 a3800989f515 |
comparison
equal
deleted
inserted
replaced
| 94:dfd53f7c0fe5 | 95:b29b35cb8539 |
|---|---|
| 33 local hours = floor(mod(timeLeft, (24*3600)) / 3600) | 33 local hours = floor(mod(timeLeft, (24*3600)) / 3600) |
| 34 local minutes = floor(mod(timeLeft, 3600) / 60) | 34 local minutes = floor(mod(timeLeft, 3600) / 60) |
| 35 local seconds = mod(timeLeft, 60) | 35 local seconds = mod(timeLeft, 60) |
| 36 if days >= 1 then | 36 if days >= 1 then |
| 37 return (days .. 'd' .. ' ') .. ((hours > 0) and (hours .. 'h') or '') | 37 return (days .. 'd' .. ' ') .. ((hours > 0) and (hours .. 'h') or '') |
| 38 elseif timeLeft < 60 then | |
| 39 return (seconds .. ' sec') | |
| 38 else | 40 else |
| 39 return ((hours > 0) and (hours .. 'h') or '') .. ((minutes > 0) and (' ' ..minutes .. ' min') or '') | 41 return ((hours > 0) and (hours .. 'h') or '') .. ((minutes > 0) and (' ' ..minutes .. ' min') or '') |
| 40 end | 42 end |
| 41 end | 43 end |
| 42 | 44 |
| 79 self:RegisterEvent('ADDON_LOADED') | 81 self:RegisterEvent('ADDON_LOADED') |
| 80 self:RegisterEvent('PLAYER_REGEN_ENABLED') | 82 self:RegisterEvent('PLAYER_REGEN_ENABLED') |
| 81 self:RegisterEvent('PLAYER_REGEN_DISABLED') | 83 self:RegisterEvent('PLAYER_REGEN_DISABLED') |
| 82 self:RegisterEvent('GARRISON_SHOW_LANDING_PAGE') | 84 self:RegisterEvent('GARRISON_SHOW_LANDING_PAGE') |
| 83 self:RegisterForDrag('LeftButton') | 85 self:RegisterForDrag('LeftButton') |
| 86 self:EnableMouse(true) | |
| 84 self:SetMovable(true) | 87 self:SetMovable(true) |
| 85 self:SetToplevel(true) | 88 self:SetToplevel(true) |
| 86 | 89 |
| 87 SLASH_CLASSPLAN1 = "/classplan" | 90 SLASH_CLASSPLAN1 = "/classplan" |
| 88 SLASH_CLASSPLAN2 = "/cp" | 91 SLASH_CLASSPLAN2 = "/cp" |
| 111 --hooksecurefunc(C_Garrison, 'RequestLandingPageShipmentInfo', function() | 114 --hooksecurefunc(C_Garrison, 'RequestLandingPageShipmentInfo', function() |
| 112 -- WorldPlan:print("Requesting shipments data.") | 115 -- WorldPlan:print("Requesting shipments data.") |
| 113 --end) | 116 --end) |
| 114 C_Garrison.RequestLandingPageShipmentInfo(); | 117 C_Garrison.RequestLandingPageShipmentInfo(); |
| 115 self.isStale = true | 118 self.isStale = true |
| 119 UIPanelWindows[self:GetName()] = { area = "right", pushable = 3, whileDead = 1 }; | |
| 120 tinsert(UISpecialFrames, self:GetName()) | |
| 116 end | 121 end |
| 117 | 122 |
| 118 | 123 |
| 119 function ClassPlan:GetCurrentProfile() | 124 function ClassPlan:GetCurrentProfile() |
| 120 WorldPlanData.OrderHall = WorldPlanData.OrderHall or {} | 125 WorldPlanData.OrderHall = WorldPlanData.OrderHall or {} |
| 146 | 151 |
| 147 self.HeaderInset:SetHeight(CP_HEADER_SIZE) | 152 self.HeaderInset:SetHeight(CP_HEADER_SIZE) |
| 148 self.ClassStripe:SetColorTexture(classColor.r, classColor.g, classColor.b, 1) | 153 self.ClassStripe:SetColorTexture(classColor.r, classColor.g, classColor.b, 1) |
| 149 self.ClassStripe:SetPoint('TOPLEFT', self.HeaderInset, 'BOTTOMLEFT') | 154 self.ClassStripe:SetPoint('TOPLEFT', self.HeaderInset, 'BOTTOMLEFT') |
| 150 | 155 |
| 156 self.maxItems = db.maxItems or self.maxItems | |
| 157 | |
| 151 return self.profile | 158 return self.profile |
| 152 end | 159 end |
| 153 | 160 |
| 154 function ClassPlan:AddHandler(frame) | 161 function ClassPlan:AddHandler(frame) |
| 155 print('|cFF00FF00'..frame:GetName()..' loaded') | 162 print('|cFF00FF00'..frame:GetName()..' loaded') |
| 163 frame.data = self.data | 170 frame.data = self.data |
| 164 self.profile[listKey] = self.profile[listKey] or {} | 171 self.profile[listKey] = self.profile[listKey] or {} |
| 165 local listTitle = frame.listTitle[index] | 172 local listTitle = frame.listTitle[index] |
| 166 setmetatable(self.profile[listKey], { __tostring = function() return listTitle end }) | 173 setmetatable(self.profile[listKey], { __tostring = function() return listTitle end }) |
| 167 frame.sortedItems[listKey] = {} | 174 frame.sortedItems[listKey] = {} |
| 168 | 175 frame.maxItems = self.maxItems |
| 169 end | 176 end |
| 170 frame.owningFrame = self | 177 frame.owningFrame = self |
| 171 frame:SetList(1) | 178 frame:SetList(1) |
| 172 end | 179 end |
| 173 | 180 |
| 302 self.data.IsShown = true | 309 self.data.IsShown = true |
| 303 self.FadeIn:Play() | 310 self.FadeIn:Play() |
| 304 end | 311 end |
| 305 end | 312 end |
| 306 | 313 |
| 314 | |
| 315 function ClassPlan:OnMouseDown(button) | |
| 316 print(button) | |
| 317 if button == 'RightButton' then | |
| 318 self:Toggle() | |
| 319 end | |
| 320 | |
| 321 end | |
| 307 | 322 |
| 308 function ClassPlan:OnUpdate() | 323 function ClassPlan:OnUpdate() |
| 309 if self.requestingData then | 324 if self.requestingData then |
| 310 self:RefreshData() | 325 self:RefreshData() |
| 311 elseif self.isStale then | 326 elseif self.isStale then |
| 404 if self.OnSetList then | 419 if self.OnSetList then |
| 405 self:OnSetList(self.currentListIndex, prevIndex) | 420 self:OnSetList(self.currentListIndex, prevIndex) |
| 406 end | 421 end |
| 407 end | 422 end |
| 408 | 423 |
| 424 function ClassPlanHandlerBase:OnLoad(...) | |
| 425 print(self:GetName()..':OnLoad()', ...) | |
| 426 self:EnableMouse(true) | |
| 427 end | |
| 428 | |
| 429 function ClassPlanHandlerBase:OnMouseDown(button, down) | |
| 430 print(self:GetName().. ':OnMouseDown()', button) | |
| 431 ClassOrderPlan:OnMouseDown(button) | |
| 432 end | |
| 433 | |
| 409 function ClassPlanHandlerBase:OnMouseWheel(delta) | 434 function ClassPlanHandlerBase:OnMouseWheel(delta) |
| 410 self.scrollOffset = (self.scrollOffset or 0) - ((delta > 0) and 1 or -1) | 435 if IsControlKeyDown() then |
| 436 if delta > 0 then | |
| 437 if self.maxItems < 30 then | |
| 438 self.maxItems = self.maxItems + 1 | |
| 439 end | |
| 440 | |
| 441 else | |
| 442 if self.maxItems >= 2 then | |
| 443 self.maxItems = self.maxItems - 1 | |
| 444 end | |
| 445 end | |
| 446 if WorldPlanData.OrderHall then | |
| 447 WorldPlanData.OrderHall.maxItems = self.maxItems | |
| 448 end | |
| 449 else | |
| 450 self.scrollOffset = (self.scrollOffset or 0) - ((delta > 0) and 1 or -1) | |
| 451 end | |
| 411 self:UpdateItems() | 452 self:UpdateItems() |
| 412 end | 453 end |
| 413 | 454 |
| 414 function ClassPlanHandlerBase:RefreshData() | 455 function ClassPlanHandlerBase:RefreshData() |
| 415 print('|cFF0088FF'..self:GetName()..':RefreshData()') | 456 print('|cFF0088FF'..self:GetName()..':RefreshData()') |
| 545 | 586 |
| 546 totalHeight = totalHeight + block:GetHeight() | 587 totalHeight = totalHeight + block:GetHeight() |
| 547 block.lastProfile = lastProfile | 588 block.lastProfile = lastProfile |
| 548 -- blot out arbitrary flags | 589 -- blot out arbitrary flags |
| 549 block.offerEndTime = nil | 590 block.offerEndTime = nil |
| 591 block.isComplete = data.isComplete | |
| 550 block.missionEndTime = nil | 592 block.missionEndTime = nil |
| 551 block.creationTime = nil | 593 block.creationTime = nil |
| 552 block.duration = nil | 594 block.duration = nil |
| 553 block.throttle = 5 | 595 block.throttle = 5 |
| 554 | 596 |
| 605 end | 647 end |
| 606 end | 648 end |
| 607 end | 649 end |
| 608 | 650 |
| 609 function ClassPlanEntryBase:SetTimeLeft(expires, duration) | 651 function ClassPlanEntryBase:SetTimeLeft(expires, duration) |
| 610 self.ProgressBG:Hide() | |
| 611 self.ProgressBar:Hide() | |
| 612 if not expires then | 652 if not expires then |
| 613 return | 653 return |
| 614 end | 654 end |
| 615 | 655 |
| 616 -- calculate here since time isn't available | 656 -- calculate here since time isn't available |
| 617 local timeLeft = expires - time() | 657 local timeLeft = expires - time() |
| 658 --print(self:GetName(), timeLeft) | |
| 618 if timeLeft < 0 then | 659 if timeLeft < 0 then |
| 619 -- handle being complete | 660 -- handle being complete |
| 620 if self.shipmentsReady and (self.shipmentsReady < self.shipmentsTotal) then | 661 if self.shipmentsReady and (self.shipmentsReady < self.shipmentsTotal) then |
| 621 self.TimeLeft:SetText('Ready') | 662 self.TimeLeft:SetText('Ready') |
| 622 else | 663 else |
| 623 self.TimeLeft:SetText('Complete!') | 664 self.TimeLeft:SetText('Complete!') |
| 624 end | 665 end |
| 625 else | 666 else |
| 626 self.TimeLeft:SetText(GetTimeLeftString(timeLeft)) | 667 self.TimeLeft:SetText(GetTimeLeftString(timeLeft)) |
| 627 end | 668 if duration then |
| 628 | 669 local progress = (duration - timeLeft) / duration |
| 629 if (timeLeft > 0) and duration then | 670 local r = ((progress >= .5) and (progress/2)) or 1 |
| 630 local progress = (duration - timeLeft) / duration | 671 local g = ((progress <= .5) and (progress*2)) or 1 |
| 631 local r = ((progress >= .5) and (progress/2)) or 1 | 672 self.ProgressBG:Show() |
| 632 local g = ((progress <= .5) and (progress*2)) or 1 | 673 self.ProgressBar:Show() |
| 633 self.ProgressBG:Show() | 674 self.ProgressBG:SetColorTexture(r,g,0,0.25) |
| 634 self.ProgressBar:Show() | 675 self.ProgressBar:SetColorTexture(r,g,0,0.5) |
| 635 self.ProgressBG:SetColorTexture(r,g,0,0.25) | 676 self.ProgressBar:SetWidth(self.ProgressBG:GetWidth() * progress) |
| 636 self.ProgressBar:SetColorTexture(r,g,0,0.5) | 677 else |
| 637 self.ProgressBar:SetWidth(self.ProgressBG:GetWidth() * progress) | 678 |
| 679 self.ProgressBG:Hide() | |
| 680 self.ProgressBar:Hide() | |
| 681 end | |
| 638 end | 682 end |
| 639 end | 683 end |
| 640 | 684 |
| 641 | 685 |
| 642 | 686 |
