comparison ProspectMe_Migrate.lua @ 49:9dae86337a41

Merge Prospect Me v2 Branch to default
author Vynn <mischivin@gmail.com>
date Thu, 17 Nov 2016 16:24:48 -0500
parents 761d71cd8989
children
comparison
equal deleted inserted replaced
28:dc1504b4c03c 49:9dae86337a41
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)