Tag lib
Darth Predator [04-01-17 - 09:21]
diff --git a/ElvUI_SLE/libs/Lib_SLETags-1.0/Lib_SLETags-1.0.lua b/ElvUI_SLE/libs/Lib_SLETags-1.0/Lib_SLETags-1.0.lua
new file mode 100644
index 0000000..a3c7154
--- /dev/null
+++ b/ElvUI_SLE/libs/Lib_SLETags-1.0/Lib_SLETags-1.0.lua
@@ -0,0 +1,64 @@
+local MAJOR, MINOR = "Lib_SLETags-1.0", 1
+local lib, oldminor = LibStub:NewLibrary(MAJOR, MINOR)
+--GLOBALS: CreateFrame
+if not lib then return end
+
+local _G = _G
+local tinsert, ipairs = tinsert, ipairs
+
+lib.TagsTable = {}
+
+function lib:ComplexTags_Process(module, msg)
+ local pattern = "%[(.-)%]([^;]+)"
+ local data = {}
+ local split_msg = { (";"):split(msg) }
+
+ for i, v in ipairs(split_msg) do
+ local split = split_msg[i]
+ local condition, option = split:match(pattern)
+ if (condition and option) then
+ local cnd_table = { (","):split(condition) }
+ local parsed_cmds = {};
+ for j = 1, #cnd_table do
+ local cnd = cnd_table[j];
+ if cnd then
+ local command, argument = (":"):split(cnd)
+ tinsert(parsed_cmds, { cmd = command:match("^%s*(.+)%s*$"), arg = argument })
+ end
+ end
+ tinsert(data, { option = option, cmds = parsed_cmds, module = module })
+ end
+ end
+
+ return data
+end
+
+function lib:SimpleTags_Process(module, msg)
+ local pattern = "%[(.-)%]%([^;]+)"
+ local data = {}
+ local split_msg = { (";"):split(msg) }
+
+ for i, v in ipairs(split_msg) do
+ local split = split_msg[i]
+
+ end
+end
+
+function lib:ComplexTags_ConditionsCheck(data)
+ for index,tagInfo in ipairs(data) do
+ local module = tagInfo.module
+ local ok = true
+ for conditionIndex,conditionInfo in ipairs(tagInfo.cmds) do
+ local func = conditionInfo["cmd"]
+ local arg = conditionInfo["arg"]
+ local result = lib.TagsTable[module][func](arg)
+ if not result then
+ ok = false
+ break
+ end
+ end
+ if ok then
+ return tagInfo.option
+ end
+ end
+end
\ No newline at end of file
diff --git a/ElvUI_SLE/libs/Lib_SLETags-1.0/Lib_SLETags-1.0.toc b/ElvUI_SLE/libs/Lib_SLETags-1.0/Lib_SLETags-1.0.toc
new file mode 100644
index 0000000..cddff9e
--- /dev/null
+++ b/ElvUI_SLE/libs/Lib_SLETags-1.0/Lib_SLETags-1.0.toc
@@ -0,0 +1,8 @@
+## Interface: 70200
+## Title: Lib_SLETags-1.0
+## Notes: Tag system for S&L.
+## Author: Darth Predator, sortokk
+## Version: 1.0.0
+## Dependencies: oUF
+
+Lib_SLETags-1.0.lua
\ No newline at end of file
diff --git a/ElvUI_SLE/libs/load_libs.xml b/ElvUI_SLE/libs/load_libs.xml
index ff6b904..5fcda03 100644
--- a/ElvUI_SLE/libs/load_libs.xml
+++ b/ElvUI_SLE/libs/load_libs.xml
@@ -1 +1 @@
-<Ui xmlns="http://www.blizzard.com/wow/ui/">
<Script file="AceAddon-3.0\AceAddon-3.0.lua"/>
<Script file="AceConsole-3.0\AceConsole-3.0.lua"/>
<Include file="LibTourist-3.0\lib.xml" />
<Script file="AceDB-3.0\AceDB-3.0.lua"/>
<Include file="LibElv-UIButtons-1.0\load_uibuttons.xml"/>
<Include file="LibElv-GameMenu-1.0\LibElv-GameMenu-1.0.lua"/>
<Script file="LibAnim\LibAnim.lua"/>
<Script file="LibQTip-1.0\LibQTip-1.0.lua"/>
<Script file="LibRangeCheck-2.0\LibRangeCheck-2.0.lua"/>
<Include file="LibBabble-SubZone-3.0\lib.xml"/>
<Include file="LibFishing-1.0\lib.xml" />
<Script file="oUF_OfflineSLE\oUF_OfflineSLE.lua"/>
<Include file="LibProcessable\LibProcessable.lua"/>
</Ui>
\ No newline at end of file
+<Ui xmlns="http://www.blizzard.com/wow/ui/">
<Script file="AceAddon-3.0\AceAddon-3.0.lua"/>
<Script file="AceConsole-3.0\AceConsole-3.0.lua"/>
<Include file="LibTourist-3.0\lib.xml" />
<Script file="AceDB-3.0\AceDB-3.0.lua"/>
<Include file="LibElv-UIButtons-1.0\load_uibuttons.xml"/>
<Include file="LibElv-GameMenu-1.0\LibElv-GameMenu-1.0.lua"/>
<Script file="LibAnim\LibAnim.lua"/>
<Script file="LibQTip-1.0\LibQTip-1.0.lua"/>
<Script file="LibRangeCheck-2.0\LibRangeCheck-2.0.lua"/>
<Include file="LibBabble-SubZone-3.0\lib.xml"/>
<Include file="LibFishing-1.0\lib.xml" />
<Script file="oUF_OfflineSLE\oUF_OfflineSLE.lua"/>
<Script file="Lib_SLETags-1.0\Lib_SLETags-1.0.lua"/>
<Include file="LibProcessable\LibProcessable.lua"/>
</Ui>
\ No newline at end of file