When I say "lockup" the game does return control to the client eventually. It can be as little as a couple skipped frames or as long as 15 minutes. But to the end user it will appear that something very very bad happened. It's something I want to try to avoid doing at all costs.
That said, with the understanding that you're okay with these lockups, or that you don't intend to export 700 pets at a time, paste the following code into http://addon.bool.no/ to make an addon to do this.
Once installed, the next time you start WoW, if Rematch is enabled it will add "Export List" to the pet Filter menu. When you choose this menu item it will summon a dialog with a big text box and fill in csv-formatted (comma-separated) stats about the pets you own from the filtered list.
As it says at the top of the dialog the format is name,species,type,level,health,power,speed,rarity,breed,abilities. The abilities are listed in the order that GetPetAbilityList returns them (in ascending ability level requirement: 1 2 4 10 15 20), which is not quite the order you wanted, but it should be easy enough to move columns. If it's a big hassle let me know I can tweak the code to do them in a different order.
I chose commas because it's a very common format just about any spreadsheet can import, and the pipeline character (|) can do some crazy things when adjacent to characters in WoW's text/editboxes (the | character is used in wow to color text and make hyperlinks). Names and abilities with commas in the name have the commas stripped out.
Code: Select all
-- adds "Export List" to Rematch's pet list Filter menu, to copy a csv-formatted list of owned pets and their stats to an editbox.
local f = CreateFrame("Frame")
f:RegisterEvent("PLAYER_LOGIN")
f:SetScript("OnEvent",function()
if Rematch then -- if rematch exists
C_Timer.After(1,function() -- wait a second to let rematch create its menus
local abList,lvList = {},{}
local info,line = {},{}
-- adds one line from info to the dialog's editbox every frame
local function addInfo()
if #info>0 and Rematch:IsDialogOpen("ExportPetList") then
Rematch.Dialog.MultiLine.EditBox:Insert(info[1].."\n")
tremove(info,1)
C_Timer.After(0,addInfo)
end
end
-- adds the given stats to the line table
local function addStats(...)
for i=1,select("#",...) do
local stat = tostring(select(i,...) or "none"):gsub(",","") -- remove any commas
tinsert(line,stat)
end
end
-- add a menu item Export List to the PetFilter menu
local menu = Rematch:GetMenu("PetFilter")
tinsert(menu,#menu-2,{
text="Export List",
tooltipBody="Copies the stats of the listed owned pets into an editbox in a csv format.",
func=function()
-- create a dialog
local dialog = Rematch:ShowDialog("ExportPetList",500,500,"Filtered Pets",nil,nil,nil,OKAY)
dialog:ShowText("Format:\nname,species,type,level,health,power,speed,rarity,breed,abilities",460,32,"TOP",0,-32)
-- create multiline editbox
dialog.MultiLine:SetSize(460,380)
dialog.MultiLine:SetPoint("BOTTOM",-1,40)
dialog.MultiLine:Show()
-- gather info into table 'info'
wipe(info)
for _,petID in ipairs(Rematch.Roster.petList) do
wipe(line)
if type(petID)=="string" then
local speciesID,customName,level,_,_,_,_,name,_,petType = C_PetJournal.GetPetInfoByPetID(petID)
addStats(customName and format("%s (%s)",name,customName) or name)
addStats(speciesID,PET_TYPE_SUFFIX[petType],level)
local _,maxHealth,power,speed,rarity = C_PetJournal.GetPetStats(petID)
addStats(maxHealth,power,speed,_G["BATTLE_PET_BREED_QUALITY"..rarity])
addStats(Rematch:GetBreedByPetID(petID))
C_PetJournal.GetPetAbilityList(speciesID,abList,lvList)
for i=1,6 do
addStats(abList[i] and select(2,C_PetBattles.GetAbilityInfoByID(abList[i])) or "none")
end
tinsert(info,table.concat(line,","))
end
end
-- begin adding the gathered info to the editbox
addInfo()
end
})
end)
end
end)