vanilla-wow-addons – Blame information for rev 1

Subversion Repositories:
Rev:
Rev Author Line No. Line
1 office 1 -- -----------------------------------------------------------------
2 -- File: AIOB.lua
3 --
4 -- Purpose: Functions for AIOB WoW Window.
5 --
6 -- Author: Ramble
7 --
8 -- Credits:
9 -- Starven, for MyInventory
10 -- Kaitlin, for BankItems
11 -- Sarf, for the original concept of AllInOneInventory
12 -- -----------------------------------------------------------------
13  
14 function AIOB_Trim (s)
15 return (string.gsub(s, "^%s*(.-)%s*$", "%1"));
16 end
17  
18 function AIOB_Split(toCut, separator)
19 if toCut == nil or separator == nil then
20 return nil
21 end
22 local splitted = {};
23 local i = 0;
24 local regEx = "([^" .. separator .. "]*)" .. separator .. "?";
25  
26 for item in string.gfind(toCut .. separator, regEx) do
27 i = i + 1;
28 splitted[i] = AIOB_Trim(item) or '';
29 end
30 splitted[i] = nil;
31 return splitted;
32 end
33  
34 function AIOB_GetBankSlotCost(bags)
35 if bags == 0 then
36 return 1000;
37 elseif bags == 1 then
38 return 10000;
39 elseif bags == 2 then
40 return 100000;
41 elseif bags == 3 then
42 return 250000;
43 elseif bags == 4 then
44 return 500000;
45 elseif bags == 5 then
46 return 1000000;
47 else
48 return 0;
49 end
50 end
51  
52 -- Prints out text to a chat box.
53 function AIOB_Print(msg,r,g,b,frame,id,unknown4th)
54 -- if ( Print ) then
55 -- Print(msg, r, g, b, frame, id, unknown4th);
56 -- return;
57 -- end
58 if(unknown4th) then
59 local temp = id;
60 id = unknown4th;
61 unknown4th = id;
62 end
63  
64 if (not r) then r = 1.0; end
65 if (not g) then g = 1.0; end
66 if (not b) then b = 0.0; end
67 if ( frame ) then
68 frame:AddMessage(msg,r,g,b,id,unknown4th);
69 else
70 if ( DEFAULT_CHAT_FRAME ) then
71 if type(msg) == 'string' then
72 DEFAULT_CHAT_FRAME:AddMessage(msg, r, g, b,id,unknown4th);
73 else
74 for key, value in msg do
75 DEFAULT_CHAT_FRAME:AddMessage(value, r, g, b,id,unknown4th);
76 end
77 end
78 end
79 end
80 end
81  
82 function AIOB_DEBUG(msg)
83 -- If Debug is not set, just skip it.
84 if ( not AIOBDEBUG or AIOBDEBUG == 0 ) then
85 return;
86 end
87 msg = "*** DEBUG(AIOB): "..msg;
88 if ( DEFAULT_CHAT_FRAME ) then
89 DEFAULT_CHAT_FRAME:AddMessage(msg, 1.0, 1.0, 0.0);
90 end
91 end
92