Mercurial > wow > askmrrobot
comparison AskMrRobot-Serializer/AskMrRobot-Serializer.lua @ 165:3be9cc6f7d20 v77
Updated for 8.2, initial essence support.
| author | yellowfive |
|---|---|
| date | Tue, 25 Jun 2019 10:27:20 -0700 |
| parents | 35612aee8e15 |
| children | 5c68d3fccff3 |
comparison
equal
deleted
inserted
replaced
| 164:a6aa4fa7e2dd | 165:3be9cc6f7d20 |
|---|---|
| 1 -- AskMrRobot-Serializer will serialize and communicate character data between users. | 1 -- AskMrRobot-Serializer will serialize and communicate character data between users. |
| 2 | 2 |
| 3 local MAJOR, MINOR = "AskMrRobot-Serializer", 76 | 3 local MAJOR, MINOR = "AskMrRobot-Serializer", 77 |
| 4 local Amr, oldminor = LibStub:NewLibrary(MAJOR, MINOR) | 4 local Amr, oldminor = LibStub:NewLibrary(MAJOR, MINOR) |
| 5 | 5 |
| 6 if not Amr then return end -- already loaded by something else | 6 if not Amr then return end -- already loaded by something else |
| 7 | 7 |
| 8 -- event and comm used for player snapshotting on entering combat | 8 -- event and comm used for player snapshotting on entering combat |
| 490 readProfessionInfo(firstAid, ret) | 490 readProfessionInfo(firstAid, ret) |
| 491 | 491 |
| 492 ret.Specs = {} | 492 ret.Specs = {} |
| 493 ret.Talents = {} | 493 ret.Talents = {} |
| 494 readSpecs(ret) | 494 readSpecs(ret) |
| 495 | |
| 496 -- these get updated later, since need to cache info for inactive specs | |
| 497 ret.UnlockedEssences = {} | |
| 498 ret.Essences = {} | |
| 495 | 499 |
| 496 ret.Equipped = {} | 500 ret.Equipped = {} |
| 497 readEquippedItems(ret) | 501 readEquippedItems(ret) |
| 498 | 502 |
| 499 return ret | 503 return ret |
| 685 table.insert(fields, data.ActiveSpec) | 689 table.insert(fields, data.ActiveSpec) |
| 686 for spec = 1, 4 do | 690 for spec = 1, 4 do |
| 687 if data.Specs[spec] and (complete or spec == data.ActiveSpec) then | 691 if data.Specs[spec] and (complete or spec == data.ActiveSpec) then |
| 688 table.insert(fields, ".s" .. spec) -- indicates the start of a spec block | 692 table.insert(fields, ".s" .. spec) -- indicates the start of a spec block |
| 689 table.insert(fields, data.Specs[spec]) | 693 table.insert(fields, data.Specs[spec]) |
| 690 table.insert(fields, data.Talents[spec] or "") | 694 table.insert(fields, data.Talents[spec] or "") |
| 695 | |
| 696 local essences = {} | |
| 697 if data.Essences and data.Essences[spec] then | |
| 698 for i, ess in ipairs(data.Essences[spec]) do | |
| 699 table.insert(essences, table.concat(ess, ".")) | |
| 700 end | |
| 701 end | |
| 702 table.insert(fields, table.concat(essences, "_")) | |
| 691 end | 703 end |
| 692 end | 704 end |
| 693 | 705 |
| 694 -- export equipped gear | 706 -- export equipped gear |
| 695 if data.Equipped then | 707 if data.Equipped then |
| 704 end | 716 end |
| 705 | 717 |
| 706 appendItemsToExport(fields, itemObjects) | 718 appendItemsToExport(fields, itemObjects) |
| 707 end | 719 end |
| 708 end | 720 end |
| 721 end | |
| 722 | |
| 723 -- export unlocked essences | |
| 724 if data.UnlockedEssences then | |
| 725 table.insert(fields, ".ess") | |
| 726 for i, ess in ipairs(data.UnlockedEssences) do | |
| 727 table.insert(fields, table.concat(ess, "_")) | |
| 728 end | |
| 709 end | 729 end |
| 710 | 730 |
| 711 -- if doing a complete export, include bank/bag items too | 731 -- if doing a complete export, include bank/bag items too |
| 712 if complete then | 732 if complete then |
| 713 | 733 |
| 733 | 753 |
| 734 return "$" .. table.concat(fields, ";") .. "$" | 754 return "$" .. table.concat(fields, ";") .. "$" |
| 735 | 755 |
| 736 end | 756 end |
| 737 | 757 |
| 758 --[[ | |
| 738 -- Shortcut for the common use case: serialize the player's currently active setup with no extras. | 759 -- Shortcut for the common use case: serialize the player's currently active setup with no extras. |
| 739 function Amr:SerializePlayer() | 760 function Amr:SerializePlayer() |
| 740 local data = self:GetPlayerData() | 761 local data = self:GetPlayerData() |
| 741 return self:SerializePlayerData(data) | 762 return self:SerializePlayerData(data) |
| 742 end | 763 end |
| 764 ]] | |
| 743 | 765 |
| 744 --[[ | 766 --[[ |
| 745 ---------------------------------------------------------------------------------------------------------------------- | 767 ---------------------------------------------------------------------------------------------------------------------- |
| 746 -- Character Snapshots | 768 -- Character Snapshots |
| 747 -- This feature snapshots a player's gear/talents/artifact when entering combat. It is enabled by default. Consumers | 769 -- This feature snapshots a player's gear/talents/artifact when entering combat. It is enabled by default. Consumers |
