vanilla-wow-addons – Blame information for rev 1

Subversion Repositories:
Rev:
Rev Author Line No. Line
1 office 1 --[[
2 -- Name: TinyTip
3 -- Author: Thrae of Maelstrom (aka "Matthew Carras")
4 -- Release Date: 6-25-06
5 --
6 -- These functions include adding target data.
7 -- If you don't use these options, then you can safely
8 -- remove it from the TOC.
9 --]]
10  
11 local _G = getfenv(0)
12 local tmp,tmp2,i,pid,RaidTable,c
13 local strformat = string.format
14 local tooltip = _G.GameTooltip
15 local fGetName = UIParent.GetName
16 local gtAddLine, AddDoubleLine = GameTooltip.AddLine, GameTooltip.AddDoubleLine
17 local fsSetText, fsGetText = _G.GameTooltipTextLeft1.SetText, _G.GameTooltipTextLeft1.GetText
18  
19 _G.TinyTipTargetsExists = true
20  
21 function TinyTipTargets_ResetReferences(_AddLine,_AddDoubleLine, _tooltip)
22 gtAddLine, gtAddDoubleLine, tooltip = _AddLine, _AddDoubleLine, _tooltip
23 end
24  
25 -- Add Target of Mouseover (what they're targeting)
26 function TinyTipTargets_Mouse(unit,flag)
27 pid = unit .. "target"
28 if _G.UnitExists(pid) then
29 tmp = _G.UnitIsUnit(pid, "player")
30 c = _G[ fGetName(tooltip) .. "TextLeft1" ]
31 tmp2 = strformat("%s : |cFF%s%s|r",
32 (flag == 2 and fsGetText(c)) or _G.TinyTipTargetsLocale_Targeting,
33 (not tmp and _G.UnitIsPlayer(pid) and _G.TinyTip_ColorPlayer(pid)) or "FFFFFF",
34 (not tmp and (_G.UnitName(pid) or "Unknown")) or _G.TinyTipTargetsLocale_YOU)
35 if flag == 2 then
36 fsSetText( c, tmp2)
37 else
38 gtAddLine( tooltip, tmp2)
39 end
40 end
41 end
42  
43 -- Add How Many Raid Members are targeting this unit (except you)
44 function TinyTipTargets_Raid(unit,num,flag)
45 c,tmp2 = 0,nil
46 if flag == 2 then
47 if not RaidTable then RaidTable = {} end
48 for c,tmp in RaidTable do
49 if tmp then RaidTable[c]["n"] = 0 end
50 end
51 end
52 for i = 1,num,1 do
53 pid = "raid" .. i
54 if _G.UnitIsUnit(pid .. "target",unit) and not _G.UnitIsUnit(pid,"player") then
55 if flag == 2 then
56 _,c = _G.UnitClass(pid)
57 if c then
58 if not RaidTable[c] then RaidTable[c] = {} end
59 if not RaidTable[c]["l"] then RaidTable[c]["l"] = _G.UnitClass(pid) end
60 RaidTable[c]["n"] = (RaidTable[c]["n"] or 0) + 1
61 end
62 elseif flag == 3 then
63 tmp2 = strformat("%s|cFF%s%s|r\n",
64 tmp2 or "", _G.TinyTip_ColorPlayer(pid), _G.UnitName(pid) or "Unknown")
65 c = c + 1
66 else
67 if not tmp2 then tmp2 = 0 end
68 tmp2 = tmp2 + 1
69 end
70 end
71 end
72 if flag == 2 and RaidTable then
73 gtAddLine( tooltip, _G.TinyTipTargetsLocale_TargetedBy .. ":\n" )
74 for c,tmp in RaidTable do
75 if tmp and tmp.n and tmp.n > 0 and tmp.l then
76 gtAddLine( tooltip, strformat("|cFF%s%s|r: %d",
77 strformat("%2x%2x%2x",
78 _G.RAID_CLASS_COLORS[c].r*255,
79 _G.RAID_CLASS_COLORS[c].g*255,
80 _G.RAID_CLASS_COLORS[c].b*255),
81 tmp.l,
82 tmp.n ) )
83 end
84 end
85 elseif tmp2 and flag == 3 then
86 gtAddLine( tooltip, strformat("%s: %s%s",
87 _G.TinyTipTargetsLocale_TargetedBy,
88 ((c > 1) and "\n") or "",
89 tmp2) )
90 elseif tmp2 and tmp2 > 0 then
91 gtAddLine( tooltip, strformat("%s: (|cFFFFFFFF%s|r) %s",
92 _G.TinyTipTargetsLocale_TargetedBy, tostring(tmp2),
93 _G.RAID) )
94 end
95 end
96  
97 -- Add How Many Party Members are targeting this unit (except you)
98 function TinyTipTargets_Party(unit, num, flag)
99 tmp,tmp2 = 0,nil
100 for i = 1,num,1 do
101 pid = "party" .. i
102 if _G.UnitIsUnit(pid .. "target",unit) and not _G.UnitIsUnit(pid, "player") then
103 if flag ~= 2 then
104 tmp2 = strformat("%s|cFF%s%s|r\n",
105 tmp2 or "", _G.TinyTip_ColorPlayer(pid), _G.UnitName(pid) or "Unknown")
106 tmp = tmp + 1
107  
108 else
109 if not tmp2 then tmp2 = 0 end
110 tmp2 = tmp2 + 1
111 end
112 end
113 end
114 if tmp2 then
115 if flag ~= 2 then
116 gtAddLine( tooltip, strformat("%s: %s%s",
117 _G.TinyTipTargetsLocale_TargetedBy,
118 ((tmp > 0) and "\n") or "",
119 tmp2) )
120 else
121 gtAddLine( tooltip, strformat("%s: (|cFFFFFFFF%s|r) %s",
122 _G.TinyTipTargetsLocale_TargetedBy, tmp2, _G.TUTORIAL_TITLE19) )
123 end
124 end
125 end