Mercurial > wow > askmrrobot
diff AskMrRobot.lua @ 31:44c285acfff0 v8
fixed item display bug on summary tab
author | yellowfive |
---|---|
date | Sat, 18 Oct 2014 10:33:33 -0700 |
parents | aabec73640a0 |
children | 4ba69d2ee252 |
line wrap: on
line diff
--- a/AskMrRobot.lua Fri Oct 17 02:44:16 2014 -0700 +++ b/AskMrRobot.lua Sat Oct 18 10:33:33 2014 -0700 @@ -35,6 +35,9 @@ AskMrRobot.AddonName = ... AskMrRobot.ChatPrefix = "_AMR" +-- flag to turn on debugging behavior +AskMrRobot.debug = false + -- the main user interface window AskMrRobot.mainWindow = nil @@ -450,7 +453,7 @@ local currencies = {}; currencies[-1] = GetMoney() - local currencyList = {61, 81, 241, 361, 384, 394, 390, 391, 392, 393, 394, 395, 396, 397, 398, 399, 400, 401, 402, 416, 515, 614, 615, 676, 679} + local currencyList = {61, 81, 241, 361, 384, 394, 390, 391, 392, 393, 394, 395, 396, 397, 398, 399, 400, 401, 402, 416, 515, 614, 615, 676, 679, 823} for i, currency in pairs(currencyList) do local amount = getCurrencyAmount(currency) if amount ~= 0 then @@ -803,7 +806,7 @@ -- -- Import a character, returning nil on success, otherwise an error message, import result stored in AskMrRobot.ImportData -- -function AskMrRobot.ImportCharacter(data) +function AskMrRobot.ImportCharacter(data, isTest) -- make sure all data is up to date before importing AskMrRobot.SaveAll() @@ -826,54 +829,57 @@ end -- require realm/name match - local realm = parts[2] - local name = parts[3] - if name ~= AmrDb.CharacterName then - local badPers = name .. " (" .. realm .. ")" - local goodPers = AmrDb.CharacterName .. " (" .. AmrDb.RealmName .. ")" - return L.AMR_IMPORT_ERROR_CHAR:format(badPers, goodPers) + if not isTest then + local realm = parts[2] + local name = parts[3] + if name ~= AmrDb.CharacterName then + local badPers = name .. " (" .. realm .. ")" + local goodPers = AmrDb.CharacterName .. " (" .. AmrDb.RealmName .. ")" + return L.AMR_IMPORT_ERROR_CHAR:format(badPers, goodPers) + end + + -- require race match + local race = tonumber(parts[5]) + if race ~= AskMrRobot.raceIds[AmrDb.Race] then + return L.AMR_IMPORT_ERROR_RACE + end + + -- require faction match + local faction = tonumber(parts[6]) + if faction ~= AskMrRobot.factionIds[AmrDb.Faction] then + return L.AMR_IMPORT_ERROR_FACTION + end + + -- require level match + local level = tonumber(parts[7]) + if level ~= AmrDb.Level then + return L.AMR_IMPORT_ERROR_LEVEL + end + + -- require spec match + local spec = tonumber(parts[11]) + if spec ~= AmrDb.Specs[AmrDb.ActiveSpec] then + print(AmrDb.ActiveSpec) + print(spec) + print(AmrDb.Specs[AmrDb.ActiveSpec]) + local _, specName = GetSpecializationInfoByID(AskMrRobot.gameSpecIds[spec]) + return L.AMR_IMPORT_ERROR_SPEC:format(specName) + end + + -- require talent match + local talents = parts[12] + if talents ~= AmrDb.Talents[AmrDb.ActiveSpec] then + return L.AMR_IMPORT_ERROR_TALENT + end + + -- require glyph match + -- TODO: re-enable this check when glyphs are more consistent + --local glyphs = parts[13] + --if glyphs ~= AskMrRobot.toCompressedNumberList(AmrDb.Glyphs[AmrDb.ActiveSpec]) then + -- return L.AMR_IMPORT_ERROR_GLYPH + --end end - -- require race match - local race = tonumber(parts[5]) - if race ~= AskMrRobot.raceIds[AmrDb.Race] then - return L.AMR_IMPORT_ERROR_RACE - end - - -- require faction match - local faction = tonumber(parts[6]) - if faction ~= AskMrRobot.factionIds[AmrDb.Faction] then - return L.AMR_IMPORT_ERROR_FACTION - end - - -- require level match - local level = tonumber(parts[7]) - if level ~= AmrDb.Level then - return L.AMR_IMPORT_ERROR_LEVEL - end - - -- require spec match - local spec = tonumber(parts[11]) - if spec ~= AmrDb.Specs[AmrDb.ActiveSpec] then - print(AmrDb.ActiveSpec) - print(spec) - print(AmrDb.Specs[AmrDb.ActiveSpec]) - local _, specName = GetSpecializationInfoByID(AskMrRobot.gameSpecIds[spec]) - return L.AMR_IMPORT_ERROR_SPEC:format(specName) - end - - -- require talent match - local talents = parts[12] - if talents ~= AmrDb.Talents[AmrDb.ActiveSpec] then - return L.AMR_IMPORT_ERROR_TALENT - end - - -- require glyph match - -- TODO: re-enable this check when glyphs are more consistent - --local glyphs = parts[13] - --if glyphs ~= AskMrRobot.toCompressedNumberList(AmrDb.Glyphs[AmrDb.ActiveSpec]) then - -- return L.AMR_IMPORT_ERROR_GLYPH - --end -- if we make it this far, the data is valid, so read item information local importData = {} @@ -1045,12 +1051,20 @@ end end - -- we have succeeded, record the result - AskMrRobot.ImportData = importData - AskMrRobot.ExtraItemData = itemInfo - AskMrRobot.ExtraGemData = gemInfo - AskMrRobot.ExtraEnchantData = enchantInfo - - AmrDb.LastCharacterImport = data - AmrDb.LastCharacterImportDate = date() + if isTest then + -- print result for debugging + local blah = importData[1] + local name, link = GetItemInfo(AskMrRobot.createItemLink(blah)) + print(link) + + else + -- we have succeeded, record the result + AskMrRobot.ImportData = importData + AskMrRobot.ExtraItemData = itemInfo + AskMrRobot.ExtraGemData = gemInfo + AskMrRobot.ExtraEnchantData = enchantInfo + + AmrDb.LastCharacterImport = data + AmrDb.LastCharacterImportDate = date() + end end