Mercurial > wow > buffalo2
comparison Modules/ArtifactPower.lua @ 136:414e37af1b1b v8.0.1-20180718
8.0.1 "pre-patch" updates
- disabled PaperDoll, ArtifactPower, and Social/LFG modules
| author | Nenue |
|---|---|
| date | Wed, 18 Jul 2018 15:31:15 -0400 |
| parents | 4979b5cca6de |
| children |
comparison
equal
deleted
inserted
replaced
| 135:4979b5cca6de | 136:414e37af1b1b |
|---|---|
| 68 end | 68 end |
| 69 self:Print('Show Underlight Angler:', (VeneerData.ArtifactPower.EnableFishing and 'ON' or 'OFF')) | 69 self:Print('Show Underlight Angler:', (VeneerData.ArtifactPower.EnableFishing and 'ON' or 'OFF')) |
| 70 self:Update() | 70 self:Update() |
| 71 elseif arg == 'reset' then | 71 elseif arg == 'reset' then |
| 72 if self.db then | 72 if self.db then |
| 73 table.wipe(self.db.cache) | 73 self:ResetCache() |
| 74 table.wipe(self.db.fishingCache) | 74 end |
| 75 end | 75 self:Print('Forced refresh.') |
| 76 self:Print('Cache data reset.') | |
| 77 self:Update() | 76 self:Update() |
| 78 elseif arg:match('item') then | 77 elseif arg:match('item') then |
| 79 print('name', arg:match("^item (%S.+)")) | 78 print('name', arg:match("^item (%S.+)")) |
| 80 print('num', arg:match("Hitem:(%d+)")) | 79 print('num', arg:match("Hitem:(%d+)")) |
| 81 local linkOrID = arg:match("item:(%d+)") or arg:match("^item (%S+)") | 80 local linkOrID = arg:match("item:(%d+)") or arg:match("^item (%S+)") |
| 296 self:UpdateWorldQuestsAP() | 295 self:UpdateWorldQuestsAP() |
| 297 self:RegisterEvent('QUEST_LOG_UPDATE') | 296 self:RegisterEvent('QUEST_LOG_UPDATE') |
| 298 self.enabled = true | 297 self.enabled = true |
| 299 | 298 |
| 300 self:ScanAllBags() | 299 self:ScanAllBags() |
| 300 self:TryToShow() | |
| 301 self:Reanchor() | 301 self:Reanchor() |
| 302 end | 302 end |
| 303 function Module:OnHide() | 303 function Module:OnHide() |
| 304 print('|cFF88FF00OnHide()|r', debugstack()) | 304 print('|cFF88FF00OnHide()|r', debugstack()) |
| 305 self:UnregisterEvent('QUEST_LOG_UPDATE') | 305 self:UnregisterEvent('QUEST_LOG_UPDATE') |
| 340 | 340 |
| 341 function Module:OnEvent(event, ...) | 341 function Module:OnEvent(event, ...) |
| 342 --print('|cFF00FF88OnEvent()', event, ...) | 342 --print('|cFF00FF88OnEvent()', event, ...) |
| 343 if event == 'PLAYER_ENTERING_WORLD' then | 343 if event == 'PLAYER_ENTERING_WORLD' then |
| 344 self:TryToShow() | 344 self:TryToShow() |
| 345 | |
| 346 elseif event == 'UNIT_LEVEL' then | |
| 347 | |
| 348 if UnitLevel('player') == 110 then | |
| 349 self.profile.knowledgeMultiplier = 52 | |
| 350 end | |
| 351 | |
| 345 elseif event == 'BAG_UPDATE' then | 352 elseif event == 'BAG_UPDATE' then |
| 353 | |
| 346 local containerID = ... | 354 local containerID = ... |
| 347 self:QueueBag(containerID) | 355 self:QueueBag(containerID) |
| 348 elseif event == 'ITEM_LOCK_CHANGED' then | 356 elseif event == 'ITEM_LOCK_CHANGED' then |
| 349 | 357 |
| 350 local containerID, slotID = ... | 358 local containerID, slotID = ... |
| 355 end | 363 end |
| 356 | 364 |
| 357 | 365 |
| 358 elseif event == 'PLAYER_BANKSLOTS_CHANGED' then | 366 elseif event == 'PLAYER_BANKSLOTS_CHANGED' then |
| 359 self:ScanAllBags() | 367 self:ScanAllBags() |
| 368 self:TryToShow() | |
| 360 elseif event == 'BAG_UPDATE_DELAYED' then | 369 elseif event == 'BAG_UPDATE_DELAYED' then |
| 361 if not self.firstHit then | 370 if not self.firstHit then |
| 362 -- prevent double call from login | 371 -- prevent double call from login |
| 363 self.firstHit = true | 372 self.firstHit = true |
| 364 else | 373 else |
| 365 self:ScanAllBags() | 374 self:ScanAllBags() |
| 375 self:TryToShow() | |
| 366 end | 376 end |
| 367 elseif event == 'BANKFRAME_OPENED' then | 377 elseif event == 'BANKFRAME_OPENED' then |
| 368 self.bankAccess = true | 378 self.bankAccess = true |
| 369 self:ScanAllBags() | 379 self:ScanAllBags() |
| 380 self:TryToShow() | |
| 370 elseif event == 'BANKFRAME_CLOSED' then | 381 elseif event == 'BANKFRAME_CLOSED' then |
| 371 self.bankAccess = nil | 382 self.bankAccess = nil |
| 372 elseif event == 'ARTIFACT_UPDATE' then | 383 elseif event == 'ARTIFACT_UPDATE' then |
| 373 local newItem = ... | 384 local newItem = ... |
| 374 if newItem then | 385 if newItem then |
| 384 self:UpdateArtifactButtons() | 395 self:UpdateArtifactButtons() |
| 385 elseif event == 'PLAYER_REGEN_ENABLED' then | 396 elseif event == 'PLAYER_REGEN_ENABLED' then |
| 386 | 397 |
| 387 if self.queuedScan then | 398 if self.queuedScan then |
| 388 self:ScanAllBags(self.backAccess) | 399 self:ScanAllBags(self.backAccess) |
| 389 else | 400 end |
| 390 self:TryToShow() | 401 |
| 391 end | 402 self:TryToShow() |
| 392 | 403 |
| 393 if #queued_hooks >= 1 then | 404 if #queued_hooks >= 1 then |
| 394 CreateHook() | 405 CreateHook() |
| 395 end | 406 end |
| 396 elseif event == 'QUEST_LOG_UPDATE' then | 407 elseif event == 'QUEST_LOG_UPDATE' then |
| 462 print('|cFFFF4400Update()|r') | 473 print('|cFFFF4400Update()|r') |
| 463 return | 474 return |
| 464 end | 475 end |
| 465 print('|cFFFFFF00pdate()|r') | 476 print('|cFFFFFF00pdate()|r') |
| 466 | 477 |
| 478 | |
| 479 local level = UnitLevel('player') | |
| 480 if level ~= self.profile.playerLevel then | |
| 481 self.profile.playerLevel = level | |
| 482 self:ResetCache() | |
| 483 end | |
| 484 | |
| 485 | |
| 467 local numButtons = 0 | 486 local numButtons = 0 |
| 468 local contentsHeight = 16 | 487 local contentsHeight = 16 |
| 469 local contentsWidth = 400 | 488 local contentsWidth = 400 |
| 470 if self.profile.knowledgeMultiplier then | |
| 471 local artifactsWidth = self:UpdateArtifactButtons() | 489 local artifactsWidth = self:UpdateArtifactButtons() |
| 472 | 490 |
| 473 if artifactsWidth ~= 0 then | 491 if artifactsWidth ~= 0 then |
| 474 contentsHeight = contentsHeight + 64 | 492 contentsHeight = contentsHeight + 64 |
| 475 end | 493 end |
| 477 contentsWidth = max(contentsWidth, min(artifactsWidth, 400)) | 495 contentsWidth = max(contentsWidth, min(artifactsWidth, 400)) |
| 478 | 496 |
| 479 local itemsWidth, itemsHeight = self:UpdateItemButtons() | 497 local itemsWidth, itemsHeight = self:UpdateItemButtons() |
| 480 contentsHeight = contentsHeight + itemsHeight | 498 contentsHeight = contentsHeight + itemsHeight |
| 481 contentsWidth = max(contentsWidth, itemsWidth) | 499 contentsWidth = max(contentsWidth, itemsWidth) |
| 482 end | |
| 483 | 500 |
| 484 | 501 |
| 485 | 502 |
| 486 local bankText, bagText | 503 local bankText, bagText |
| 487 if not self.profile.knowledgeMultiplier then | 504 if artifactsWidth == 0 then |
| 488 bankText = '|cFF00FF00Shift-Right-Click an artifact weapon to start building data.' | 505 bankText = '|cFF00FF00Shift-Right-Click an artifact weapon to start building data.' |
| 489 elseif not (self.bankAP and self.bagAP) then | 506 elseif not (self.bankAP and self.bagAP) then |
| 490 bankText = '|cFFFF0000Open bank frame to count all AP|r ' | 507 bankText = '|cFFFF0000Open bank frame to count all AP|r ' |
| 491 else | 508 else |
| 492 | 509 |
| 952 function Module:ScanAllBags() | 969 function Module:ScanAllBags() |
| 953 if InCombatLockdown() then | 970 if InCombatLockdown() then |
| 954 self.queuedScan = true | 971 self.queuedScan = true |
| 955 return | 972 return |
| 956 end | 973 end |
| 957 if not self.profile.knowledgeMultiplier then | 974 |
| 958 print('need to get knowledge level') | 975 |
| 959 return | 976 |
| 960 end | |
| 961 | 977 |
| 962 self.queuedScan = nil | 978 self.queuedScan = nil |
| 963 | 979 |
| 964 print('|cFFFF0088ScanAllBags()|r', self.profile.knowledgeMultiplier) | 980 print('|cFFFF0088ScanAllBags()|r', self.profile.knowledgeMultiplier) |
| 965 | 981 |
| 1000 end | 1016 end |
| 1001 | 1017 |
| 1002 end | 1018 end |
| 1003 self.lastUpdate = GetTime() | 1019 self.lastUpdate = GetTime() |
| 1004 self.queuedScan = nil | 1020 self.queuedScan = nil |
| 1005 self:TryToShow() | |
| 1006 end | 1021 end |
| 1007 | 1022 |
| 1008 | 1023 |
| 1009 function Artifact:SetItem(itemID, artifact, index, equipped, fishing) | 1024 function Artifact:SetItem(itemID, artifact, index, equipped, fishing) |
| 1010 print('|cFF00FFFFSetItem()|r', itemID, index) | 1025 print('|cFF00FFFFSetItem()|r', itemID, index) |
| 1029 -- total total of invested and inventory XP | 1044 -- total total of invested and inventory XP |
| 1030 -- totalCost total of costs between current and actual level | 1045 -- totalCost total of costs between current and actual level |
| 1031 local actualXP = artifact.currentXP | 1046 local actualXP = artifact.currentXP |
| 1032 local actualLevel = artifact.level | 1047 local actualLevel = artifact.level |
| 1033 local actualCost = C_ArtifactUI.GetCostForPointAtRank(actualLevel, artifact.tier) | 1048 local actualCost = C_ArtifactUI.GetCostForPointAtRank(actualLevel, artifact.tier) |
| 1049 local actualTier = artifact.tier | |
| 1034 | 1050 |
| 1035 print('tier:', artifact.tier) | 1051 print('tier:', artifact.tier) |
| 1036 print('current:', self.level, self.currentXP, '/', self.currentCost) | 1052 print('current:', self.level, self.currentXP, '/', self.currentCost) |
| 1037 while (actualXP >= actualCost) and (actualCost > 0) do | 1053 while (actualXP >= actualCost) and (actualCost > 0) do |
| 1038 actualXP = actualXP - actualCost | 1054 actualXP = actualXP - actualCost |
| 1039 actualLevel = actualLevel + 1 | 1055 actualLevel = actualLevel + 1 |
| 1040 actualCost = C_ArtifactUI.GetCostForPointAtRank(actualLevel, artifact.tier) | 1056 if actualLevel == 35 then |
| 1041 | 1057 -- accomodate the auto-empowerment that occurs at 35 as of patch 7.3 |
| 1042 print('* ', actualLevel, actualXP, actualCost, totalCost) | 1058 actualTier = 2 |
| 1059 print('tier =', actualTier) | |
| 1060 end | |
| 1061 actualCost = C_ArtifactUI.GetCostForPointAtRank(actualLevel, actualTier) | |
| 1062 | |
| 1063 print('* ', actualLevel, actualXP, actualCost, actualCost) | |
| 1043 end | 1064 end |
| 1044 print('actual:', actualLevel, actualXP, '/', actualCost) | 1065 print('actual:', actualLevel, actualXP, '/', actualCost) |
| 1045 | 1066 |
| 1046 | 1067 |
| 1047 local totalXP = actualXP + unusedXP | 1068 local totalXP = actualXP + unusedXP |
| 1053 print(totalXP, totalCost) | 1074 print(totalXP, totalCost) |
| 1054 if remaining > nextCost then | 1075 if remaining > nextCost then |
| 1055 while (remaining >= nextCost) and (nextCost > 0) do | 1076 while (remaining >= nextCost) and (nextCost > 0) do |
| 1056 totalLevel = totalLevel + 1 | 1077 totalLevel = totalLevel + 1 |
| 1057 remaining = remaining - nextCost | 1078 remaining = remaining - nextCost |
| 1058 nextCost = C_ArtifactUI.GetCostForPointAtRank(totalLevel, artifact.tier) | 1079 nextCost = C_ArtifactUI.GetCostForPointAtRank(totalLevel, actualTier) |
| 1059 print('|cFFFFFF00+ ', totalLevel, remaining, '/', totalCost) | 1080 print('|cFFFFFF00+ ', totalLevel, remaining, '/', totalCost) |
| 1060 end | 1081 end |
| 1061 totalXP = remaining | 1082 totalXP = remaining |
| 1062 totalCost = nextCost | 1083 totalCost = nextCost |
| 1063 end | 1084 end |
| 1067 | 1088 |
| 1068 | 1089 |
| 1069 self.actualCost = actualCost | 1090 self.actualCost = actualCost |
| 1070 self.actualLevel = actualLevel | 1091 self.actualLevel = actualLevel |
| 1071 self.actualXP = actualXP | 1092 self.actualXP = actualXP |
| 1093 self.actualTier = actualTier | |
| 1072 | 1094 |
| 1073 self.totalXP = totalXP | 1095 self.totalXP = totalXP |
| 1074 self.totalCost = totalCost | 1096 self.totalCost = totalCost |
| 1075 self.totalLevel = totalLevel | 1097 self.totalLevel = totalLevel |
| 1098 self.totalTier = totalTier | |
| 1076 | 1099 |
| 1077 | 1100 |
| 1078 | 1101 |
| 1079 if index ~= 1 then | 1102 if index ~= 1 then |
| 1080 self:ClearAllPoints() | 1103 self:ClearAllPoints() |
