comparison Modules/ProspectMe_Migrate.lua @ 60:155fa49865f2 v2.7.1.2-Alpha

Changed directory structure around to clean it up a bit.
author Vynn <mischivin@gmail.com>
date Mon, 28 Nov 2016 12:28:35 -0500
parents ProspectMe_Migrate.lua@761d71cd8989
children
comparison
equal deleted inserted replaced
59:ef591210a1e4 60:155fa49865f2
1 local ORE = select(7,GetItemInfo(123918))
2 local HERB = select(7,GetItemInfo(128304))
3
4 local function Initialize ()
5 ProspectMe.Migrate = function ()
6 print("Attempting to migrate ProspectMe database")
7 if PM_ResultsTable then
8 print("|cffffff00ProspectMe v1 database found|r")
9 for Container, Item in pairs(PM_ResultsTable) do
10 local C = tonumber(Container)
11 local B = nil
12 local RT = {}
13 for Result, Quantity in pairs (Item) do
14 if Result == "timesProspected" then
15 B = Quantity
16 else
17 RT[tonumber(Result)] = Quantity
18 end
19 end
20 if select(7,GetItemInfo(C)) == ORE or select(7,GetItemInfo(C)) == HERB then
21 ProspectMe.AddEntry(C, B, RT)
22 end
23 end
24 print("|cff00ff00Database migrated sucessfully!|r")
25 PM_ResultsTable = nil
26 PM_ItemTable = nil
27 PM_Config = nil
28 else
29 print("|cffff0000Error, ProspectMe v1 database not found|r")
30 end
31 end
32
33 if PM_ResultsTable then
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")
35 end
36 end
37
38 local frame = CreateFrame("FRAME", "ProspectMe_Value")
39 frame:RegisterEvent("VARIABLES_LOADED")
40 --frame:SetScript("OnEvent", EventHandler)
41 frame:SetScript("OnEvent", Initialize)