Skip to content

Commit

Permalink
Added support for hidden Perks
Browse files Browse the repository at this point in the history
  • Loading branch information
imevul committed Jul 4, 2024
1 parent b5d0e00 commit 5dadab2
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 24 deletions.
49 changes: 27 additions & 22 deletions src/SynastriaCoreLib/SynastriaCoreLib-1.0/Modules/Perks.lua
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
local _, NS = ...
local MODULE_NAME, MODULE_VERSION = 'Perks', 3
local MODULE_NAME, MODULE_VERSION = 'Perks', 4
-- TODO: Still a work in progress! Use at your own risk!

NS.DebugLog(MODULE_NAME, MODULE_VERSION, 'Start')
Expand Down Expand Up @@ -51,28 +51,33 @@ function SynastriaCoreLib.Perks.GetActiveTasks()
for perkId, pivotId in SynastriaCoreLib.AllCustomGameData(SynastriaCoreLib.CustomDataTypes.PERK_TASKASSIGN1) do
if GetPerkActive(perkId) then
local perk = PerkMgrPerks[perkId]
local taskId = GetPerkTaskAssign2(pivotId or 0)
local task = PerkMgrTaskAll[taskId or 0]
local color = ('|cff%s%s|r'):format(SynastriaCoreLib.Perks.CategoryColors[perk.cat] or 'ffffff', '%s')

if task then
local progress = ''
if (task.req0 or 0) > 0 then
progress = (' %d / %d'):format(SynastriaCoreLib.Perks.GetTaskProgress(pivotId), task.req0 or 0)
if perk then
if bit.band(perk.flags, 0x400) ~= 0x400 then
local taskId = GetPerkTaskAssign2(pivotId or 0)
local task = PerkMgrTaskAll[taskId or 0]
local color = ('|cff%s%s|r'):format(SynastriaCoreLib.Perks.CategoryColors[perk.cat] or 'ffffff', '%s')

if task then
local progress = ''
if (task.req0 or 0) > 0 then
progress = (' %d / %d'):format(SynastriaCoreLib.Perks.GetTaskProgress(pivotId), task.req0 or 0)
end

table.insert(ret, {
cat = perk.cat,
perkId = perkId,
perk = perk,
perkName = perk.name,
perkNameColored = color:format(perk.name),
--perkNameColored = ('%d %s'):format(perkId, color:format(perk.name)),
perkLevel = GetCustomGameData(SynastriaCoreLib.CustomDataTypes.PERK_ACQUIRED, perkId),
taskId = taskId,
task = task,
text = SynastriaCoreLib.Perks.GetPerkTaskText(perkId, task),
progress = progress,
})
end
end

table.insert(ret, {
cat = perk.cat,
perkId = perkId,
perk = perk,
perkName = perk.name,
perkNameColored = color:format(perk.name),
perkLevel = GetCustomGameData(SynastriaCoreLib.CustomDataTypes.PERK_ACQUIRED, perkId),
taskId = taskId,
task = task,
text = SynastriaCoreLib.Perks.GetPerkTaskText(perkId, task),
progress = progress,
})
end
end
end
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
local wowAddonName, NS = ...
local SYNASTRIACORELIB_MAJOR, SYNASTRIACORELIB_MINOR = 'SynastriaCoreLib-1.0', 13
local SYNASTRIACORELIB_MAJOR, SYNASTRIACORELIB_MINOR = 'SynastriaCoreLib-1.0', 14
NS.SYNASTRIACORELIB_MINOR = SYNASTRIACORELIB_MINOR

if not SCL then SCL = {} end
Expand Down
2 changes: 1 addition & 1 deletion src/SynastriaCoreLib/SynastriaCoreLib.toc
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
## Title: SynastriaCoreLib-1.0
## Notes: A library of functions from Synastria
## Author: Imevul, meh321
## Version: 1.0.13-Release
## Version: 1.0.14-Release
## X-Category: Imevul

#@no-lib-strip@
Expand Down

0 comments on commit 5dadab2

Please sign in to comment.