Mercurial > wow > devian
comparison Devian.lua @ 9:12d814c10962 v1.2-r9
Look for SavedVariables after they're available.
| author | Nenue |
|---|---|
| date | Sat, 19 Dec 2015 00:02:57 -0500 |
| parents | d0cd0e68213e |
| children | 65fcb81f4e0a |
comparison
equal
deleted
inserted
replaced
| 8:5fb37280eb74 | 9:12d814c10962 |
|---|---|
| 10 local DEVIAN_FRAME = DevianConsole | 10 local DEVIAN_FRAME = DevianConsole |
| 11 local cherry = false | 11 local cherry = false |
| 12 local print = function(...) | 12 local print = function(...) |
| 13 _G.print('DVN', ...) | 13 _G.print('DVN', ...) |
| 14 end | 14 end |
| 15 if not DevianDB then | 15 local db |
| 16 DevianDB = { | 16 |
| 17 ['global'] = {[STATE_LOW] = {}, [STATE_HIGH] = {}}, | |
| 18 console = true, | |
| 19 dnd_status = true, | |
| 20 dnd_message = "Debugging. Your messages may get eaten.", | |
| 21 x = 100, | |
| 22 y = 800, | |
| 23 height = 500, | |
| 24 width = 600, | |
| 25 font = [[Interface\Addons\Devian\font\SourceCodePro-Regular.ttf]], | |
| 26 fontsize = 13, | |
| 27 fontoutline = 'NONE', | |
| 28 } | |
| 29 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" | |
| 30 end | |
| 31 local db = DevianDB | |
| 32 | 17 |
| 33 function D:SavePos(x,y) | 18 function D:SavePos(x,y) |
| 34 db.y = (DEVIAN_FRAME:GetTop() - GetScreenHeight()) | 19 db.y = (DEVIAN_FRAME:GetTop() - GetScreenHeight()) |
| 35 db.x = DEVIAN_FRAME:GetLeft() | 20 db.x = DEVIAN_FRAME:GetLeft() |
| 36 db.width = DEVIAN_FRAME:GetWidth() | 21 db.width = DEVIAN_FRAME:GetWidth() |
| 177 local function Message(prefix, ...) | 162 local function Message(prefix, ...) |
| 178 if prefix == nil then | 163 if prefix == nil then |
| 179 oldprint('Tried to print nothing.') | 164 oldprint('Tried to print nothing.') |
| 180 return | 165 return |
| 181 end | 166 end |
| 182 -- colorize | 167 |
| 183 if not prefix_cache[prefix] then | 168 -- color me timbers |
| 169 local pcolor | |
| 170 if db.tags[prefix] then | |
| 171 pcolor = db.tags[prefix] | |
| 172 elseif not prefix_cache[prefix] then | |
| 184 local c = {0, 0, 0 } | 173 local c = {0, 0, 0 } |
| 185 local max = string.len(prefix) | 174 local max = string.len(prefix) |
| 186 for i = 1, max, 3 do | 175 for i = 1, max, 3 do |
| 187 for k, v in ipairs(c) do | 176 for k, v in ipairs(c) do |
| 188 local j = i + (k - 1) | 177 local j = i + (k - 1) |
| 229 end | 218 end |
| 230 end | 219 end |
| 231 | 220 |
| 232 | 221 |
| 233 function D:OnInitialize() | 222 function D:OnInitialize() |
| 234 | 223 if not _G.DevianDB then |
| 224 _G.DevianDB = { | |
| 225 ['global'] = {[STATE_LOW] = {}, [STATE_HIGH] = {}}, | |
| 226 ['tags'] = {}, | |
| 227 console = true, | |
| 228 dnd_status = true, | |
| 229 dnd_message = "Debugging. Your messages may get eaten.", | |
| 230 x = 100, | |
| 231 y = 800, | |
| 232 height = 500, | |
| 233 width = 600, | |
| 234 font = [[Interface\Addons\Devian\font\SourceCodePro-Regular.ttf]], | |
| 235 fontsize = 13, | |
| 236 fontoutline = 'NONE', | |
| 237 } | |
| 238 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" | |
| 239 end | |
| 240 db = _G.DevianDB | |
| 241 | |
| 242 print(PLAYER_REALM) | |
| 235 if not db[PLAYER_REALM] then | 243 if not db[PLAYER_REALM] then |
| 236 db[PLAYER_REALM] = {[STATE_LOW] = {}, [STATE_HIGH] = {} } | 244 db[PLAYER_REALM] = {[STATE_LOW] = {}, [STATE_HIGH] = {}} |
| 237 if not cherry then | 245 if not cherry then |
| 238 cherry = "This character didn't have an AddOn table." | 246 cherry = "This character didn't have an AddOn table." |
| 239 end | 247 end |
| 240 end | 248 end |
| 241 | 249 |
| 252 _G.oldprint = D.oldprint | 260 _G.oldprint = D.oldprint |
| 253 end | 261 end |
| 254 setprinthandler(Message) | 262 setprinthandler(Message) |
| 255 self:RegisterChatCommand("dvn", ScanAddOnList) | 263 self:RegisterChatCommand("dvn", ScanAddOnList) |
| 256 self:RegisterChatCommand("dvc", function(args) | 264 self:RegisterChatCommand("dvc", function(args) |
| 257 db.console = (db.console == false) and true or false | 265 db.console = (not db.console) and true or nil |
| 258 if db.console then | 266 if db.console then |
| 259 DEVIAN_FRAME:Show() | 267 DEVIAN_FRAME:Show() |
| 260 D:Maximize() | 268 D:Maximize() |
| 261 else | 269 else |
| 262 DEVIAN_FRAME:Hide() | 270 DEVIAN_FRAME:Hide() |
