vanilla-wow-addons – Blame information for rev 1
?pathlinks?
Rev | Author | Line No. | Line |
---|---|---|---|
1 | office | 1 | --[[ |
2 | Functions for "report to textbox" |
||
3 | |||
4 | meta: |
||
5 | .InfoFor = nil or name |
||
6 | .InfoTypeString = The info string displayed (localized) |
||
7 | .InfoTypeNum = the info number (same throughout languages) |
||
8 | .SelectedFilter = "NONE", "PC", "NPC", "GROUP", "EGROUP" |
||
9 | .ClassFilter = "NONE" or Class filter used (capitalized english names) |
||
10 | .ClassFilterLocalized = Class filter used localized if known, else .ClassFilter |
||
11 | .ShowPercent = true, false |
||
12 | .ShowRank = true, false |
||
13 | .ShowNumber = true, false |
||
14 | .ReportAmount = 1 to 40 #amount of rows to show |
||
15 | |||
16 | data: |
||
17 | [1] string |
||
18 | [2] value |
||
19 | [3] nil or color{} |
||
20 | [4] group number (normally 1) - Used to group different "things" e.g. used for details where heal and dmg info is displayed |
||
21 | [5] % val of total |
||
22 | |||
23 | Be sure to add new functions to SW_TE_Functions at the bottom of this file. |
||
24 | ]]-- |
||
25 | SW_TE_NL = "\r\n"; |
||
26 | |||
27 | function SW_TE_Normal(meta, data) |
||
28 | |||
29 | strOut = meta.InfoTypeString; |
||
30 | if meta.InfoFor then |
||
31 | strOut = strOut.." "..meta.InfoFor; |
||
32 | end |
||
33 | strOut = strOut..SW_TE_NL; |
||
34 | if meta.SelectedFilter ~= "NONE" then |
||
35 | strOut = strOut..meta.SelectedFilter..SW_TE_NL; |
||
36 | end |
||
37 | if meta.ClassFilter ~= "NONE" then |
||
38 | strOut = strOut..meta.ClassFilterLocalized..SW_TE_NL; |
||
39 | end |
||
40 | strOut = strOut..SW_TE_NL; |
||
41 | |||
42 | for i, v in ipairs(data) do |
||
43 | if i > meta.ReportAmount then |
||
44 | break; |
||
45 | end |
||
46 | |||
47 | if meta.ShowRank then |
||
48 | strOut = strOut..i.." "..v[1]; |
||
49 | else |
||
50 | strOut = strOut..v[1]; |
||
51 | end |
||
52 | if meta.ShowNumber then |
||
53 | strOut = strOut.." "..v[2]; |
||
54 | end |
||
55 | if meta.ShowPercent then |
||
56 | strOut = strOut.." ("..v[5].."%)"; |
||
57 | end |
||
58 | strOut = strOut..SW_TE_NL; |
||
59 | |||
60 | |||
61 | end |
||
62 | return strOut; |
||
63 | end |
||
64 | |||
65 | function SW_TE_HTML(meta, data) |
||
66 | if meta.InfoFor then |
||
67 | strOut = "<h1>"..meta.InfoTypeString.." "..meta.InfoFor.."</h1>"; |
||
68 | else |
||
69 | strOut = "<h1>"..meta.InfoTypeString.."</h1>"; |
||
70 | end |
||
71 | strOut = strOut.."<br />"..SW_TE_NL; |
||
72 | if meta.SelectedFilter ~= "NONE" then |
||
73 | strOut = strOut..meta.SelectedFilter.."<br />"..SW_TE_NL; |
||
74 | end |
||
75 | if meta.ClassFilter ~= "NONE" then |
||
76 | strOut = strOut..meta.ClassFilterLocalized.."<br />"..SW_TE_NL; |
||
77 | end |
||
78 | strOut = strOut..SW_TE_NL.."<table>"..SW_TE_NL; |
||
79 | |||
80 | for i, v in ipairs(data) do |
||
81 | if i > meta.ReportAmount then |
||
82 | break; |
||
83 | end |
||
84 | strOut = strOut.."<tr>"; |
||
85 | if meta.ShowRank then |
||
86 | strOut = strOut.."<td>"..i.."</td><td>"..v[1].."</td>"; |
||
87 | else |
||
88 | strOut = strOut.."<td>"..v[1].."</td>"; |
||
89 | |||
90 | end |
||
91 | if meta.ShowNumber then |
||
92 | strOut = strOut.."<td>"..v[2].."</td>"; |
||
93 | end |
||
94 | if meta.ShowPercent then |
||
95 | strOut = strOut.."<td>("..v[5].."%)</td>"; |
||
96 | end |
||
97 | strOut = strOut.."</tr>"..SW_TE_NL; |
||
98 | |||
99 | |||
100 | end |
||
101 | return strOut.."</table>"; |
||
102 | end |
||
103 | |||
104 | SW_TE_Functions = { |
||
105 | [1] = {SW_TE_Normal, "Normal"}, |
||
106 | [2] = {SW_TE_HTML, "HTML"}, |
||
107 | }; |