This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function plateAPI:update_health(current,max) | |
local text = ( | |
current > 999999 and ('%.1fM'):format(current/1000000) or | |
current > 99999 and ('%dk') :format(current/1000) or | |
current > 9999 and ('%.1fk'):format(current/1000) or | |
('%d'):format(current) | |
) | |
self.hptext:SetText(text) | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- Credit and thanks to Tidy Plates for this. | |
local function classcolor(r,g,b) | |
r,g,b = floor(r*100+.5),floor(g*100+.5),floor(b*100+.5) | |
return ('%03d%03d%03d'):format(r,g,b) | |
end | |
local classes = {} | |
for class,color in pairs(RAID_CLASS_COLORS) do | |
classes[classcolor(color.r,color.g,color.b)] = class |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- Depends on: nfAddon | |
-- Grab host namespace | |
local _,mod = ... | |
-- Frame signals |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- use this lib: http://www.curse.com/addons/wow/utf8 | |
-- defaults to ASCII-only lower if not present | |
local lower = string.utf8lower or string.lower | |
local function fullIDbyname(itemname) | |
itemname = lower(itemname) | |
for bag = 0,4 do | |
for slot = 1,GetContainerNumSlots(bag) do |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
do | |
local err_fmt = "bad argument #%s to '%s' (%s expected, got %s)" | |
local function checktypelist(t,a1,...) | |
if a1 then | |
return t == a1 or checktypelist(t,...) | |
end | |
end | |
function mod:argcheck(val,argn,...) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function replace_chatframe1_messages (frame, text, ...) | |
for k,v in pairs(chat_replacements) do | |
text = text:gsub(k, v) | |
end | |
return old_chatframe1_addmessage(frame, text, ...) | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function replace_chatframe1_messages (frame, text, red, green, blue, id) | |
for k,v in pairs(chat_replacements) do | |
text = text:gsub(k, v) | |
end | |
return old_chatframe1_addmessage(frame, text, red, green, blue, id) | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
local stack_prototype = { __index = { | |
MAXSIZE = 100, -- default max size (client called newstack() with no size) | |
push = function(self,val) | |
if #self > self.MAXSIZE then | |
table.remove(self,1) | |
end | |
self[#self+1] = val | |
end, | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
local MAXSIZE = 100 | |
local stack = {} | |
local function stack_push(val) | |
if #stack > MAXSIZE then | |
table.remove(stack,1) | |
end | |
stack[#stack+1] = val | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
local function writeout(n,a,...) | |
if n > 0 then | |
io.stdout:write(a,'\t') | |
return writeout(n-1,...) | |
end | |
end | |
function print(...) | |
local n = select('#',...) | |
if n > 0 then |