vanilla-wow-addons – Blame information for rev 1
?pathlinks?
Rev | Author | Line No. | Line |
---|---|---|---|
1 | office | 1 | local playerName; |
2 | local playerAccount; |
||
3 | |||
4 | function GuildAdsTooltip_OnLoad() |
||
5 | playerName = UnitName("player"); |
||
6 | end |
||
7 | |||
8 | function GuildAdsTooltip_Format(adtype, data) |
||
9 | if data then |
||
10 | local r, g, b; |
||
11 | local ownerAccount = GAS_ProfileGet(data.owner).accountid or true; |
||
12 | if data.owner==playerName or ownerAccount==playerAccount then |
||
13 | if adtype==GUILDADS_MSG_TYPE_REQUEST then |
||
14 | r, g, b = 1,0.75,0; |
||
15 | else |
||
16 | r, g, b = 1,0,0.75; |
||
17 | end |
||
18 | else |
||
19 | if adtype==GUILDADS_MSG_TYPE_REQUEST then |
||
20 | r, g, b = 1,1,0.5; |
||
21 | else |
||
22 | r, g, b = 1,0.5,1; |
||
23 | end |
||
24 | end |
||
25 | if data.inf then |
||
26 | if data.count>0 then |
||
27 | return data.owner .. " (" .. data.count .. "+)", r, g, b; |
||
28 | else |
||
29 | return data.owner, r, g, b; |
||
30 | end |
||
31 | else |
||
32 | return data.owner .. " (" .. data.count .. ")", r, g, b; |
||
33 | end |
||
34 | else |
||
35 | return " ", 1, 1, 1; |
||
36 | end |
||
37 | end |
||
38 | |||
39 | function GuildAdsTooltip_OnShow() |
||
40 | GuildAdsTooltip_AddInformations(GameTooltip); |
||
41 | end |
||
42 | |||
43 | function GuildAdsTooltip_AddInformations(tooltip) |
||
44 | local lbl = getglobal(tooltip:GetName().."TextLeft1"); |
||
45 | if lbl then |
||
46 | local itemName = lbl:GetText(); |
||
47 | local infosR, infosA = GAS_GetItemAdsInfo(itemName); |
||
48 | if infosR or infosA then |
||
49 | |||
50 | playerAccount = GAS_ProfileGet(playerName).accountid; |
||
51 | |||
52 | local i=1; |
||
53 | while (infosR[i] or infosA[i]) and i<5 do |
||
54 | local msgR, msgRr, msgRg, msgRb = GuildAdsTooltip_Format(GUILDADS_MSG_TYPE_REQUEST, infosR[i]); |
||
55 | local msgA, msgAr, msgAg, msgAb = GuildAdsTooltip_Format(GUILDADS_MSG_TYPE_AVAILABLE, infosA[i]); |
||
56 | GameTooltip:AddDoubleLine(msgR, msgA, msgRr, msgRg, msgRb, msgAr, msgAg, msgAb); |
||
57 | i= i+1; |
||
58 | end |
||
59 | tooltip:Show(); |
||
60 | end |
||
61 | end |
||
62 | end |
||
63 |