Mercurial > wow > prospect-me
annotate ProspectMe_Migrate.lua @ 38:69c7955b75b1 Prospect Me 2
TOC update for V2, includes Migration changes.
author | Vynn <mischivin@gmail.com> |
---|---|
date | Thu, 10 Nov 2016 12:26:59 -0500 |
parents | 761d71cd8989 |
children |
rev | line source |
---|---|
mischivin@34 | 1 local ORE = select(7,GetItemInfo(123918)) |
mischivin@34 | 2 local HERB = select(7,GetItemInfo(128304)) |
mischivin@34 | 3 |
mischivin@34 | 4 local function Initialize () |
mischivin@34 | 5 ProspectMe.Migrate = function () |
mischivin@34 | 6 print("Attempting to migrate ProspectMe database") |
mischivin@34 | 7 if PM_ResultsTable then |
mischivin@34 | 8 print("|cffffff00ProspectMe v1 database found|r") |
mischivin@34 | 9 for Container, Item in pairs(PM_ResultsTable) do |
mischivin@34 | 10 local C = tonumber(Container) |
mischivin@34 | 11 local B = nil |
mischivin@34 | 12 local RT = {} |
mischivin@34 | 13 for Result, Quantity in pairs (Item) do |
mischivin@34 | 14 if Result == "timesProspected" then |
mischivin@34 | 15 B = Quantity |
mischivin@34 | 16 else |
mischivin@34 | 17 RT[tonumber(Result)] = Quantity |
mischivin@34 | 18 end |
mischivin@34 | 19 end |
mischivin@34 | 20 if select(7,GetItemInfo(C)) == ORE or select(7,GetItemInfo(C)) == HERB then |
mischivin@34 | 21 ProspectMe.AddEntry(C, B, RT) |
mischivin@34 | 22 end |
mischivin@34 | 23 end |
mischivin@34 | 24 print("|cff00ff00Database migrated sucessfully!|r") |
mischivin@34 | 25 PM_ResultsTable = nil |
mischivin@34 | 26 PM_ItemTable = nil |
mischivin@34 | 27 PM_Config = nil |
mischivin@34 | 28 else |
mischivin@34 | 29 print("|cffff0000Error, ProspectMe v1 database not found|r") |
mischivin@34 | 30 end |
mischivin@34 | 31 end |
mischivin@34 | 32 |
mischivin@34 | 33 if PM_ResultsTable then |
mischivin@34 | 34 print("ProspectMe v1 database found, to migrate your database to v2 run the command |cff00ff00/script ProspectMe.Migrate()|r \n |cffff0000Warning, this action is irreversable!|r") |
mischivin@34 | 35 end |
mischivin@34 | 36 end |
mischivin@34 | 37 |
mischivin@34 | 38 local frame = CreateFrame("FRAME", "ProspectMe_Value") |
mischivin@34 | 39 frame:RegisterEvent("VARIABLES_LOADED") |
mischivin@34 | 40 --frame:SetScript("OnEvent", EventHandler) |
mischivin@34 | 41 frame:SetScript("OnEvent", Initialize) |