Merge branch 'feature/custom-color'

Richard Atterfalk [03-21-19 - 18:44]
Merge branch 'feature/custom-color'
Filename
README.md
toxicIRC.lua
toxicIRC.txt
diff --git a/README.md b/README.md
index 7120ba2..e7c190d 100644
--- a/README.md
+++ b/README.md
@@ -1,7 +1,9 @@
 toxicIRC
 ####

-A small addon for Elder Scrolls Online with the purpose of changing your name when someone writes it in the chat.
+A small addon for Elder Scrolls Online with the purpose of changing the colour of your name when someone writes it in the chat.
 This is to easier notify you when someone want your attention and is inspired by irc-clients such as irssi and mIRC.
 #
-It checks the text for the username and then loops through each character and compares all letters in the pattern found with the username.
+Working on getting a colourpicker to work and considering an implementation where the user (you) can opt your own
+abbreviations as well. You might have a longer name for your character, like "Anya Telvanni", and want it to react to Anya.
+I am not aware if there would be any performance-issues or memory-leaks with such a system, so that version won't be out for some time.
\ No newline at end of file
diff --git a/toxicIRC.lua b/toxicIRC.lua
index 5cee706..c7f724d 100644
--- a/toxicIRC.lua
+++ b/toxicIRC.lua
@@ -15,14 +15,16 @@ local optionsData = {
     [1] = {
             type = "colorpicker",
             name = "Text Color",
-            getFunc = function() return toxicIRCAddon.savedVariables.colors.r, toxicIRCAddon.savedVariables.colors.g, toxicIRCAddon.savedVariables.colors.b end,
-            setFunc = function(r,g,b,a) print(r,g,b) end,
             -- setFunc = function(r,g,b,a) toxicIRCAddon.savedVariables.colors.r=r, toxicIRCAddon.savedVariables.colors.g=g, toxicIRCAddon.savedVariables.colors.b=b end,
+            getFunc = function() return toxicIRCAddon.savedVariables.colors.r, toxicIRCAddon.savedVariables.colors.g, toxicIRCAddon.savedVariables.colors.b, toxicIRCAddon.savedVariables.colors.a end,
+            -- setFunc = function(r,g,b,a) print(r,g,b) end,
+            setFunc = function(r,g,b,a) toxicIRCAddon.savedVariables.colors.r=r, toxicIRCAddon.savedVariables.colors.g=g, toxicIRCAddon.savedVariables.colors.b=b, toxicIRCAddon.savedVariables.colors.a=a end,
             tooltip = "Set the color of the text.",
             width = "full",
-            requiresReload = false, -- boolean, if set to true, the warning text will contain a notice that changes are only applied after an UI reload and any change to the value will make the "Apply Settings" button appear on the panel which will reload the UI when pressed (optional)
-            -- default = {r = defaults.r, g = defaults.g, b = defaults.b, a = defaults.a}, --(optional) table of default color values (or default = defaultColor, where defaultColor is a table with keys of r, g, b[, a]) or a function that returns the color
-            -- reference = "MyAddonColorpicker" -- unique global reference to control (optional)
+
+            requiresReload = true,
+            -- default = toxicIRCAddon.savedVariables.colors, --(optional) table of default color values (or default = defaultColor, where defaultColor is a table with keys of r, g, b[, a]) or a function that returns the color
+            -- reference = "ToxicIRCColorpicker" -- unique global reference to control (optional)
     }
 }

@@ -43,7 +45,6 @@ function toxicIRCAddon:checkName(msg)
             end
         end
     end
-    return nil
 end

 function toxicIRCAddon:IRCStyle(text)
@@ -80,14 +81,17 @@ function toxicIRCAddon:Initialize()
     end)

     defaults = {
-        r = 1,
-        g = 1,
-        b = 0
+        colors = {
+            r = 1,
+            g = 1,
+            b = 0,
+            a = 1
+        }
     }

     self.savedVariables = ZO_SavedVars:New("toxicIRCSavedVariables", 1, nil, defaults)
-    -- LAM:RegisterAddonPanel("MyAddonOptions", panelData)
-    -- LAM:RegisterOptionControls("MyAddonOptions", optionsData)
+    LAM:RegisterAddonPanel("ToxicIRCOptions", panelData)
+    LAM:RegisterOptionControls("ToxicIRCOptions", optionsData)
 end

 function toxicIRCAddon.OnAddOnLoaded(event, addonName)
@@ -96,4 +100,4 @@ function toxicIRCAddon.OnAddOnLoaded(event, addonName)
     end
 end

-EVENT_MANAGER:RegisterForEvent(toxicIRCAddon.name, EVENT_ADD_ON_LOADED, toxicIRCAddon.OnAddOnLoaded)
\ No newline at end of file
+EVENT_MANAGER:RegisterForEvent(toxicIRCAddon.name, EVENT_ADD_ON_LOADED, toxicIRCAddon.OnAddOnLoaded)
diff --git a/toxicIRC.txt b/toxicIRC.txt
index 63378c0..dfcb46e 100644
--- a/toxicIRC.txt
+++ b/toxicIRC.txt
@@ -1,7 +1,7 @@
 ## Title: ToxicIRC
 ## Author: ToxicSky
 ## Version: 0.9
-## APIVersion: 100025
+## APIVersion: 100026
 ## SavedVariables: toxicIRCSavedVariables
 ## Description: Adds a different colour of your name when someone writes it. This is to keep better track of conversations, no matter if it is in zone-, guild or group-chat.
 ## DependsOn: LibAddonMenu-2.0