Mercurial > wow > askmrrobot
comparison Export.lua @ 114:4cd98aa90d78 v53
Small update to crucible export.
| author | yellowfive | 
|---|---|
| date | Wed, 04 Oct 2017 01:08:56 -0700 | 
| parents | 57c6cac5143c | 
| children | bccce18e12cb | 
   comparison
  equal
  deleted
  inserted
  replaced
| 113:406f56dd065b | 114:4cd98aa90d78 | 
|---|---|
| 282 --talents = nil | 282 --talents = nil | 
| 283 else | 283 else | 
| 284 talents = C_ArtifactRelicForgeUI.GetSocketedRelicTalents(i) | 284 talents = C_ArtifactRelicForgeUI.GetSocketedRelicTalents(i) | 
| 285 | 285 | 
| 286 --[[ | 286 --[[ | 
| 287 -- test data | |
| 287 if i == 1 then | 288 if i == 1 then | 
| 288 talents = {} | 289 talents = {} | 
| 289 table.insert(talents, { | 290 table.insert(talents, { | 
| 290 powerID = 1739, | 291 powerID = 1739, | 
| 291 isChosen = true | 292 isChosen = true | 
| 366 end | 367 end | 
| 367 | 368 | 
| 368 if not dataz.Crucible then | 369 if not dataz.Crucible then | 
| 369 dataz.Crucible = { | 370 dataz.Crucible = { | 
| 370 Equipped = {}, | 371 Equipped = {}, | 
| 371 Inventory = {} | 372 Previewed = {} | 
| 372 } | 373 } | 
| 373 end | 374 end | 
| 374 | 375 | 
| 375 local crucible = dataz.Crucible | 376 local crucible = dataz.Crucible | 
| 376 crucible.Equipped = equipped | 377 crucible.Equipped = equipped | 
| 377 if preview then | 378 if preview then | 
| 378 crucible.Inventory[preview.ItemLink] = preview | 379 local previewKey = {} | 
| 379 end | 380 table.insert(previewKey, preview.ItemLink) | 
| 380 end | 381 for i,v in ipairs(preview.Powers) do | 
| 382 table.insert(previewKey, v .. "=" .. tostring(preview.Active[i])) | |
| 383 end | |
| 384 previewKey = table.concat(previewKey, "_") | |
| 385 | |
| 386 crucible.Previewed[previewKey] = preview | |
| 387 end | |
| 388 end | |
| 389 end | |
| 390 | |
| 391 local function pruneCrucible() | |
| 392 if not Amr.db or not Amr.db.char or not Amr.db.char.Artifacts then return end | |
| 393 | |
| 394 local spec = GetSpecialization() | |
| 395 local dataz = Amr.db.char.Artifacts[spec] | |
| 396 if not dataz or not dataz.Crucible then return end | |
| 397 | |
| 398 local crucible = dataz.Crucible | |
| 399 | |
| 400 -- this was old format, transform to new format | |
| 401 if crucible.Inventory then | |
| 402 if not crucible.Previewed then | |
| 403 crucible.Previewed = {} | |
| 404 end | |
| 405 | |
| 406 for link,preview in pairs(crucible.Inventory) do | |
| 407 local previewKey = {} | |
| 408 table.insert(previewKey, preview.ItemLink) | |
| 409 for i,v in ipairs(preview.Powers) do | |
| 410 table.insert(previewKey, v .. "=" .. tostring(preview.Active[i])) | |
| 411 end | |
| 412 previewKey = table.concat(previewKey, "_") | |
| 413 | |
| 414 crucible.Previewed[previewKey] = preview | |
| 415 end | |
| 416 | |
| 417 crucible.Inventory = nil | |
| 418 end | |
| 419 | |
| 420 -- get a hash of every owned, but not-equipped item | |
| 421 local ownedItems = {} | |
| 422 if Amr.db.char.BagItems then | |
| 423 for i,link in ipairs(Amr.db.char.BagItems) do | |
| 424 ownedItems[link] = true | |
| 425 end | |
| 426 end | |
| 427 if Amr.db.char.BankItems then | |
| 428 for i,link in ipairs(Amr.db.char.BankItems) do | |
| 429 ownedItems[link] = true | |
| 430 end | |
| 431 end | |
| 432 if Amr.db.char.VoidItems then | |
| 433 for i,link in ipairs(Amr.db.char.VoidItems) do | |
| 434 ownedItems[link] = true | |
| 435 end | |
| 436 end | |
| 437 | |
| 438 -- prune out any previewed relics that the player no longer owns | |
| 439 if crucible.Previewed then | |
| 440 local toRemove = {} | |
| 441 for k,v in pairs(crucible.Previewed) do | |
| 442 if not ownedItems[v.ItemLink] then | |
| 443 table.insert(toRemove, k) | |
| 444 end | |
| 445 end | |
| 446 for i,v in ipairs(toRemove) do | |
| 447 crucible.Previewed[v] = nil | |
| 448 end | |
| 449 end | |
| 450 | |
| 381 end | 451 end | 
| 382 | 452 | 
| 383 local function scanArtifact() | 453 local function scanArtifact() | 
| 384 if not Amr.db or not Amr.db.char or not Amr.db.char.Artifacts then return end | 454 if not Amr.db or not Amr.db.char or not Amr.db.char.Artifacts then return end | 
| 385 | 455 | 
| 452 scanBags() | 522 scanBags() | 
| 453 | 523 | 
| 454 -- scan current spec's talents just before exporting | 524 -- scan current spec's talents just before exporting | 
| 455 scanTalents() | 525 scanTalents() | 
| 456 | 526 | 
| 527 -- prune crucible info just before each time we export | |
| 528 pruneCrucible() | |
| 529 | |
| 457 data.Talents = Amr.db.char.Talents | 530 data.Talents = Amr.db.char.Talents | 
| 458 data.Artifacts = Amr.db.char.Artifacts | 531 data.Artifacts = Amr.db.char.Artifacts | 
| 459 data.Equipped = Amr.db.char.Equipped | 532 data.Equipped = Amr.db.char.Equipped | 
| 460 data.Reputations = getReputations() | 533 data.Reputations = getReputations() | 
| 461 data.BagItems = Amr.db.char.BagItems | 534 data.BagItems = Amr.db.char.BagItems | 
