From efb6e79dd824bfde407f9ad32ee133addcf7dc77 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonas=20S=C3=B6derberg?= <591175+imevul@users.noreply.github.com> Date: Tue, 14 May 2024 19:02:51 +0200 Subject: [PATCH] Added helper function --- .../SynastriaCoreLib-1.0/SynastriaCoreLib-1.0.lua | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/SynastriaCoreLib/SynastriaCoreLib-1.0/SynastriaCoreLib-1.0.lua b/src/SynastriaCoreLib/SynastriaCoreLib-1.0/SynastriaCoreLib-1.0.lua index 03f2f4d..6a9eb8c 100644 --- a/src/SynastriaCoreLib/SynastriaCoreLib-1.0/SynastriaCoreLib-1.0.lua +++ b/src/SynastriaCoreLib/SynastriaCoreLib-1.0/SynastriaCoreLib-1.0.lua @@ -218,9 +218,17 @@ function SynastriaCoreLib._GetModuleVersion(name) return moduleVersions[name] or 0 end +function SynastriaCoreLib.generateItemLink(itemId, suffixId, name, color) + color = color or 'ffffff' + name = name or '' + suffixId = suffixId or 0 + + return ('|cff%s|Hitem:%d:0:0:0:0:0:%d:%d:%d|h[%s]|h|r'):format(color, itemId, 0, suffixId, 0, name) +end + function SynastriaCoreLib.parseItemIdAndLink(itemIdOrLink, suffixId) if type(itemIdOrLink) == 'number' then - return itemIdOrLink, ('|cff%s|Hitem:%d:0:0:0:0:0:%d:%d:%d|h[%s]|h|r'):format('ffffff', itemIdOrLink, 0, suffixId or 0, 0, '') + return itemIdOrLink, SynastriaCoreLib.generateItemLink(itemIdOrLink, suffixId) elseif type(itemIdOrLink) == 'string' then return SynastriaCoreLib.parseItemId(itemIdOrLink, 0), itemIdOrLink end