Mercurial > wow > askmrrobot
comparison Export.lua @ 165:3be9cc6f7d20 v77
Updated for 8.2, initial essence support.
author | yellowfive |
---|---|
date | Tue, 25 Jun 2019 10:27:20 -0700 |
parents | 65c285394049 |
children | a7f2ba17c39a |
comparison
equal
deleted
inserted
replaced
164:a6aa4fa7e2dd | 165:3be9cc6f7d20 |
---|---|
256 Amr.db.char.VoidItems = voidItems | 256 Amr.db.char.VoidItems = voidItems |
257 end | 257 end |
258 | 258 |
259 end | 259 end |
260 ]] | 260 ]] |
261 | |
262 local function scanEssences() | |
263 if not C_AzeriteEssence then return end | |
264 | |
265 -- read which essences this player has unlocked | |
266 Amr.db.char.UnlockedEssences = {} | |
267 | |
268 local essences = C_AzeriteEssence.GetEssences() | |
269 if essences then | |
270 for i, essence in ipairs(essences) do | |
271 if essence.unlocked then | |
272 table.insert(Amr.db.char.UnlockedEssences, { essence.ID, essence.rank }) | |
273 end | |
274 end | |
275 end | |
276 | |
277 local specPos = GetSpecialization() | |
278 if not specPos or specPos < 1 or specPos > 4 then return end | |
279 | |
280 if not Amr.db.char.Essences then | |
281 Amr.db.char.Essences = {} | |
282 end | |
283 | |
284 Amr.db.char.Essences[specPos] = {} | |
285 local active = Amr.db.char.Essences[specPos] | |
286 | |
287 local milestones = C_AzeriteEssence.GetMilestones() | |
288 if milestones then | |
289 for i, milestone in ipairs(milestones) do | |
290 -- if no slot, it corresponds to the stamina nodes, skip those | |
291 if milestone.slot ~= nil then | |
292 if milestone.unlocked then | |
293 local essenceId = C_AzeriteEssence.GetMilestoneEssence(milestone.ID) | |
294 if essenceId then | |
295 local essence = C_AzeriteEssence.GetEssenceInfo(essenceId) | |
296 table.insert(active, { milestone.slot, essence.ID, essence.rank }) | |
297 end | |
298 end | |
299 end | |
300 end | |
301 end | |
302 end | |
261 | 303 |
262 local function scanTalents() | 304 local function scanTalents() |
263 local specPos = GetSpecialization() | 305 local specPos = GetSpecialization() |
264 if not specPos or specPos < 1 or specPos > 4 then return end | 306 if not specPos or specPos < 1 or specPos > 4 then return end |
265 | 307 |
300 -- scan current inventory just before export so that it is always fresh | 342 -- scan current inventory just before export so that it is always fresh |
301 scanBags() | 343 scanBags() |
302 | 344 |
303 -- scan current spec's talents just before exporting | 345 -- scan current spec's talents just before exporting |
304 scanTalents() | 346 scanTalents() |
347 | |
348 -- scan current spec's essences just before exporting | |
349 scanEssences() | |
305 | 350 |
306 data.Talents = Amr.db.char.Talents | 351 data.Talents = Amr.db.char.Talents |
352 data.UnlockedEssences = Amr.db.char.UnlockedEssences | |
353 data.Essences = Amr.db.char.Essences | |
307 data.Equipped = Amr.db.char.Equipped | 354 data.Equipped = Amr.db.char.Equipped |
308 data.BagItems = Amr.db.char.BagItems | 355 data.BagItems = Amr.db.char.BagItems |
309 | 356 |
310 -- flatten bank data (which is stored by bag for more efficient updating) | 357 -- flatten bank data (which is stored by bag for more efficient updating) |
311 data.BankItems = {} | 358 data.BankItems = {} |
335 --Amr:AddEventHandler("VOID_STORAGE_CONTENTS_UPDATE", scanVoid) | 382 --Amr:AddEventHandler("VOID_STORAGE_CONTENTS_UPDATE", scanVoid) |
336 --Amr:AddEventHandler("VOID_STORAGE_DEPOSIT_UPDATE", scanVoid) | 383 --Amr:AddEventHandler("VOID_STORAGE_DEPOSIT_UPDATE", scanVoid) |
337 --Amr:AddEventHandler("VOID_STORAGE_UPDATE", scanVoid) | 384 --Amr:AddEventHandler("VOID_STORAGE_UPDATE", scanVoid) |
338 | 385 |
339 Amr:AddEventHandler("PLAYER_TALENT_UPDATE", scanTalents) | 386 Amr:AddEventHandler("PLAYER_TALENT_UPDATE", scanTalents) |
387 | |
388 if C_AzeriteEssence then | |
389 Amr:AddEventHandler("AZERITE_ESSENCE_UPDATE", scanEssences) | |
390 end |