comparison Core.lua @ 133:a0894ffebd15 v62

Bug fixes and tweaks for 8.0.
author yellowfive
date Wed, 25 Jul 2018 12:17:24 -0700
parents d9a059484b22
children 6dc0e8e9f960
comparison
equal deleted inserted replaced
132:2279d58793c6 133:a0894ffebd15
135 end 135 end
136 136
137 local _enteredWorld = false 137 local _enteredWorld = false
138 local _pendingInit = false 138 local _pendingInit = false
139 139
140 function finishInitialize() 140 local function finishInitialize()
141 141
142 -- record region, the only thing that we still can't get from the log file 142 -- record region, the only thing that we still can't get from the log file
143 Amr.db.global.Region = Amr.RegionNames[GetCurrentRegion()] 143 Amr.db.global.Region = Amr.RegionNames[GetCurrentRegion()]
144 144
145 -- make sure that some initialization is deferred until after PLAYER_ENTERING_WORLD event so that data we need is available; 145 -- make sure that some initialization is deferred until after PLAYER_ENTERING_WORLD event so that data we need is available;
150 Amr:InitializeExport() 150 Amr:InitializeExport()
151 Amr:InitializeCombatLog() 151 Amr:InitializeCombatLog()
152 end) 152 end)
153 end 153 end
154 154
155 function onPlayerEnteringWorld() 155 local function onPlayerEnteringWorld()
156 156
157 _enteredWorld = true 157 _enteredWorld = true
158 158
159 if _pendingInit then 159 if _pendingInit then
160 finishInitialize() 160 finishInitialize()
498 498
499 -- could not find or ambiguous 499 -- could not find or ambiguous
500 return nil 500 return nil
501 end 501 end
502 502
503 503 --[[
504 -- search the tooltip for txt, returns true if it is encountered on any line 504 -- search the tooltip for txt, returns true if it is encountered on any line
505 function Amr:IsTextInTooltip(tt, txt) 505 function Amr:IsTextInTooltip(tt, txt)
506 local regions = { tt:GetRegions() } 506 local regions = { tt:GetRegions() }
507 for i, region in ipairs(regions) do 507 for i, region in ipairs(regions) do
508 if region and region:GetObjectType() == "FontString" then 508 if region and region:GetObjectType() == "FontString" then
511 end 511 end
512 end 512 end
513 end 513 end
514 return false 514 return false
515 end 515 end
516 ]]
516 517
517 -- helper to determine if we can equip an item (it is soulbound) 518 -- helper to determine if we can equip an item (it is soulbound)
518 function Amr:CanEquip(bagId, slotId) 519 function Amr:CanEquip(bagId, slotId)
519 local item = Item:CreateFromBagAndSlot(bagId, slotId) 520 local item = Item:CreateFromBagAndSlot(bagId, slotId)
520 if item then 521 if item then
530 --if self:IsTextInTooltip(tt, ITEM_BNETACCOUNTBOUND) then return true end 531 --if self:IsTextInTooltip(tt, ITEM_BNETACCOUNTBOUND) then return true end
531 --if self:IsTextInTooltip(tt, ITEM_ACCOUNTBOUND) then return true end 532 --if self:IsTextInTooltip(tt, ITEM_ACCOUNTBOUND) then return true end
532 end 533 end
533 534
534 -- helper to determine if an item has a unique constraint 535 -- helper to determine if an item has a unique constraint
536 --[[
535 function Amr:IsUnique(bagId, slotId) 537 function Amr:IsUnique(bagId, slotId)
536 local tt = Amr.GetItemTooltip(bagId, slotId) 538 local tt = Amr.GetItemTooltip(bagId, slotId)
537 if self:IsTextInTooltip(tt, ITEM_UNIQUE_EQUIPPABLE) then return true end 539 if self:IsTextInTooltip(tt, ITEM_UNIQUE_EQUIPPABLE) then return true end
538 if self:IsTextInTooltip(tt, ITEM_UNIQUE) then return true end 540 if self:IsTextInTooltip(tt, ITEM_UNIQUE) then return true end
539 return false 541 return false
540 end 542 end
543 ]]
541 544
542 545
543 ---------------------------------------------------------------------------------------- 546 ----------------------------------------------------------------------------------------
544 -- Inter-Addon Communication 547 -- Inter-Addon Communication
545 ---------------------------------------------------------------------------------------- 548 ----------------------------------------------------------------------------------------
645 return tostring(o) 648 return tostring(o)
646 end 649 end
647 end 650 end
648 651
649 function Amr:Test() 652 function Amr:Test()
650 653
651 --local itemLink = GetInventoryItemLink("player", 17) 654 end
652
653 --print(itemLink)
654
655 --local blah = Amr.ParseItemLink(itemLink)
656
657 --print(dump(blah.relicBonusIds))
658
659 --[[
660 --print(NUM_BANKBAGSLOTS)
661
662 local bagId = NUM_BAG_SLOTS + 1
663
664 local item = Item:CreateFromBagAndSlot(bagId, 2)
665 if item then
666 print(item:GetItemName())
667 else
668 print("no item")
669 end
670
671 local numSlots = GetContainerNumSlots(bagId)
672 print(numSlots .. " bag slots")
673 ]]
674
675 -- EquipItemByName
676
677 --[[
678 for slotId = 1, numSlots do
679 local _, itemCount, _, _, _, _, itemLink = GetContainerItemInfo(bagId, slotId)
680 if itemLink ~= nil then
681 print(slotId .. " " .. itemLink)
682 end
683 end
684 ]]
685
686 --[[
687 local s = "|cff0070dd|Hitem:127224:5337:0:0:0:0:0:0:100:105:512:22:2:615:656:100|h[Staff of Polarities]|h|r"
688 Amr.GetItemInfo(s, function(obj, name, link, quality, iLevel)
689 print(iLevel)
690 end)
691 ]]
692 end