diff Import.lua @ 165:3be9cc6f7d20 v77

Updated for 8.2, initial essence support.
author yellowfive
date Tue, 25 Jun 2019 10:27:20 -0700
parents f27a7c64b21f
children 5c586ff5fee5
line wrap: on
line diff
--- a/Import.lua	Tue May 07 10:32:41 2019 -0700
+++ b/Import.lua	Tue Jun 25 10:27:20 2019 -0700
@@ -246,6 +246,18 @@
     return importData
 end
 
+local function parseEssenceList(essenceString)
+    local ret = {}
+
+    local parts = { strsplit("_", essenceString) }
+    for i = 1, #parts do
+        local essence = { strsplit(".", parts[i]) }
+        table.insert(ret, { tonumber(essence[0]), tonumber(essence[1]), tonumber(essence[2]) })
+    end
+
+    return ret
+end
+
 --
 -- Import a character, returning nil on success, otherwise an error message, import result stored in the db.
 --
@@ -263,8 +275,7 @@
     
     if #specParts > 1 and specParts[1] == "_junk_" then
         -- if the string starts with "_junk_" then it is the junk list
-        Amr:ImportJunkList(specParts[2], currentPlayerData)
-        return
+        return Amr:ImportJunkList(specParts[2], currentPlayerData)
 
     elseif #specParts > 1 then
         -- clear out any previously-imported BiB setups when importing new ones (non-BiB will always be imported one at a time)
@@ -343,8 +354,10 @@
     
     -- if we make it this far, the data is valid, so read item information
 	local specSlot = tonumber(parts[11])
-	
-    local importData = parseItemList(parts, 16, "n/a", true)
+    
+    local essences = parseEssenceList(parts[15])
+
+    local importData = parseItemList(parts, 17, "n/a", true)
     
     -- extra information contains setup id, display label, then extra enchant info        
     parts = { strsplit("@", data1[3]) }
@@ -398,7 +411,8 @@
             SpecSlot = tonumber(specSlot),
             Id = setupId,
             Label = setupName,
-            Gear = importData
+            Gear = importData,
+            Essences = essences
         }
 
         if not result.IsBib then