@@ -182,12 +182,19 @@ end
182182
183183function MPT :ImportWAData (data )
184184 local data = {}
185- if not MPTAPI .GetBossesData or not MPTAPI .GetForcesData then
186- print (" Could not import WA data, please click on the WA in the options window to enable the necessary function." )
187- return
185+ local WANames = {" M+ Bosses" , " M+ Enemy Forces Bar" }
186+ if not WeakAuras then print (" Could not importa WA data, WeakAura Addon appears to not be loaded" ) return end
187+ local LS = LibStub (" LibSerialize" ) -- WA uses this library so we don't include it ourselves
188+ for i , name in ipairs (WANames ) do
189+ local aura = WeakAuras .GetData (name )
190+ local saved = aura and aura .information and aura .information .saved
191+ if not saved then print (" Could not import WA data, the aura appears to be missing or renamed" ) return end
192+ local decodedPrint = Compress :DecodeForPrint (saved )
193+ local decompressedDeflated = Compress :DecompressDeflate (decodedPrint )
194+ local success , deserialized = LS :Deserialize (decompressedDeflated )
195+ if (not success ) or (not deserialized ) then print (" Importing WA data failed." ) return end
196+ if i == 1 then data .Bosses = deserialized else data .Forces = deserialized end
188197 end
189- data .Bosses = MPTAPI :GetBossesData ()
190- data .Forces = MPTAPI :GetForcesData ()
191198 if not data or not data .Bosses or not data .Forces or next (data .Bosses ) == nil or next (data .Forces ) == nil then
192199 print (" Could not import WA data, there appears to be no data available." )
193200 return
0 commit comments