comparison Import.lua @ 185:a7f2ba17c39a v90

Shadowlands pre-patch update.
author yellowfive
date Tue, 13 Oct 2020 10:49:07 -0700
parents 5c586ff5fee5
children 4aeedce4c995
comparison
equal deleted inserted replaced
184:f374d84470db 185:a7f2ba17c39a
132 local prevGemId = 0 132 local prevGemId = 0
133 local prevEnchantId = 0 133 local prevEnchantId = 0
134 local prevUpgradeId = 0 134 local prevUpgradeId = 0
135 local prevBonusId = 0 135 local prevBonusId = 0
136 local prevLevel = 0 136 local prevLevel = 0
137 local prevAzeriteId = 0 137 --local prevAzeriteId = 0
138 local digits = { 138 local digits = {
139 ["-"] = true, 139 ["-"] = true,
140 ["0"] = true, 140 ["0"] = true,
141 ["1"] = true, 141 ["1"] = true,
142 ["2"] = true, 142 ["2"] = true,
153 if itemString == endToken then 153 if itemString == endToken then
154 break 154 break
155 elseif itemString ~= "" and itemString ~= "_" then 155 elseif itemString ~= "" and itemString ~= "_" then
156 local tokens = {} 156 local tokens = {}
157 local bonusIds = {} 157 local bonusIds = {}
158 local azerite = {} 158 --local azerite = {}
159 local hasBonuses = false 159 local hasBonuses = false
160 local hasAzerites = false 160 --local hasAzerites = false
161 local token = "" 161 local token = ""
162 local prop = "i" 162 local prop = "i"
163 local tokenComplete = false 163 local tokenComplete = false
164 for j = 1, string.len(itemString) do 164 for j = 1, string.len(itemString) do
165 local c = string.sub(itemString, j, j) 165 local c = string.sub(itemString, j, j)
187 val = val + prevGemId 187 val = val + prevGemId
188 prevGemId = val 188 prevGemId = val
189 elseif prop == "e" then 189 elseif prop == "e" then
190 val = val + prevEnchantId 190 val = val + prevEnchantId
191 prevEnchantId = val 191 prevEnchantId = val
192 elseif prop == "a" then 192 --elseif prop == "a" then
193 val = val + prevAzeriteId 193 -- val = val + prevAzeriteId
194 prevAzeriteId = val 194 -- prevAzeriteId = val
195 end 195 end
196 196
197 if prop == "b" then 197 if prop == "b" then
198 table.insert(bonusIds, val) 198 table.insert(bonusIds, val)
199 hasBonuses = true 199 hasBonuses = true
200 elseif prop == "a" then 200 --elseif prop == "a" then
201 table.insert(azerite, val) 201 -- table.insert(azerite, val)
202 hasAzerites = true 202 -- hasAzerites = true
203 else 203 else
204 tokens[prop] = val 204 tokens[prop] = val
205 end 205 end
206 206
207 token = "" 207 token = ""
235 235
236 if hasBonuses then 236 if hasBonuses then
237 obj.bonusIds = bonusIds 237 obj.bonusIds = bonusIds
238 end 238 end
239 239
240 if hasAzerites then 240 --if hasAzerites then
241 obj.azerite = azerite 241 -- obj.azerite = azerite
242 end 242 --end
243 end 243 end
244 end 244 end
245 245
246 return importData 246 return importData
247 end 247 end
248 248
249 --[[
249 local function parseEssenceList(essenceString) 250 local function parseEssenceList(essenceString)
250 local ret = {} 251 local ret = {}
251 252
252 local parts = { strsplit("_", essenceString) } 253 local parts = { strsplit("_", essenceString) }
253 for i = 1, #parts do 254 for i = 1, #parts do
254 local essence = { strsplit(".", parts[i]) } 255 local essence = { strsplit(".", parts[i]) }
255 table.insert(ret, { tonumber(essence[1]), tonumber(essence[2]), tonumber(essence[3]) }) 256 table.insert(ret, { tonumber(essence[1]), tonumber(essence[2]), tonumber(essence[3]) })
257 end
258
259 return ret
260 end
261 ]]
262
263 local function parseSoulbinds(soulbindString)
264 local ret = {}
265
266 local parts = { strsplit(",", soulbindString) }
267 for i = 1, #parts do
268 local node = { strsplit(".", parts[i]) }
269 table.insert(ret, { tonumber(node[1]), tonumber(node[2]), tonumber(node[3]) })
256 end 270 end
257 271
258 return ret 272 return ret
259 end 273 end
260 274
351 return L.ImportErrorLevel 365 return L.ImportErrorLevel
352 end 366 end
353 end 367 end
354 368
355 -- if we make it this far, the data is valid, so read item information 369 -- if we make it this far, the data is valid, so read item information
356 local specSlot = tonumber(parts[11]) 370 local specSlot = tonumber(parts[10])
357 371
358 local essences = parseEssenceList(parts[15]) 372 local soulbindId = tonumber(parts[14])
373 local soulbindNodes = parseSoulbinds(parts[15])
374 --local essences = parseEssenceList(parts[15])
359 375
360 local importData = parseItemList(parts, 17, "n/a", true) 376 local importData = parseItemList(parts, 17, "n/a", true)
361 377
362 -- extra information contains setup id, display label, then extra enchant info 378 -- extra information contains setup id, display label, then extra enchant info
363 parts = { strsplit("@", data1[3]) } 379 parts = { strsplit("@", data1[3]) }
410 IsBib = string.sub(setupId, 1, 3) ~= "AMR", 426 IsBib = string.sub(setupId, 1, 3) ~= "AMR",
411 SpecSlot = tonumber(specSlot), 427 SpecSlot = tonumber(specSlot),
412 Id = setupId, 428 Id = setupId,
413 Label = setupName, 429 Label = setupName,
414 Gear = importData, 430 Gear = importData,
415 Essences = essences 431 SoulbindId = soulbindId,
432 SoulbindNodes = soulbindNodes
433 --Essences = essences
416 } 434 }
417 435
418 if not result.IsBib then 436 if not result.IsBib then
419 -- replace if this setup already exists 437 -- replace if this setup already exists
420 local key = -1 438 local key = -1