yellowfive@57: local Amr = LibStub("AceAddon-3.0"):GetAddon("AskMrRobot") yellowfive@57: local L = LibStub("AceLocale-3.0"):GetLocale("AskMrRobot", true) yellowfive@57: local AceGUI = LibStub("AceGUI-3.0") yellowfive@57: yellowfive@57: local _lastExport = nil yellowfive@57: local _txt = nil yellowfive@57: yellowfive@57: local function createLabel(container, text, width) yellowfive@57: local lbl = AceGUI:Create("AmrUiLabel") yellowfive@57: lbl:SetWidth(width or 800) yellowfive@57: lbl:SetText(text) yellowfive@57: lbl:SetFont(Amr.CreateFont("Regular", 14, Amr.Colors.Text)) yellowfive@57: container:AddChild(lbl) yellowfive@57: return lbl yellowfive@57: end yellowfive@57: yellowfive@57: local function onSplashClose() yellowfive@57: Amr:HideCover() yellowfive@57: Amr.db.char.FirstUse = false yellowfive@57: end yellowfive@57: yellowfive@69: local function onTextChanged(widget) yellowfive@69: local val = _txt:GetText() yellowfive@69: if val == "overwolf-bib" then yellowfive@69: -- go to the gear tab, open import window, and show a cover yellowfive@69: Amr:ShowTab("Gear") yellowfive@69: Amr:ShowImportWindow(true) yellowfive@69: end yellowfive@69: end yellowfive@69: yellowfive@57: -- render a splash screen with first-time help yellowfive@57: local function renderSplash(container) yellowfive@57: local panel = Amr:RenderCoverChrome(container, 700, 450) yellowfive@57: yellowfive@57: local lbl = createLabel(panel, L.ExportSplashTitle, 650) yellowfive@57: lbl:SetJustifyH("CENTER") yellowfive@57: lbl:SetFont(Amr.CreateFont("Bold", 24, Amr.Colors.TextHeaderActive)) yellowfive@57: lbl:SetPoint("TOP", panel.content, "TOP", 0, -10) yellowfive@57: yellowfive@57: local lbl2 = createLabel(panel, L.ExportSplashSubtitle, 650) yellowfive@57: lbl2:SetJustifyH("CENTER") yellowfive@57: lbl2:SetFont(Amr.CreateFont("Bold", 18, Amr.Colors.TextTan)) yellowfive@57: lbl2:SetPoint("TOP", lbl.frame, "BOTTOM", 0, -20) yellowfive@57: yellowfive@57: lbl = createLabel(panel, L.ExportSplash1, 650) yellowfive@57: lbl:SetFont(Amr.CreateFont("Regular", 14, Amr.Colors.Text)) yellowfive@57: lbl:SetPoint("TOPLEFT", lbl2.frame, "BOTTOMLEFT", 0, -70) yellowfive@57: yellowfive@57: lbl2 = createLabel(panel, L.ExportSplash2, 650) yellowfive@57: lbl2:SetFont(Amr.CreateFont("Regular", 14, Amr.Colors.Text)) yellowfive@57: lbl2:SetPoint("TOPLEFT", lbl.frame, "BOTTOMLEFT", 0, -15) yellowfive@57: yellowfive@57: lbl = createLabel(panel, L.ExportSplash3, 650) yellowfive@57: lbl:SetFont(Amr.CreateFont("Regular", 14, Amr.Colors.Text)) yellowfive@57: lbl:SetPoint("TOPLEFT", lbl2.frame, "BOTTOMLEFT", 0, -15) yellowfive@81: yellowfive@81: lbl2 = createLabel(panel, L.ExportSplash4, 650) yellowfive@81: lbl2:SetFont(Amr.CreateFont("Regular", 14, Amr.Colors.Text)) yellowfive@81: lbl2:SetPoint("TOPLEFT", lbl.frame, "BOTTOMLEFT", 0, -15) yellowfive@57: yellowfive@57: local btn = AceGUI:Create("AmrUiButton") yellowfive@57: btn:SetText(L.ExportSplashClose) yellowfive@57: btn:SetBackgroundColor(Amr.Colors.Green) yellowfive@57: btn:SetFont(Amr.CreateFont("Bold", 16, Amr.Colors.White)) yellowfive@57: btn:SetWidth(120) yellowfive@57: btn:SetHeight(28) yellowfive@57: btn:SetPoint("BOTTOM", panel.content, "BOTTOM", 0, 20) yellowfive@57: btn:SetCallback("OnClick", onSplashClose) yellowfive@57: panel:AddChild(btn) yellowfive@57: end yellowfive@57: yellowfive@57: -- renders the main UI for the Export tab yellowfive@57: function Amr:RenderTabExport(container) yellowfive@57: yellowfive@57: local lbl = createLabel(container, L.ExportTitle) yellowfive@57: lbl:SetFont(Amr.CreateFont("Bold", 24, Amr.Colors.TextHeaderActive)) yellowfive@57: lbl:SetPoint("TOPLEFT", container.content, "TOPLEFT", 0, -40) yellowfive@57: yellowfive@57: local lbl2 = createLabel(container, L.ExportHelp1) yellowfive@57: lbl2:SetPoint("TOPLEFT", lbl.frame, "BOTTOMLEFT", 0, -10) yellowfive@57: yellowfive@57: lbl = createLabel(container, L.ExportHelp2) yellowfive@57: lbl:SetPoint("TOPLEFT", lbl2.frame, "BOTTOMLEFT", 0, -10) yellowfive@57: yellowfive@57: lbl2 = createLabel(container, L.ExportHelp3) yellowfive@57: lbl2:SetPoint("TOPLEFT", lbl.frame, "BOTTOMLEFT", 0, -10) yellowfive@57: yellowfive@57: _txt = AceGUI:Create("AmrUiTextarea") yellowfive@57: _txt:SetWidth(800) yellowfive@57: _txt:SetHeight(300) yellowfive@81: _txt:SetPoint("TOP", lbl2.frame, "BOTTOM", 0, -20) yellowfive@57: _txt:SetFont(Amr.CreateFont("Regular", 12, Amr.Colors.Text)) yellowfive@69: _txt:SetCallback("OnTextChanged", onTextChanged) yellowfive@57: container:AddChild(_txt) yellowfive@57: yellowfive@57: local data = self:ExportCharacter() yellowfive@57: local txt = Amr.Serializer:SerializePlayerData(data, true) yellowfive@57: _txt:SetText(txt) yellowfive@57: _txt:SetFocus(true) yellowfive@57: yellowfive@57: -- update shopping list data yellowfive@57: Amr:UpdateShoppingData(data) yellowfive@57: yellowfive@57: -- show help splash if first time a user is using this yellowfive@57: if Amr.db.char.FirstUse then yellowfive@57: Amr:ShowCover(renderSplash) yellowfive@57: AceGUI:ClearFocus() yellowfive@57: end yellowfive@57: end yellowfive@57: yellowfive@57: function Amr:ReleaseTabExport() yellowfive@57: end yellowfive@57: yellowfive@57: function Amr:GetExportText() yellowfive@57: return _txt:GetText() yellowfive@57: end yellowfive@57: yellowfive@57: yellowfive@57: -- use some local variables to deal with the fact that a user can close the bank before a scan completes yellowfive@57: local _lastBankBagId = nil yellowfive@57: local _lastBankSlotId = nil yellowfive@57: yellowfive@57: local function scanBag(bagId, isBank, bagTable, bagItemsWithCount) yellowfive@57: local numSlots = GetContainerNumSlots(bagId) yellowfive@57: for slotId = 1, numSlots do yellowfive@57: local _, itemCount, _, _, _, _, itemLink = GetContainerItemInfo(bagId, slotId) yellowfive@57: if itemLink ~= nil then yellowfive@57: local itemData = Amr.Serializer.ParseItemLink(itemLink) yellowfive@57: if itemData ~= nil then yellowfive@85: yellowfive@57: -- only add equippable items to bag data yellowfive@85: --if IsEquippableItem(itemLink) or Amr.SetTokenIds[itemData.id] then yellowfive@57: if isBank then yellowfive@57: _lastBankBagId = bagId yellowfive@57: _lastBankSlotId = slotId yellowfive@57: end yellowfive@57: yellowfive@57: table.insert(bagTable, itemLink) yellowfive@85: --end yellowfive@57: yellowfive@57: -- all items and counts, used for e.g. shopping list and reagents, etc. yellowfive@57: if bagItemsWithCount then yellowfive@57: if bagItemsWithCount[itemData.id] then yellowfive@57: bagItemsWithCount[itemData.id] = bagItemsWithCount[itemData.id] + itemCount yellowfive@57: else yellowfive@57: bagItemsWithCount[itemData.id] = itemCount yellowfive@57: end yellowfive@57: end yellowfive@57: end yellowfive@57: end yellowfive@57: end yellowfive@57: end yellowfive@57: yellowfive@57: -- get the player's current gear and save it, also returns the data from GetPlayerData for efficiency yellowfive@57: local function getEquipped() yellowfive@81: local data = Amr.Serializer:GetPlayerData() yellowfive@81: local spec = GetSpecialization() yellowfive@57: yellowfive@57: Amr.db.char.Equipped[spec] = data.Equipped[spec] yellowfive@57: yellowfive@57: return data yellowfive@57: end yellowfive@57: yellowfive@57: local function scanBags() yellowfive@57: yellowfive@57: local bagItems = {} yellowfive@57: local itemsAndCounts = {} yellowfive@57: yellowfive@57: scanBag(BACKPACK_CONTAINER, false, bagItems, itemsAndCounts) -- backpack yellowfive@57: for bagId = 1, NUM_BAG_SLOTS do yellowfive@57: scanBag(bagId, false, bagItems, itemsAndCounts) yellowfive@57: end yellowfive@57: yellowfive@57: Amr.db.char.BagItems = bagItems yellowfive@57: Amr.db.char.BagItemsAndCounts = itemsAndCounts yellowfive@57: end yellowfive@57: yellowfive@57: -- scan the player's bank and save the contents, must be at the bank yellowfive@57: local function scanBank() yellowfive@57: yellowfive@57: local bankItems = {} yellowfive@57: local itemsAndCounts = {} yellowfive@57: yellowfive@57: scanBag(BANK_CONTAINER, true, bankItems, itemsAndCounts) yellowfive@57: scanBag(REAGENTBANK_CONTAINER, true, bankItems, itemsAndCounts) yellowfive@57: for bagId = NUM_BAG_SLOTS + 1, NUM_BAG_SLOTS + NUM_BANKBAGSLOTS do yellowfive@57: scanBag(bagId, true, bankItems, itemsAndCounts) yellowfive@57: end yellowfive@57: yellowfive@57: -- see if the scan completed before the window closed, otherwise we don't overwrite with partial data yellowfive@57: if _lastBankBagId ~= nil then yellowfive@57: local itemLink = GetContainerItemLink(_lastBankBagId, _lastBankSlotId) yellowfive@57: if itemLink ~= nil then --still open yellowfive@57: Amr.db.char.BankItems = bankItems yellowfive@57: Amr.db.char.BankItemsAndCounts = itemsAndCounts yellowfive@57: end yellowfive@57: end yellowfive@57: yellowfive@57: end yellowfive@57: yellowfive@57: -- scan the player's void storage and save the contents, must be at void storage yellowfive@57: local function scanVoid() yellowfive@57: yellowfive@57: if IsVoidStorageReady() then yellowfive@57: local voidItems = {} yellowfive@57: local VOID_STORAGE_MAX = 80 yellowfive@57: local VOID_STORAGE_PAGES = 2 yellowfive@57: yellowfive@57: for page = 1,VOID_STORAGE_PAGES do yellowfive@57: for i = 1,VOID_STORAGE_MAX do yellowfive@57: local itemId = GetVoidItemInfo(page, i) yellowfive@57: if itemId then yellowfive@57: local itemLink = GetVoidItemHyperlinkString(((page - 1) * VOID_STORAGE_MAX) + i); yellowfive@57: if itemLink then yellowfive@57: tinsert(voidItems, itemLink) yellowfive@57: end yellowfive@57: end yellowfive@57: end yellowfive@57: end yellowfive@57: yellowfive@57: Amr.db.char.VoidItems = voidItems yellowfive@57: end yellowfive@57: yellowfive@57: end yellowfive@57: yellowfive@57: local function getRepStanding(factionId) yellowfive@57: local name, description, standingId, _ = GetFactionInfoByID(factionId) yellowfive@57: return standingId - 1; -- our rep enum correspond to what the armory returns, are 1 less than what the game returns yellowfive@57: end yellowfive@57: yellowfive@57: local function getReputations() yellowfive@57: local reps = {} yellowfive@57: yellowfive@57: local repList = {1375,1376,1270,1269,1341,1337,1387,1388,1435} yellowfive@57: for i, repId in pairs(repList) do yellowfive@57: local standing = getRepStanding(repId) yellowfive@57: if standing >= 0 then yellowfive@57: reps[repId] = standing yellowfive@57: end yellowfive@57: end yellowfive@57: yellowfive@57: return reps yellowfive@57: end yellowfive@57: yellowfive@81: local function scanTalents() yellowfive@81: local specPos = GetSpecialization() yellowfive@81: if not specPos or specPos < 1 or specPos > 4 then return end yellowfive@81: yellowfive@81: local talentInfo = {} yellowfive@81: local maxTiers = 7 yellowfive@81: for tier = 1, maxTiers do yellowfive@81: for col = 1, 3 do yellowfive@81: local id, name, _, _, _, spellId, _, t, c, selected = GetTalentInfoBySpecialization(specPos, tier, col) yellowfive@81: if selected then yellowfive@81: talentInfo[tier] = col yellowfive@81: end yellowfive@81: end yellowfive@81: end yellowfive@81: yellowfive@81: local str = "" yellowfive@81: for i = 1, maxTiers do yellowfive@81: if talentInfo[i] then yellowfive@81: str = str .. talentInfo[i] yellowfive@81: else yellowfive@81: str = str .. '0' yellowfive@81: end yellowfive@81: end yellowfive@81: yellowfive@81: Amr.db.char.Talents[specPos] = str yellowfive@81: end yellowfive@81: yellowfive@112: local function scanCrucible() yellowfive@112: if not Amr.db or not Amr.db.char or not Amr.db.char.Artifacts or not C_ArtifactRelicForgeUI or not C_ArtifactRelicForgeUI.GetSocketedRelicTalents then return end yellowfive@112: yellowfive@112: local equipped = {} yellowfive@112: local preview = nil yellowfive@112: yellowfive@112: for i = 1,4 do yellowfive@112: local talents = nil yellowfive@112: if i == 4 then yellowfive@112: talents = C_ArtifactRelicForgeUI.GetPreviewRelicTalents() yellowfive@112: --talents = nil yellowfive@112: else yellowfive@112: talents = C_ArtifactRelicForgeUI.GetSocketedRelicTalents(i) yellowfive@112: yellowfive@112: --[[ yellowfive@114: -- test data yellowfive@112: if i == 1 then yellowfive@112: talents = {} yellowfive@112: table.insert(talents, { yellowfive@112: powerID = 1739, yellowfive@112: isChosen = true yellowfive@112: }) yellowfive@112: table.insert(talents, { yellowfive@112: powerID = 1781, yellowfive@112: isChosen = true yellowfive@112: }) yellowfive@112: table.insert(talents, { yellowfive@112: powerID = 1770, yellowfive@112: isChosen = false yellowfive@112: }) yellowfive@112: table.insert(talents, { yellowfive@112: powerID = 791, yellowfive@112: isChosen = false yellowfive@112: }) yellowfive@112: table.insert(talents, { yellowfive@112: powerID = 786, yellowfive@112: isChosen = false yellowfive@112: }) yellowfive@112: table.insert(talents, { yellowfive@112: powerID = 1537, yellowfive@112: isChosen = false yellowfive@112: }) yellowfive@112: end yellowfive@112: ]] yellowfive@112: end yellowfive@112: yellowfive@112: if talents then yellowfive@112: local obj = { yellowfive@112: Powers = {}, yellowfive@112: Active = {} yellowfive@112: } yellowfive@112: yellowfive@112: if i == 4 then yellowfive@112: obj.ItemLink = C_ArtifactRelicForgeUI.GetPreviewRelicItemLink() yellowfive@112: if not obj.ItemLink then yellowfive@112: talents = nil yellowfive@112: else yellowfive@112: preview = obj yellowfive@112: end yellowfive@112: else yellowfive@112: table.insert(equipped, obj) yellowfive@112: end yellowfive@112: yellowfive@112: if talents then yellowfive@112: for k,v in ipairs(talents) do yellowfive@112: table.insert(obj.Powers, v.powerID) yellowfive@112: table.insert(obj.Active, v.isChosen) yellowfive@112: end yellowfive@112: end yellowfive@112: yellowfive@112: elseif i ~= 4 then yellowfive@112: table.insert(equipped, {}) yellowfive@112: end yellowfive@112: end yellowfive@112: yellowfive@112: yellowfive@112: local itemID = C_ArtifactUI.GetArtifactInfo() yellowfive@112: local spec = Amr.ArtifactIdToSpecNumber[itemID] yellowfive@112: yellowfive@112: if spec then yellowfive@112: yellowfive@112: -- sometimes this event can fire when no crucible data is available, don't overwrite non-blank crucible data with blank crucible data yellowfive@112: if Amr.db.char.Artifacts[spec] then yellowfive@112: local oldCrucible = Amr.db.char.Artifacts[spec].Crucible yellowfive@112: if oldCrucible then yellowfive@112: if #oldCrucible.Equipped > 0 and oldCrucible.Equipped[1] and not equipped[1] then yellowfive@112: return yellowfive@112: end yellowfive@112: end yellowfive@112: end yellowfive@112: yellowfive@112: local dataz = Amr.db.char.Artifacts[spec] yellowfive@112: if not dataz then yellowfive@112: dataz = {} yellowfive@112: Amr.db.char.Artifacts[spec] = dataz yellowfive@112: end yellowfive@112: yellowfive@112: if not dataz.Crucible then yellowfive@112: dataz.Crucible = { yellowfive@112: Equipped = {}, yellowfive@114: Previewed = {} yellowfive@112: } yellowfive@112: end yellowfive@112: yellowfive@112: local crucible = dataz.Crucible yellowfive@112: crucible.Equipped = equipped yellowfive@112: if preview then yellowfive@114: local previewKey = {} yellowfive@114: table.insert(previewKey, preview.ItemLink) yellowfive@114: for i,v in ipairs(preview.Powers) do yellowfive@114: table.insert(previewKey, v .. "=" .. tostring(preview.Active[i])) yellowfive@114: end yellowfive@114: previewKey = table.concat(previewKey, "_") yellowfive@114: yellowfive@116: if not crucible.Previewed then yellowfive@116: crucible.Previewed = {} yellowfive@116: end yellowfive@114: crucible.Previewed[previewKey] = preview yellowfive@112: end yellowfive@112: end yellowfive@112: end yellowfive@112: yellowfive@114: local function pruneCrucible() yellowfive@114: if not Amr.db or not Amr.db.char or not Amr.db.char.Artifacts then return end yellowfive@114: yellowfive@114: local spec = GetSpecialization() yellowfive@114: local dataz = Amr.db.char.Artifacts[spec] yellowfive@114: if not dataz or not dataz.Crucible then return end yellowfive@114: yellowfive@114: local crucible = dataz.Crucible yellowfive@114: yellowfive@114: -- this was old format, transform to new format yellowfive@114: if crucible.Inventory then yellowfive@114: if not crucible.Previewed then yellowfive@114: crucible.Previewed = {} yellowfive@114: end yellowfive@114: yellowfive@114: for link,preview in pairs(crucible.Inventory) do yellowfive@114: local previewKey = {} yellowfive@114: table.insert(previewKey, preview.ItemLink) yellowfive@114: for i,v in ipairs(preview.Powers) do yellowfive@114: table.insert(previewKey, v .. "=" .. tostring(preview.Active[i])) yellowfive@114: end yellowfive@114: previewKey = table.concat(previewKey, "_") yellowfive@114: yellowfive@114: crucible.Previewed[previewKey] = preview yellowfive@114: end yellowfive@114: yellowfive@114: crucible.Inventory = nil yellowfive@114: end yellowfive@114: yellowfive@114: -- get a hash of every owned, but not-equipped item yellowfive@114: local ownedItems = {} yellowfive@114: if Amr.db.char.BagItems then yellowfive@114: for i,link in ipairs(Amr.db.char.BagItems) do yellowfive@114: ownedItems[link] = true yellowfive@114: end yellowfive@114: end yellowfive@114: if Amr.db.char.BankItems then yellowfive@114: for i,link in ipairs(Amr.db.char.BankItems) do yellowfive@114: ownedItems[link] = true yellowfive@114: end yellowfive@114: end yellowfive@114: if Amr.db.char.VoidItems then yellowfive@114: for i,link in ipairs(Amr.db.char.VoidItems) do yellowfive@114: ownedItems[link] = true yellowfive@114: end yellowfive@114: end yellowfive@114: yellowfive@114: -- prune out any previewed relics that the player no longer owns yellowfive@114: if crucible.Previewed then yellowfive@114: local toRemove = {} yellowfive@114: for k,v in pairs(crucible.Previewed) do yellowfive@114: if not ownedItems[v.ItemLink] then yellowfive@114: table.insert(toRemove, k) yellowfive@114: end yellowfive@114: end yellowfive@114: for i,v in ipairs(toRemove) do yellowfive@114: crucible.Previewed[v] = nil yellowfive@114: end yellowfive@114: end yellowfive@114: yellowfive@114: end yellowfive@114: yellowfive@81: local function scanArtifact() yellowfive@91: if not Amr.db or not Amr.db.char or not Amr.db.char.Artifacts then return end yellowfive@91: yellowfive@81: local powers = C_ArtifactUI.GetPowers() yellowfive@81: if not powers then return end yellowfive@81: yellowfive@81: local powerRanks = {} yellowfive@81: for k,v in pairs(powers) do yellowfive@106: local powerInfo = C_ArtifactUI.GetPowerInfo(v) yellowfive@106: if powerInfo.currentRank - powerInfo.bonusRanks > 0 then yellowfive@106: powerRanks[v] = powerInfo.currentRank - powerInfo.bonusRanks yellowfive@81: end yellowfive@81: end yellowfive@81: yellowfive@81: local relicInfo = {} yellowfive@81: for i = 1,3 do yellowfive@81: local _, _, _, link = C_ArtifactUI.GetRelicInfo(i); yellowfive@81: table.insert(relicInfo, link or "") yellowfive@81: end yellowfive@81: yellowfive@81: -- make sure that the artifact UI didn't get closed while we were reading it, GetPowers seems to return nil unless it is open yellowfive@81: powers = C_ArtifactUI.GetPowers() yellowfive@81: if not powers then return end yellowfive@81: yellowfive@89: -- use the artifact item ID to figure out which spec this is for, since you can open your artifact on any spec yellowfive@91: local itemID = C_ArtifactUI.GetArtifactInfo() yellowfive@89: local spec = Amr.ArtifactIdToSpecNumber[itemID] yellowfive@89: --local spec = GetSpecialization() yellowfive@89: yellowfive@91: if spec then yellowfive@112: yellowfive@112: -- sometimes this event can fire when no relic data is available, don't overwrite non-blank relic data with blank relic data yellowfive@112: if Amr.db.char.Artifacts[spec] then yellowfive@112: local oldRelics = Amr.db.char.Artifacts[spec].Relics yellowfive@112: if oldRelics then yellowfive@112: for i = 1,3 do yellowfive@112: if oldRelics[i] and oldRelics[i] ~= "" and (not relicInfo[i] or relicInfo[i] == "") then yellowfive@112: relicInfo[i] = oldRelics[i] yellowfive@112: end yellowfive@112: end yellowfive@112: end yellowfive@112: end yellowfive@112: yellowfive@112: local dataz = Amr.db.char.Artifacts[spec] yellowfive@112: if not dataz then yellowfive@112: dataz = {} yellowfive@112: Amr.db.char.Artifacts[spec] = dataz yellowfive@112: end yellowfive@112: yellowfive@112: if not dataz.Crucible then yellowfive@112: dataz.Crucible = { yellowfive@112: Equipped = {}, yellowfive@112: Inventory = {} yellowfive@112: } yellowfive@112: end yellowfive@112: yellowfive@112: dataz.Powers = powerRanks yellowfive@112: dataz.Relics = relicInfo yellowfive@112: yellowfive@91: end yellowfive@112: yellowfive@112: --scanCrucible() yellowfive@81: end yellowfive@81: yellowfive@57: -- Returns a data object containing all information about the current player needed for an export: yellowfive@57: -- gear, spec, reputations, bag, bank, and void storage items. yellowfive@57: function Amr:ExportCharacter() yellowfive@57: yellowfive@57: local data = getEquipped() yellowfive@57: scanBags() yellowfive@57: yellowfive@81: -- scan current spec's talents just before exporting yellowfive@81: scanTalents() yellowfive@81: yellowfive@114: -- prune crucible info just before each time we export yellowfive@114: pruneCrucible() yellowfive@114: yellowfive@81: data.Talents = Amr.db.char.Talents yellowfive@81: data.Artifacts = Amr.db.char.Artifacts yellowfive@57: data.Equipped = Amr.db.char.Equipped yellowfive@57: data.Reputations = getReputations() yellowfive@57: data.BagItems = Amr.db.char.BagItems yellowfive@57: data.BankItems = Amr.db.char.BankItems yellowfive@57: data.VoidItems = Amr.db.char.VoidItems yellowfive@57: yellowfive@57: return data yellowfive@57: end yellowfive@57: yellowfive@57: function Amr:InitializeExport() yellowfive@57: Amr:AddEventHandler("UNIT_INVENTORY_CHANGED", function(unitID) yellowfive@57: if unitID and unitID ~= "player" then return end yellowfive@57: getEquipped() yellowfive@57: end) yellowfive@57: end yellowfive@57: yellowfive@57: Amr:AddEventHandler("BANKFRAME_OPENED", scanBank) yellowfive@57: Amr:AddEventHandler("PLAYERBANKSLOTS_CHANGED", scanBank) yellowfive@57: yellowfive@57: Amr:AddEventHandler("VOID_STORAGE_OPEN", scanVoid) yellowfive@57: Amr:AddEventHandler("VOID_STORAGE_CONTENTS_UPDATE", scanVoid) yellowfive@57: Amr:AddEventHandler("VOID_STORAGE_DEPOSIT_UPDATE", scanVoid) yellowfive@57: Amr:AddEventHandler("VOID_STORAGE_UPDATE", scanVoid) yellowfive@81: yellowfive@81: Amr:AddEventHandler("PLAYER_TALENT_UPDATE", scanTalents) yellowfive@81: Amr:AddEventHandler("ARTIFACT_UPDATE", scanArtifact) yellowfive@112: Amr:AddEventHandler("ARTIFACT_RELIC_FORGE_UPDATE", scanCrucible) yellowfive@112: Amr:AddEventHandler("ARTIFACT_RELIC_FORGE_PREVIEW_RELIC_CHANGED", scanCrucible)