Mercurial > wow > inventory
comparison Core.lua @ 128:1729a41324d5
Debug channel will now be recreated when it was already found rather than re-used. This should prevent invisible debug frames.
author | Zerotorescue |
---|---|
date | Tue, 18 Jan 2011 00:18:12 +0100 |
parents | 6724bc8eface |
children | cd461a41723c |
comparison
equal
deleted
inserted
replaced
127:97fd38fb452d | 128:1729a41324d5 |
---|---|
2 local addon = select(2, ...); | 2 local addon = select(2, ...); |
3 addon = LibStub("AceAddon-3.0"):NewAddon(addon, "Inventorium", "AceEvent-3.0"); | 3 addon = LibStub("AceAddon-3.0"):NewAddon(addon, "Inventorium", "AceEvent-3.0"); |
4 | 4 |
5 local _G = _G; | 5 local _G = _G; |
6 local sformat, ssplit, slower, strim, smatch = _G.string.format, _G.string.split, _G.string.lower, _G.string.trim, _G.string.match; | 6 local sformat, ssplit, slower, strim, smatch = _G.string.format, _G.string.split, _G.string.lower, _G.string.trim, _G.string.match; |
7 local mfloor, print, pairs, tonumber = _G.math.floor, _G.print, _G.pairs, _G.tonumber; | 7 local floor, print, pairs, tonumber = _G.floor, _G.print, _G.pairs, _G.tonumber; |
8 | 8 |
9 --@debug@ | 9 --@debug@ |
10 local addonRevision = 1; | 10 local addonRevision = 1; |
11 --@end-debug@ | 11 --@end-debug@ |
12 --[===[@non-debug@ | 12 --[===[@non-debug@ |
99 self:RegisterSlash(function(this) | 99 self:RegisterSlash(function(this) |
100 this.debugChannel = false; | 100 this.debugChannel = false; |
101 for i = 1, NUM_CHAT_WINDOWS do | 101 for i = 1, NUM_CHAT_WINDOWS do |
102 local name = GetChatWindowInfo(i); | 102 local name = GetChatWindowInfo(i); |
103 | 103 |
104 if name:upper() == "DEBUG" then | 104 if string.upper(name) == "DEBUG" then |
105 this.debugChannel = _G["ChatFrame" .. i]; | 105 addon:Print("A debug channel already exists, removing the old one... (" .. i .. ")"); |
106 | 106 FCF_Close(_G["ChatFrame" .. i]); |
107 addon:Print("A debug channel already exists, used the old one. (" .. i .. ")"); | |
108 return; | |
109 end | 107 end |
110 end | 108 end |
111 | 109 |
112 if not this.debugChannel then | 110 if not this.debugChannel then |
113 -- Create a new debug channel | 111 -- Create a new debug channel |
368 local copperText = "%s%d|cffeda55fc|r"; | 366 local copperText = "%s%d|cffeda55fc|r"; |
369 | 367 |
370 function addon:ReadableMoney(copper, clean) | 368 function addon:ReadableMoney(copper, clean) |
371 local text = ""; | 369 local text = ""; |
372 | 370 |
373 local gold = mfloor( copper / COPPER_PER_GOLD ); | 371 local gold = floor( copper / COPPER_PER_GOLD ); |
374 if gold > 0 then | 372 if gold > 0 then |
375 text = sformat(goldText, text, gold); | 373 text = sformat(goldText, text, gold); |
376 end | 374 end |
377 | 375 |
378 if not clean or (not gold or gold < 10) then | 376 if not clean or (not gold or gold < 10) then |
379 local silver = mfloor( ( copper % COPPER_PER_GOLD ) / COPPER_PER_SILVER ); | 377 local silver = floor( ( copper % COPPER_PER_GOLD ) / COPPER_PER_SILVER ); |
380 if silver > 0 then | 378 if silver > 0 then |
381 text = sformat(silverText, text, silver); | 379 text = sformat(silverText, text, silver); |
382 end | 380 end |
383 | 381 |
384 if not clean or (not gold or gold < 1) then | 382 if not clean or (not gold or gold < 1) then |
385 local copper = mfloor( copper % COPPER_PER_SILVER ); | 383 local copper = floor( copper % COPPER_PER_SILVER ); |
386 if copper > 0 or text == "" then | 384 if copper > 0 or text == "" then |
387 text = sformat(copperText, text, copper); | 385 text = sformat(copperText, text, copper); |
388 end | 386 end |
389 end | 387 end |
390 end | 388 end |