Mercurial > wow > buffalo2
comparison Modules/ArtifactPower.lua @ 129:9f2cf5609420 v7.3.0-20171022
- fix Argus world quests not being counted
- add "Argus WQ" header in the summary box
author | Nenue |
---|---|
date | Sun, 22 Oct 2017 18:28:43 -0400 |
parents | 3f4794dca91b |
children | 15a7f27b11e6 |
comparison
equal
deleted
inserted
replaced
128:799ec6dce9c3 | 129:9f2cf5609420 |
---|---|
39 local FRAME_PADDING = 4 | 39 local FRAME_PADDING = 4 |
40 local EQUIPPED_SIZE = 64 | 40 local EQUIPPED_SIZE = 64 |
41 local BUTTON_SIZE = 48 | 41 local BUTTON_SIZE = 48 |
42 local FRAME_LIST = {'ContainerFrame1', 'BankFrame'} | 42 local FRAME_LIST = {'ContainerFrame1', 'BankFrame'} |
43 local BAG_FRAMES = {'ContainerFrame1'} | 43 local BAG_FRAMES = {'ContainerFrame1'} |
44 local BANK_FRAMES = {'BankFrame'} | 44 local BANK_FRAMES = {'BankFrame' } |
45 local ZONE_ID_ARGUS = 1184 | |
46 local ZONE_ID_BROKEN_ISLE = 1007 | |
45 | 47 |
46 function Module:OnLoad() | 48 function Module:OnLoad() |
47 self:RegisterEvent('BAG_UPDATE') -- use to obtain bag IDs to scan | 49 self:RegisterEvent('BAG_UPDATE') -- use to obtain bag IDs to scan |
48 self:RegisterEvent('BAG_UPDATE_DELAYED') -- use to trigger actual scan activity | 50 self:RegisterEvent('BAG_UPDATE_DELAYED') -- use to trigger actual scan activity |
49 self:RegisterEvent('BANKFRAME_OPENED') -- bank info available | 51 self:RegisterEvent('BANKFRAME_OPENED') -- bank info available |
466 | 468 |
467 if self.worldQuestAP then | 469 if self.worldQuestAP then |
468 bankText = (bankText and (bankText .. '\n') or '') .. '|cFFFFBB00World Quests:|r |cFFFFFFFF' .. ShortNumberString(self.worldQuestAP) .. '' | 470 bankText = (bankText and (bankText .. '\n') or '') .. '|cFFFFBB00World Quests:|r |cFFFFFFFF' .. ShortNumberString(self.worldQuestAP) .. '' |
469 end | 471 end |
470 | 472 |
473 if self.argusAP then | |
474 bankText = (bankText and (bankText .. '\n') or '') .. '|cFF88FF00Argus WQ:|r |cFFFFFFFF' .. ShortNumberString(self.argusAP) .. '' | |
475 end | |
476 | |
477 | |
471 | 478 |
472 self.SummaryHeader:SetText(bankText) | 479 self.SummaryHeader:SetText(bankText) |
473 if not self.lastButton then | 480 if not self.lastButton then |
474 contentsHeight = contentsHeight + self.SummaryHeader:GetHeight() | 481 contentsHeight = contentsHeight + self.SummaryHeader:GetHeight() |
475 end | 482 end |
483 self:SetWidth(contentsWidth) | 490 self:SetWidth(contentsWidth) |
484 self:SetHeight(contentsHeight) | 491 self:SetHeight(contentsHeight) |
485 self:Reanchor() | 492 self:Reanchor() |
486 end | 493 end |
487 | 494 |
488 local BROKEN_ISLE_ID = 1007 | 495 function Module:GetContinentAP(mapAreaID) |
489 | 496 |
490 function Module:UpdateWorldQuestsAP() | 497 for zoneIndex = 1, C_MapCanvas.GetNumZones(mapAreaID) do |
491 self.waitingForQuestRewardData = false | 498 local zoneMapID, zoneName, zoneDepth, left, right, top, bottom = C_MapCanvas.GetZoneInfo(mapAreaID, zoneIndex); |
492 self.worldQuestAP = 0 | |
493 wipe(self.worldQuestItems) | |
494 | |
495 for zoneIndex = 1, C_MapCanvas.GetNumZones(BROKEN_ISLE_ID) do | |
496 local zoneMapID, zoneName, zoneDepth, left, right, top, bottom = C_MapCanvas.GetZoneInfo(BROKEN_ISLE_ID, zoneIndex); | |
497 --print(zoneMapID, zoneName) | 499 --print(zoneMapID, zoneName) |
498 if zoneDepth <= 1 then -- Exclude subzones | 500 if zoneDepth <= 1 then -- Exclude subzones |
499 local taskInfo = C_TaskQuest.GetQuestsForPlayerByMapID(zoneMapID, BROKEN_ISLE_ID); | 501 local taskInfo = C_TaskQuest.GetQuestsForPlayerByMapID(zoneMapID, mapAreaID, (mapAreaID == 1184) and 1 or nil); |
500 | 502 |
501 if taskInfo then | 503 if taskInfo then |
502 for i, info in ipairs(taskInfo) do | 504 for i, info in ipairs(taskInfo) do |
503 local questID = info.questId | 505 local questID = info.questId |
504 | 506 |
517 if link then | 519 if link then |
518 local ap = self:GetItemAP(itemID, link) | 520 local ap = self:GetItemAP(itemID, link) |
519 --print('ap =', ap) | 521 --print('ap =', ap) |
520 if ap then | 522 if ap then |
521 self.worldQuestAP = self.worldQuestAP + ap | 523 self.worldQuestAP = self.worldQuestAP + ap |
524 if mapAreaID == ZONE_ID_ARGUS then | |
525 self.argusAP = self.argusAP + ap | |
526 end | |
522 | 527 |
523 end | 528 end |
524 | 529 |
525 self.worldQuestItems[itemID] = (self.worldQuestItems[itemID] or 0) + 1 | 530 self.worldQuestItems[itemID] = (self.worldQuestItems[itemID] or 0) + 1 |
526 end | 531 end |
539 end | 544 end |
540 end | 545 end |
541 end | 546 end |
542 end | 547 end |
543 end | 548 end |
549 | |
550 end | |
551 | |
552 function Module:UpdateWorldQuestsAP() | |
553 self.waitingForQuestRewardData = false | |
554 self.worldQuestAP = 0 | |
555 self.argusAP = 0 | |
556 wipe(self.worldQuestItems) | |
557 | |
558 self:GetContinentAP(ZONE_ID_BROKEN_ISLE) | |
559 self:GetContinentAP(ZONE_ID_ARGUS) | |
560 | |
544 end | 561 end |
545 | 562 |
546 function Module:UpdateArtifactButtons() | 563 function Module:UpdateArtifactButtons() |
547 | 564 |
548 -- Artifact icons, in no particular order | 565 -- Artifact icons, in no particular order |
758 local itemAP = text:match('[%d%.]+') | 775 local itemAP = text:match('[%d%.]+') |
759 if itemAP then | 776 if itemAP then |
760 -- tokens > 1M are described as '%f million' | 777 -- tokens > 1M are described as '%f million' |
761 if text:match("million") then | 778 if text:match("million") then |
762 itemAP = tonumber(itemAP) * 1000000 | 779 itemAP = tonumber(itemAP) * 1000000 |
780 elseif text:match("billion") then | |
781 itemAP = tonumber(itemAP) * 1000000000 | |
763 end | 782 end |
764 | 783 |
765 itemAP = itemAP | 784 itemAP = itemAP |
766 self.cache.items[itemID] = tonumber(itemAP) | 785 self.cache.items[itemID] = tonumber(itemAP) |
767 end | 786 end |
1041 local maxHeight = self:GetHeight() - (XP_INSET*2) | 1060 local maxHeight = self:GetHeight() - (XP_INSET*2) |
1042 local currentHeight = self.CurrentProgress:GetHeight() or 1 | 1061 local currentHeight = self.CurrentProgress:GetHeight() or 1 |
1043 local offHeight = self.AdjustedProgress:GetHeight() or 1 | 1062 local offHeight = self.AdjustedProgress:GetHeight() or 1 |
1044 | 1063 |
1045 | 1064 |
1046 self.CurrentProgress:SetPoint('BOTTOM', self, 'BOTTOM', 0, XP_INSET) | 1065 self.CurrentProgress:SetPoint('BOTTOM', self.XPBackground, 'BOTTOM', 0, 0) |
1047 local currentProgress = (self.currentXP < self.currentCost) and (self.currentXP / self.currentCost) or 1 | 1066 local currentProgress = (self.currentXP < self.currentCost) and (self.currentXP / self.currentCost) or 1 |
1048 local projectedProgress = (self.totalXP < self.totalCost) and (self.totalXP / self.totalCost) or 1 | 1067 local projectedProgress = (self.totalXP < self.totalCost) and (self.totalXP / self.totalCost) or 1 |
1049 if self.actualLevel ~= self.level then | 1068 if self.actualLevel ~= self.level then |
1050 r3, g3, b3 = 0, 1, 1 | 1069 r3, g3, b3 = 0, 1, 1 |
1051 end | 1070 end |