Skip to content

Commit af35b28

Browse files
committed
Add vision currencies
1 parent 22c9a97 commit af35b28

File tree

4 files changed

+95
-1
lines changed

4 files changed

+95
-1
lines changed

PermoksAccountManager.lua

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ local LibQTip = LibStub('LibQTip-1.0')
5252
local L = LibStub('AceLocale-3.0'):GetLocale(addonName)
5353
local LSM = LibStub('LibSharedMedia-3.0')
5454
local VERSION = C_AddOns.GetAddOnMetadata(addonName, "Version")
55-
local INTERNALTWWVERSION = 9
55+
local INTERNALTWWVERSION = 10
5656
local INTERNALWOTLKVERSION = 6
5757
local INTERNALCATAVERSION = 3
5858
local defaultDB = {
@@ -793,6 +793,11 @@ function PermoksAccountManager:Modernize(oldInternalVersion)
793793
self:AddLabelToDefaultCategory('renown', 'flames_radiance', 8)
794794
self:AddLabelToDefaultCategory('currentweekly', 'nightfall_weekly', 7)
795795
end
796+
797+
if oldInternalVersion < 10 then
798+
self:AddLabelToDefaultCategory('general', 'eye_of_nzoth')
799+
self:AddLabelToDefaultCategory('general', 'displaced_corrupted_mementos')
800+
end
796801
end
797802

798803
function PermoksAccountManager:GetGUID()

db/db.lua

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -646,6 +646,7 @@ PermoksAccountManager.currency = {
646646
[2812] = 0, -- Aspect's Awakened Crest
647647
[2912] = 0, -- Renascent Awakening (Crucible Charges DF Season 4)
648648
[3089] = 0, -- Residual Memories (11.0 prepatch currency)
649+
[3149] = 0, -- Displaced Corrupted Mementos
649650

650651
-- TWW Currencies
651652
[2914] = 0, -- Weathered Harbinger Crest
@@ -673,6 +674,13 @@ PermoksAccountManager.currency = {
673674
[1166] = 0, -- Timewarped Badge
674675
}
675676

677+
PermoksAccountManager.currencyTrees = {
678+
[1057] = {
679+
systemID = 20,
680+
currencyType = 3728, -- 3728 = Echo of N'Zoth
681+
}
682+
}
683+
676684
PermoksAccountManager.currencyCustomOptions = {
677685
[2166] = { currencyUpdate = 2167 },
678686
[2533] = { forceUpdate = true },

modules/character.lua

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,7 @@ local labelRows = {
8484
label = L['Gold'],
8585
type = 'gold',
8686
group = 'currency',
87+
warband = true,
8788
version = false
8889
},
8990
keystone = {
@@ -463,6 +464,19 @@ end
463464

464465
local function UpdateGold(charInfo)
465466
charInfo.gold = floor(GetMoney() / (COPPER_PER_SILVER * SILVER_PER_GOLD)) * 10000
467+
468+
local db = PermoksAccountManager.db.global
469+
local accountData = db.accounts.main.data
470+
local warbandData = db.accounts.main.warbandData
471+
472+
local totalGold = 0
473+
for _, altData in pairs(accountData) do
474+
if altData.gold then
475+
totalGold = totalGold + altData.gold
476+
end
477+
end
478+
479+
warbandData.gold = totalGold
466480
end
467481

468482
local function UpdateILevel(charInfo)

modules/currencies.lua

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -292,6 +292,7 @@ local labelRows = {
292292
type = 'currency',
293293
key = 3008,
294294
abbMax = true,
295+
warband = true,
295296
group = 'currency',
296297
version = WOW_PROJECT_MAINLINE
297298
},
@@ -372,6 +373,24 @@ local labelRows = {
372373
version = WOW_PROJECT_MAINLINE
373374
},
374375

376+
-- 11.1.5
377+
eye_of_nzoth = {
378+
label = 'Eye of N\'Zoth',
379+
type = 'treecurrency',
380+
passRow = true,
381+
key = 3728,
382+
maxQuantity = 13,
383+
group = 'currency',
384+
version = WOW_PROJECT_MAINLINE
385+
},
386+
displaced_corrupted_mementos = {
387+
label = 'Corrupted Mementos',
388+
type = 'currency',
389+
key = 3149,
390+
group = 'currency',
391+
version = WOW_PROJECT_MAINLINE
392+
},
393+
375394
-- wotlk-classic
376395
honorBCC = {
377396
label = function()
@@ -525,6 +544,27 @@ local function UpdateAllCurrencies(charInfo)
525544
end
526545
end
527546

547+
local function UpdateAllTreeCurrencies(charInfo)
548+
local self = PermoksAccountManager
549+
charInfo.treeCurrencyInfo = charInfo.treeCurrencyInfo or {}
550+
551+
local currencyInfo = charInfo.treeCurrencyInfo
552+
for treeID, treeInfo in pairs(self.currencyTrees) do
553+
554+
local configID = C_Traits.GetConfigIDBySystemID(treeInfo.systemID)
555+
local treeCurrencyInfos = configID and C_Traits.GetTreeCurrencyInfo(configID, treeID, true)
556+
557+
if treeCurrencyInfos then
558+
for _, treeCurrencyInfo in ipairs(treeCurrencyInfos) do
559+
currencyInfo[treeCurrencyInfo.traitCurrencyID] = charInfo.currencyInfo[treeCurrencyInfo.traitCurrencyID] or {}
560+
currencyInfo[treeCurrencyInfo.traitCurrencyID].quantity = treeCurrencyInfo.quantity
561+
currencyInfo[treeCurrencyInfo.traitCurrencyID].maxQuantity = treeCurrencyInfo.maxQuantity
562+
currencyInfo[treeCurrencyInfo.traitCurrencyID].spent = treeCurrencyInfo.spent
563+
end
564+
end
565+
end
566+
end
567+
528568
local function SumWarbandCurrencies(warbandCurrency)
529569
local currencySum = 0
530570
for _, alt in pairs(warbandCurrency) do
@@ -564,6 +604,7 @@ end
564604

565605
local function Update(charInfo)
566606
UpdateAllCurrencies(charInfo)
607+
UpdateAllTreeCurrencies(charInfo)
567608

568609
-- requesting the warband data has a slight server-delay
569610
if PermoksAccountManager.isRetail then
@@ -607,6 +648,23 @@ local function UpdateCurrency(charInfo, currencyType, quantity, quantityChanged)
607648
end
608649
end
609650

651+
local function UpdateTreeCurrency(charInfo, treeID)
652+
local self = PermoksAccountManager
653+
if not self.currencyTrees[treeID] then
654+
return
655+
end
656+
657+
local treeInfo = self.currencyTrees[treeID]
658+
local currencyInfo = charInfo.treeCurrencyInfo[treeInfo.currencyType]
659+
660+
local configID = C_Traits.GetConfigIDBySystemID(treeInfo.systemID)
661+
local treeCurrencyInfo = configID and C_Traits.GetTreeCurrencyInfo(configID, treeID, true)
662+
if treeCurrencyInfo then
663+
currencyInfo.quantity = treeCurrencyInfo.quantity
664+
currencyInfo.maxQuantity = treeCurrencyInfo.maxQuantity
665+
end
666+
end
667+
610668
local function CurrencyTransferUpdate(charInfo)
611669
local self = PermoksAccountManager
612670
local accountData = self.account.data
@@ -709,6 +767,13 @@ local function CreateCofferKeyString(labelRow, currencyInfo, itemCounts)
709767
return PermoksAccountManager:CreateCurrencyString(keyInfo, nil, nil, nil, nil, nil, total)
710768
end
711769

770+
local function CreateTreeCurrencyString(labelRow, currencyInfo)
771+
local info = currencyInfo and currencyInfo[labelRow.key]
772+
if info then
773+
return PermoksAccountManager:CreateFractionString((info.quantity or 0) + (info.spent or 0), labelRow.maxQuantity or 0)
774+
end
775+
end
776+
712777
local payload = {
713778
update = Update,
714779
labels = labelRows,
@@ -717,6 +782,7 @@ local payload = {
717782
['PERKS_ACTIVITIES_UDPATED'] = UpdateCatalystCharges,
718783
['ACCOUNT_CHARACTER_CURRENCY_DATA_RECEIVED'] = UpdateAllWarbandCurrencies,
719784
['CURRENCY_TRANSFER_LOG_UPDATE'] = CurrencyTransferUpdate,
785+
['TRAIT_TREE_CURRENCY_INFO_UPDATED'] = UpdateTreeCurrency,
720786
},
721787
share = {
722788
[UpdateCurrency] = 'currencyInfo'
@@ -727,6 +793,7 @@ module:AddCustomLabelType('catalystcharges', CreateCatalystChargeString, nil, 'c
727793
module:AddCustomLabelType('crestcurrency', CreateCrestString, nil, 'currencyInfo')
728794
module:AddCustomLabelType('valor', CreateValorString, nil, 'currencyInfo')
729795
module:AddCustomLabelType('cofferkey', CreateCofferKeyString, nil, 'currencyInfo', 'itemCounts')
796+
module:AddCustomLabelType('treecurrency', CreateTreeCurrencyString, nil, 'treeCurrencyInfo')
730797

731798
-- TODO Create a CreateIconString function instead of two functions for items and currencies
732799
function PermoksAccountManager:CreateCurrencyString(currencyInfo, abbreviateCurrent, abbreviateMaximum, hideMaximum,

0 commit comments

Comments
 (0)