Mercurial > wow > askmrrobot
changeset 133:a0894ffebd15 v62
Bug fixes and tweaks for 8.0.
author | yellowfive |
---|---|
date | Wed, 25 Jul 2018 12:17:24 -0700 |
parents | 2279d58793c6 |
children | 41cf09da376d |
files | AskMrRobot-Serializer/AskMrRobot-Serializer.lua AskMrRobot.toc CombatLog.lua Constants.lua Core.lua Gear.lua Import.lua Libs/LibDBIcon-1.0/LibDBIcon-1.0.lua Options.lua Shopping.lua ui/AmrUiButton.lua ui/AmrUiCheckBox.lua ui/AmrUiDropDown.lua ui/AmrUiFrame.lua ui/AmrUiLabel.lua ui/AmrUiScrollFrame.lua ui/AmrUiTabGroup.lua ui/AmrUiTextButton.lua ui/Ui.lua |
diffstat | 19 files changed, 96 insertions(+), 153 deletions(-) [+] |
line wrap: on
line diff
--- a/AskMrRobot-Serializer/AskMrRobot-Serializer.lua Wed Jul 18 16:44:04 2018 -0700 +++ b/AskMrRobot-Serializer/AskMrRobot-Serializer.lua Wed Jul 25 12:17:24 2018 -0700 @@ -1,6 +1,6 @@ -- AskMrRobot-Serializer will serialize and communicate character data between users. -local MAJOR, MINOR = "AskMrRobot-Serializer", 61 +local MAJOR, MINOR = "AskMrRobot-Serializer", 62 local Amr, oldminor = LibStub:NewLibrary(MAJOR, MINOR) if not Amr then return end -- already loaded by something else @@ -284,34 +284,11 @@ -- returns true if currently in a supported instance for logging function Amr.IsSupportedInstance() - local zone, _, difficultyIndex, _, _, _, _, instanceMapID = GetInstanceInfo() + local _, _, _, _, _, _, _, instanceMapID = GetInstanceInfo() return Amr.IsSupportedInstanceId(instanceMapID) end --- helper to iterate over a table in order by its keys -local function spairs(t, order) - -- collect the keys - local keys = {} - for k in pairs(t) do keys[#keys+1] = k end - - -- if order function given, sort by it by passing the table and keys a, b, - -- otherwise just sort the keys - if order then - table.sort(keys, function(a,b) return order(t, a, b) end) - else - table.sort(keys) - end - - -- return the iterator function - local i = 0 - return function() - i = i + 1 - if keys[i] then - return keys[i], t[keys[i]] - end - end -end - +--[[ -- scanning tooltip b/c for some odd reason the api has no way to get basic item properties... -- so you have to generate a fake item tooltip and search for pre-defined strings in the display text local _scanTt @@ -336,7 +313,9 @@ end return tt end +]] +--[[ function Amr.GetItemLevel(bagId, slotId, link) local itemLevelPattern = _G["ITEM_LEVEL"]:gsub("%%d", "(%%d+)") local tt = Amr.GetItemTooltip(bagId, slotId, link) @@ -357,6 +336,7 @@ -- 0 means we couldn't find it for whatever reason return 0 end +]] ---------------------------------------------------------------------------------------- @@ -365,7 +345,7 @@ local function readProfessionInfo(prof, ret) if prof then - local name, icon, skillLevel, maxSkillLevel, numAbilities, spelloffset, skillLine, skillModifier = GetProfessionInfo(prof); + local _, _, skillLevel, _, _, _, skillLine = GetProfessionInfo(prof); if Amr.ProfessionSkillLineToName[skillLine] ~= nil then ret.Professions[Amr.ProfessionSkillLineToName[skillLine]] = skillLevel; end @@ -489,10 +469,10 @@ ret.Level = UnitLevel("player"); readHeartOfAzerothLevel(ret) - local cls, clsEn = UnitClass("player") + local _, clsEn = UnitClass("player") ret.Class = clsEn; - local race, raceEn = UnitRace("player") + local _, raceEn = UnitRace("player") ret.Race = raceEn; ret.Faction = UnitFactionGroup("player")
--- a/AskMrRobot.toc Wed Jul 18 16:44:04 2018 -0700 +++ b/AskMrRobot.toc Wed Jul 25 12:17:24 2018 -0700 @@ -1,7 +1,7 @@ ## Interface: 80000 ## Title: Ask Mr. Robot ## Author: Team Robot, Inc. -## Version: 61 +## Version: 62 ## Notes: Gear import/export, combat logging, and more. ## URL: www.askmrrobot.com ## SavedVariables: AskMrRobotDb4
--- a/CombatLog.lua Wed Jul 18 16:44:04 2018 -0700 +++ b/CombatLog.lua Wed Jul 25 12:17:24 2018 -0700 @@ -2,6 +2,7 @@ local L = LibStub("AceLocale-3.0"):GetLocale("AskMrRobot", true) local AceGUI = LibStub("AceGUI-3.0") +local _lblLogging = nil local _btnToggle = nil local _panelUndoWipe = nil local _chkAutoAll = nil @@ -215,6 +216,7 @@ end function Amr:ReleaseTabLog() + _lblLogging = nil _btnToggle = nil _panelUndoWipe = nil _chkAutoAll = nil
--- a/Constants.lua Wed Jul 18 16:44:04 2018 -0700 +++ b/Constants.lua Wed Jul 25 12:17:24 2018 -0700 @@ -21,8 +21,8 @@ Amr.ParseItemLink = Amr.Serializer.ParseItemLink Amr.IsSupportedInstanceId = Amr.Serializer.IsSupportedInstanceId Amr.IsSupportedInstance = Amr.Serializer.IsSupportedInstance -Amr.GetItemTooltip = Amr.Serializer.GetItemTooltip -Amr.GetItemLevel = Amr.Serializer.GetItemLevel +--Amr.GetItemTooltip = Amr.Serializer.GetItemTooltip +--Amr.GetItemLevel = Amr.Serializer.GetItemLevel Amr.GetItemUniqueId = Amr.Serializer.GetItemUniqueId Amr.ReadAzeritePowers = Amr.Serializer.ReadAzeritePowers @@ -193,7 +193,7 @@ return table.concat(parts, ":") end - +--[[ -- the server event for getting item info does not specify which item it just fetched... have to track manually local _pendingItemIds = {} @@ -237,3 +237,4 @@ end end end) +]] \ No newline at end of file
--- a/Core.lua Wed Jul 18 16:44:04 2018 -0700 +++ b/Core.lua Wed Jul 25 12:17:24 2018 -0700 @@ -137,7 +137,7 @@ local _enteredWorld = false local _pendingInit = false -function finishInitialize() +local function finishInitialize() -- record region, the only thing that we still can't get from the log file Amr.db.global.Region = Amr.RegionNames[GetCurrentRegion()] @@ -152,7 +152,7 @@ end) end -function onPlayerEnteringWorld() +local function onPlayerEnteringWorld() _enteredWorld = true @@ -500,7 +500,7 @@ return nil end - +--[[ -- search the tooltip for txt, returns true if it is encountered on any line function Amr:IsTextInTooltip(tt, txt) local regions = { tt:GetRegions() } @@ -513,6 +513,7 @@ end return false end +]] -- helper to determine if we can equip an item (it is soulbound) function Amr:CanEquip(bagId, slotId) @@ -532,12 +533,14 @@ end -- helper to determine if an item has a unique constraint +--[[ function Amr:IsUnique(bagId, slotId) local tt = Amr.GetItemTooltip(bagId, slotId) if self:IsTextInTooltip(tt, ITEM_UNIQUE_EQUIPPABLE) then return true end if self:IsTextInTooltip(tt, ITEM_UNIQUE) then return true end return false end +]] ---------------------------------------------------------------------------------------- @@ -647,46 +650,5 @@ end function Amr:Test() - - --local itemLink = GetInventoryItemLink("player", 17) - - --print(itemLink) - --local blah = Amr.ParseItemLink(itemLink) - - --print(dump(blah.relicBonusIds)) - - --[[ - --print(NUM_BANKBAGSLOTS) - - local bagId = NUM_BAG_SLOTS + 1 - - local item = Item:CreateFromBagAndSlot(bagId, 2) - if item then - print(item:GetItemName()) - else - print("no item") - end - - local numSlots = GetContainerNumSlots(bagId) - print(numSlots .. " bag slots") - ]] - - -- EquipItemByName - - --[[ - for slotId = 1, numSlots do - local _, itemCount, _, _, _, _, itemLink = GetContainerItemInfo(bagId, slotId) - if itemLink ~= nil then - print(slotId .. " " .. itemLink) - end - end - ]] - - --[[ - 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" - Amr.GetItemInfo(s, function(obj, name, link, quality, iLevel) - print(iLevel) - end) - ]] end
--- a/Gear.lua Wed Jul 18 16:44:04 2018 -0700 +++ b/Gear.lua Wed Jul 25 12:17:24 2018 -0700 @@ -251,7 +251,7 @@ local slotId = Amr.SlotIds[slotNum] local equippedItem = equipped and equipped[slotId] or nil - local equippedItemLink = equipped and equipped.link or nil + --local equippedItemLink = equipped and equipped.link or nil local optimalItem = gear[slotId] local optimalItemLink = Amr.CreateItemLink(optimalItem) @@ -298,43 +298,24 @@ lblItem:SetWidth(345) lblItem:SetFont(Amr.CreateFont(isEquipped and "Regular" or "Bold", isEquipped and 14 or 15, Amr.Colors.White)) - -- fill the name/ilvl labels, which may require asynchronous loading of item information + -- fill the name/ilvl labels, which may require asynchronous loading of item information if optimalItemLink then - Amr.GetItemInfo(optimalItemLink, function(obj, name, link, quality, iLevel) - -- set item name, tooltip, and ilvl - obj.nameLabel:SetText(link:gsub("%[", ""):gsub("%]", "")) - - if quality == 6 then - -- not quite right but whatever... close enough, artifacts are a thing of the past - local tmprel = obj.optimalItem.relicBonusIds - obj.optimalItem.relicBonusIds = nil - link = Amr.CreateItemLink(obj.optimalItem) - obj.optimalItem.relicBonusIds = tmprel + local gameItem = Item:CreateFromItemLink(optimalItemLink) + if gameItem then + local q = gameItem:GetItemQuality() + if q == 6 then + -- for artifacts, we consider it equipped if the item id alone matches + if equippedItem and equippedItem.id == optimalItem.id then + isEquipped = true + end + lblEquipped:SetText(isEquipped and "E" or "") + end - -- for artifacts, we consider it equipped if the item id alone matches - if obj.equippedItem and obj.equippedItem.id == obj.optimalItem.id then - obj.isEquipped = true - end - obj.equipLabel:SetText(obj.isEquipped and "E" or "") - end - - Amr:SetItemTooltip(obj.nameLabel, link, "ANCHOR_TOPRIGHT") - - local itemObj = Item:CreateFromItemLink(link) - if itemObj then - -- game's GetItemInfo method returns the wrong ilvl sometimes, so use the new item api to get it - iLevel = itemObj:GetCurrentItemLevel() - end - obj.ilvlLabel:SetText(iLevel) - - end, { - ilvlLabel = lblIlvl, - nameLabel = lblItem, - equipLabel = lblEquipped, - optimalItem = optimalItem, - equippedItem = equippedItem, - isEquipped = isEquipped - }) + lblItem:SetFont(Amr.CreateFont(isEquipped and "Regular" or "Bold", isEquipped and 14 or 15, Amr.Colors.Qualities[q])) + lblItem:SetText(gameItem:GetItemName()) + lblIlvl:SetText(gameItem:GetCurrentItemLevel()) + Amr:SetItemTooltip(lblItem, gameItem:GetItemLink(), "ANCHOR_TOPRIGHT") + end end -- modifications @@ -353,7 +334,7 @@ local socketBorder, socketIcon = createSocketWidget(panelMods, prevSocket or lblItem, prevSocket, isPowerActive) -- set icon and tooltip - local spellName, _, spellIcon = GetSpellInfo(spellId) + local _, _, spellIcon = GetSpellInfo(spellId) socketIcon:SetIcon(spellIcon) Amr:SetSpellTooltip(socketIcon, spellId, "ANCHOR_TOPRIGHT") @@ -372,11 +353,11 @@ local socketBorder, socketIcon = createSocketWidget(panelMods, prevSocket or lblItem, prevSocket, isGemEquipped) -- get icon for optimized gem - Amr.GetItemInfo(g, function(obj, name, link, quality, iLevel, reqLevel, class, subclass, maxStack, equipSlot, texture) - -- set icon and a tooltip - obj:SetIcon(texture) - Amr:SetItemTooltip(obj, link, "ANCHOR_TOPRIGHT") - end, socketIcon) + local gameItem = Item:CreateFromItemID(g) + if gameItem then + socketIcon:SetIcon(gameItem:GetItemIcon()) + Amr:SetItemTooltip(socketIcon, gameItem:GetItemLink(), "ANCHOR_TOPRIGHT") + end prevSocket = socketBorder end @@ -397,10 +378,10 @@ if enchInfo then lblEnchant:SetText(enchInfo.text) - Amr.GetItemInfo(enchInfo.itemId, function(obj, name, link) - Amr:SetItemTooltip(obj, link, "ANCHOR_TOPRIGHT") - end, lblEnchant) - --Amr:SetSpellTooltip(lblEnchant, enchInfo.spellId) + local gameItem = Item:CreateFromItemID(enchInfo.itemId) + if gameItem then + Amr:SetItemTooltip(lblEnchant, gameItem:GetItemLink(), "ANCHOR_TOPRIGHT") + end end end @@ -628,22 +609,42 @@ if Amr.db.profile.options.disableEm then return end -- create an equipment manager set - local specId, specName = GetSpecializationInfo(GetSpecialization()) + + -- note: ignore slots and/or saveset need to be called twice + -- for some reason, the slot is treated as blank if you try to ignore once on the first load of the equipment manager + + -- clear any currently ignored slots + C_EquipmentSet.ClearIgnoredSlotsForSave() + C_EquipmentSet.ClearIgnoredSlotsForSave() + + -- ignore shirt and tabard + C_EquipmentSet.IgnoreSlotForSave(INVSLOT_BODY) -- shirt + C_EquipmentSet.IgnoreSlotForSave(INVSLOT_TABARD) + C_EquipmentSet.IgnoreSlotForSave(INVSLOT_BODY) -- shirt + C_EquipmentSet.IgnoreSlotForSave(INVSLOT_TABARD) + + -- for now use icon of the spec + local _, specName, _, setIcon = GetSpecializationInfo(GetSpecialization()) + --[[ local item = Amr.ParseItemLink(GetInventoryItemLink("player", INVSLOT_MAINHAND)) if not item then item = Amr.ParseItemLink(GetInventoryItemLink("player", INVSLOT_OFFHAND)) end if item then - Amr.GetItemInfo(item.id, function(customArg, name, link, quality, iLevel, reqLevel, class, subclass, maxStack, equipSlot, texture) - local setname = "AMR " .. specName - local setid = C_EquipmentSet.GetEquipmentSetID(setname) - if setid then - C_EquipmentSet.SaveEquipmentSet(setid, texture) - else - C_EquipmentSet.CreateEquipmentSet(setname, texture) - end - end) + local itemObj = Item:CreateFromItemID(item.id) + if itemObj then + setIcon = itemObj:GetItemIcon() + end + end + ]] + + local setname = "AMR " .. specName + local setid = C_EquipmentSet.GetEquipmentSetID(setname) + if setid then + C_EquipmentSet.SaveEquipmentSet(setid, setIcon) + else + C_EquipmentSet.CreateEquipmentSet(setname, setIcon) end end
--- a/Import.lua Wed Jul 18 16:44:04 2018 -0700 +++ b/Import.lua Wed Jul 25 12:17:24 2018 -0700 @@ -341,7 +341,7 @@ print(blah) print("bad item: " .. v.id) end - end + end else -- we have succeeded, record the result Amr.db.char.GearSets[specSlot] = importData
--- a/Libs/LibDBIcon-1.0/LibDBIcon-1.0.lua Wed Jul 18 16:44:04 2018 -0700 +++ b/Libs/LibDBIcon-1.0/LibDBIcon-1.0.lua Wed Jul 25 12:17:24 2018 -0700 @@ -90,7 +90,7 @@ -------------------------------------------------------------------------------- -local onClick, onMouseUp, onMouseDown, onDragStart, onDragEnd, updatePosition +local onClick, onMouseUp, onMouseDown, onDragStart, onDragStop, updatePosition do local minimapShapes = {
--- a/Options.lua Wed Jul 18 16:44:04 2018 -0700 +++ b/Options.lua Wed Jul 25 12:17:24 2018 -0700 @@ -42,11 +42,6 @@ Amr:RefreshConfig() end -local function onChkMinimapClick() - Amr.db.profile.minimap.hide = _chkMinimap:GetChecked() - Amr:RefreshConfig() -end - local function createCheck(container, setting, text, description) local chk = AceGUI:Create("AmrUiCheckBox")
--- a/Shopping.lua Wed Jul 18 16:44:04 2018 -0700 +++ b/Shopping.lua Wed Jul 25 12:17:24 2018 -0700 @@ -427,8 +427,6 @@ specs = player.Specs } - local enchantItemIdToId = {} - for i, spec in ipairs(required.specs) do local gear = Amr.db.char.GearSets[i] if gear then
--- a/ui/AmrUiButton.lua Wed Jul 18 16:44:04 2018 -0700 +++ b/ui/AmrUiButton.lua Wed Jul 25 12:17:24 2018 -0700 @@ -13,7 +13,7 @@ -- WoW APIs local _G = _G -local PlaySound, CreateFrame, UIParent = PlaySound, CreateFrame, UIParent +local CreateFrame, UIParent = CreateFrame, UIParent --[[-----------------------------------------------------------------------------
--- a/ui/AmrUiCheckBox.lua Wed Jul 18 16:44:04 2018 -0700 +++ b/ui/AmrUiCheckBox.lua Wed Jul 25 12:17:24 2018 -0700 @@ -12,7 +12,7 @@ -- WoW APIs local _G = _G -local PlaySound, CreateFrame, UIParent = PlaySound, CreateFrame, UIParent +local CreateFrame, UIParent = CreateFrame, UIParent --[[-----------------------------------------------------------------------------
--- a/ui/AmrUiDropDown.lua Wed Jul 18 16:44:04 2018 -0700 +++ b/ui/AmrUiDropDown.lua Wed Jul 25 12:17:24 2018 -0700 @@ -13,7 +13,7 @@ -- WoW APIs local _G = _G -local PlaySound, CreateFrame, UIParent = PlaySound, CreateFrame, UIParent +local CreateFrame, UIParent = CreateFrame, UIParent --[[-----------------------------------------------------------------------------
--- a/ui/AmrUiFrame.lua Wed Jul 18 16:44:04 2018 -0700 +++ b/ui/AmrUiFrame.lua Wed Jul 25 12:17:24 2018 -0700 @@ -5,7 +5,6 @@ local AceGUI = LibStub and LibStub("AceGUI-3.0", true) if not AceGUI or (AceGUI:GetWidgetVersion(Type) or 0) >= Version then return end -local L = LibStub("AceLocale-3.0"):GetLocale("AskMrRobot", true) local Amr = LibStub("AceAddon-3.0"):GetAddon("AskMrRobot") -- Lua APIs @@ -13,7 +12,6 @@ local wipe = table.wipe -- WoW APIs -local PlaySound = PlaySound local CreateFrame, UIParent = CreateFrame, UIParent -- Global vars/functions that we don't upvalue since they might get hooked, or upgraded
--- a/ui/AmrUiLabel.lua Wed Jul 18 16:44:04 2018 -0700 +++ b/ui/AmrUiLabel.lua Wed Jul 25 12:17:24 2018 -0700 @@ -9,7 +9,7 @@ local Amr = LibStub("AceAddon-3.0"):GetAddon("AskMrRobot") -- Lua APIs -local max, select, pairs = math.max, select, pairs +local pairs = pairs -- WoW APIs local CreateFrame, UIParent = CreateFrame, UIParent
--- a/ui/AmrUiScrollFrame.lua Wed Jul 18 16:44:04 2018 -0700 +++ b/ui/AmrUiScrollFrame.lua Wed Jul 25 12:17:24 2018 -0700 @@ -11,7 +11,7 @@ -- Lua APIs local pairs, assert, type = pairs, assert, type -local min, max, floor, abs = math.min, math.max, math.floor, math.abs +local min, max, floor = math.min, math.max, math.floor -- WoW APIs local CreateFrame, UIParent = CreateFrame, UIParent @@ -107,7 +107,7 @@ local status = self.status or self.localstatus local height, viewheight = self.scrollframe:GetHeight(), self.content:GetHeight() local offset = status.offset or 0 - local curvalue = self.scrollbar:GetValue() + --local curvalue = self.scrollbar:GetValue() -- Give us a margin of error of 2 pixels to stop some conditions that i would blame on floating point inaccuracys -- No-one is going to miss 2 pixels at the bottom of the frame, anyhow! if viewheight < height + 2 then
--- a/ui/AmrUiTabGroup.lua Wed Jul 18 16:44:04 2018 -0700 +++ b/ui/AmrUiTabGroup.lua Wed Jul 25 12:17:24 2018 -0700 @@ -10,10 +10,9 @@ local Amr = LibStub("AceAddon-3.0"):GetAddon("AskMrRobot") -- Lua APIs -local pairs, ipairs, assert, type, wipe = pairs, ipairs, assert, type, wipe +local pairs, ipairs, assert, type = pairs, ipairs, assert, type -- WoW APIs -local PlaySound = PlaySound local CreateFrame, UIParent = CreateFrame, UIParent local _G = _G
--- a/ui/AmrUiTextButton.lua Wed Jul 18 16:44:04 2018 -0700 +++ b/ui/AmrUiTextButton.lua Wed Jul 25 12:17:24 2018 -0700 @@ -13,7 +13,7 @@ -- WoW APIs local _G = _G -local PlaySound, CreateFrame, UIParent = PlaySound, CreateFrame, UIParent +local CreateFrame, UIParent = CreateFrame, UIParent --[[-----------------------------------------------------------------------------
--- a/ui/Ui.lua Wed Jul 18 16:44:04 2018 -0700 +++ b/ui/Ui.lua Wed Jul 25 12:17:24 2018 -0700 @@ -47,6 +47,12 @@ Amr.Colors.Classes[k] = { R = v.r, G = v.g, B = v.b } end +-- get colors for item qualities from WoW's constants +Amr.Colors.Qualities = {} +for k,v in pairs(ITEM_QUALITY_COLORS) do + Amr.Colors.Qualities[k] = { R = v.r, G = v.g, B = v.b } +end + -- helper to take 0-1 value and turn into 2-digit hex value local function decToHex(num) num = math.ceil(num * 255) @@ -171,7 +177,7 @@ f:AddChild(lblStatus) lblStatus:SetWidth(900) lblStatus:SetFont(Amr.CreateFont("Italic", 12, Amr.Colors.TextTan)) - lblStatus:SetText("Ask Mr. Robot " .. L.MainStatusText("v" .. GetAddOnMetadata(Amr.ADDON_NAME, "Version"), "https://www.askmrrobot.com/wow/addon")) + lblStatus:SetText("Ask Mr. Robot " .. L.MainStatusText("v" .. GetAddOnMetadata(Amr.ADDON_NAME, "Version"), "https://www.askmrrobot.com/addon")) lblStatus:SetJustifyH("CENTER") lblStatus:SetWordWrap(false) lblStatus:SetPoint("TOP", f.content, "BOTTOM")