changeset 9:12d814c10962 v1.2-r9

Look for SavedVariables after they're available.
author Nenue
date Sat, 19 Dec 2015 00:02:57 -0500
parents 5fb37280eb74
children 5bd1ee0db47c
files Devian.lua
diffstat 1 files changed, 29 insertions(+), 21 deletions(-) [+]
line wrap: on
line diff
--- a/Devian.lua	Fri Dec 18 23:04:48 2015 -0500
+++ b/Devian.lua	Sat Dec 19 00:02:57 2015 -0500
@@ -12,23 +12,8 @@
 local print = function(...)
   _G.print('DVN', ...)
 end
-if not DevianDB then
-  DevianDB = {
-    ['global'] = {[STATE_LOW] = {}, [STATE_HIGH] = {}},
-    console = true,
-    dnd_status = true,
-    dnd_message = "Debugging. Your messages may get eaten.",
-    x = 100,
-    y = 800,
-    height = 500,
-    width = 600,
-    font = [[Interface\Addons\Devian\font\SourceCodePro-Regular.ttf]],
-    fontsize = 13,
-    fontoutline = 'NONE',
-  }
-  cherry = "This is probably the first time, so:\n  /dvn 2 to save your regular addon list\n  /dvn 1 to save your development addon list\n  /dvn to switch between the two\n  /dvc to toggle print() frame"
-end
-local db = DevianDB
+local db
+
 
 function D:SavePos(x,y)
   db.y = (DEVIAN_FRAME:GetTop() - GetScreenHeight())
@@ -179,8 +164,12 @@
     oldprint('Tried to print nothing.')
     return
   end
-  -- colorize
-  if not prefix_cache[prefix] then
+
+  -- color me timbers
+  local pcolor
+  if db.tags[prefix] then
+    pcolor = db.tags[prefix]
+  elseif not prefix_cache[prefix] then
     local c  = {0, 0, 0 }
     local max = string.len(prefix)
     for i = 1, max, 3 do
@@ -231,9 +220,28 @@
 
 
 function D:OnInitialize()
+  if not _G.DevianDB then
+    _G.DevianDB = {
+      ['global'] = {[STATE_LOW] = {}, [STATE_HIGH] = {}},
+      ['tags'] = {},
+      console = true,
+      dnd_status = true,
+      dnd_message = "Debugging. Your messages may get eaten.",
+      x = 100,
+      y = 800,
+      height = 500,
+      width = 600,
+      font = [[Interface\Addons\Devian\font\SourceCodePro-Regular.ttf]],
+      fontsize = 13,
+      fontoutline = 'NONE',
+    }
+    cherry = "This is probably the first time, so:\n  /dvn 2 to save your regular addon list\n  /dvn 1 to save your development addon list\n  /dvn to switch between the two\n  /dvc to toggle print() frame"
+  end
+  db = _G.DevianDB
 
+  print(PLAYER_REALM)
   if not db[PLAYER_REALM] then
-    db[PLAYER_REALM] = {[STATE_LOW] = {}, [STATE_HIGH] = {} }
+    db[PLAYER_REALM] = {[STATE_LOW] = {}, [STATE_HIGH] = {}}
     if not cherry then
       cherry = "This character didn't have an AddOn table."
     end
@@ -254,7 +262,7 @@
   setprinthandler(Message)
   self:RegisterChatCommand("dvn", ScanAddOnList)
   self:RegisterChatCommand("dvc", function(args)
-    db.console = (db.console == false) and true or false
+    db.console = (not db.console) and true or nil
     if db.console then
       DEVIAN_FRAME:Show()
       D:Maximize()