vanilla-wow-addons – Blame information for rev 1
?pathlinks?
Rev | Author | Line No. | Line |
---|---|---|---|
1 | office | 1 | |
2 | |||
3 | function EQL3_Tooltip_OnLoad() |
||
4 | -- this will catch mobs needed for quests |
||
5 | this:RegisterEvent('UPDATE_MOUSEOVER_UNIT'); |
||
6 | |||
7 | -- this should catch items when you're going to sell them |
||
8 | EQL3_ContainerFrameItemButton_OnEnter = ContainerFrameItemButton_OnEnter; |
||
9 | ContainerFrameItemButton_OnEnter = EQL3_New_ContainerFrameItemButton_OnEnter; |
||
10 | end |
||
11 | |||
12 | |||
13 | function EQL3_Tooltip_OnEvent(event) |
||
14 | |||
15 | if (event == 'UPDATE_MOUSEOVER_UNIT') then |
||
16 | -- check if quest mob if player wants the tooltip feature... |
||
17 | if ( QuestlogOptions[EQL3_Player].MobTooltip == 1 ) then |
||
18 | EQL3_ScanTooltip(); |
||
19 | end |
||
20 | end |
||
21 | |||
22 | end |
||
23 | |||
24 | |||
25 | |||
26 | -- New function for container items |
||
27 | function EQL3_New_ContainerFrameItemButton_OnEnter() |
||
28 | -- call old function |
||
29 | EQL3_ContainerFrameItemButton_OnEnter(); |
||
30 | |||
31 | -- if player wants the tooltip feature... |
||
32 | if ( QuestlogOptions[EQL3_Player].ItemTooltip == 1 ) then |
||
33 | EQL3_ScanTooltip(); |
||
34 | end |
||
35 | end |
||
36 | |||
37 | function EQL3_ScanTooltip() |
||
38 | if ( GameTooltip ~= nil and |
||
39 | getglobal('GameTooltipTextLeft1'):IsVisible() and |
||
40 | getglobal('GameTooltipTextLeft1'):GetText() ~= nil ) then |
||
41 | |||
42 | return EQL3_ScanTooltipItem(getglobal('GameTooltipTextLeft1'):GetText()); |
||
43 | |||
44 | end |
||
45 | |||
46 | return false; |
||
47 | end |
||
48 | |||
49 | |||
50 | |||
51 | function EQL3_ScanTooltipItem(queryString) |
||
52 | if(queryString == nil) then return false; end |
||
53 | |||
54 | local oldSelection = GetQuestLogSelection(); |
||
55 | if(oldSelection < 1) then oldSelection = 1; end |
||
56 | |||
57 | local questID; |
||
58 | local numEntries = GetNumQuestLogEntries(); |
||
59 | local questTitle, level, questTag, isHeader; |
||
60 | local numObjectives; |
||
61 | local found = false; |
||
62 | local text, typ, finished; |
||
63 | |||
64 | -- loop through all quests |
||
65 | for i=1, numEntries, 1 do |
||
66 | questID = i; |
||
67 | questTitle, level, questTag, isHeader = GetQuestLogTitle(questID); |
||
68 | |||
69 | if (not isHeader) then |
||
70 | SelectQuestLogEntry(questID); |
||
71 | if(questTitle) then |
||
72 | numObjectives = GetNumQuestLeaderBoards(); |
||
73 | if(numObjectives > 0) then |
||
74 | |||
75 | -- loop through all objectives |
||
76 | for j=1, numObjectives, 1 do |
||
77 | text, typ, finished = GetQuestLogLeaderBoard(j); |
||
78 | if(not text or strlen(text) == 0) then |
||
79 | text = typ; |
||
80 | end |
||
81 | x = string.find(text, queryString); |
||
82 | if (x ~= nil) then |
||
83 | |||
84 | local completion = nil; |
||
85 | |||
86 | for y, z in string.gfind(text, "(%d+)/(%d+)") do |
||
87 | completion = " ("..y.."/"..z..")"; |
||
88 | end |
||
89 | |||
90 | -- DEFAULT_CHAT_FRAME:AddMessage("EQL: ".. y..", "..z, 1, 1, 1, 1); |
||
91 | |||
92 | if ( QuestlogOptions[EQL3_Player].ShowQuestLevels == 1 ) then |
||
93 | if(questTag ~= NIL) then |
||
94 | level = level.."+" |
||
95 | end |
||
96 | questTitle = "["..level.."] "..questTitle; |
||
97 | end |
||
98 | |||
99 | if ( QuestlogOptions[EQL3_Player].CustomTooltipColor == 1 ) then |
||
100 | questTitle = EQL3_ColorText(questTitle, QuestlogOptions[EQL3_Player].Color["Tooltip"].r, QuestlogOptions[EQL3_Player].Color["Tooltip"].g, QuestlogOptions[EQL3_Player].Color["Tooltip"].b); |
||
101 | else |
||
102 | questTitle = EQL3_ColorText(questTitle, 1.0, 0.8, 0.0); |
||
103 | end |
||
104 | |||
105 | if (completion ~= nil) then |
||
106 | questTitle = questTitle..completion; |
||
107 | end |
||
108 | |||
109 | -- add tooltip line |
||
110 | GameTooltip:AddLine(" ", 1, 1, 1, 1); |
||
111 | GameTooltip:AddLine(questTitle, 1, 1, 1, 1); |
||
112 | GameTooltip:SetHeight(GameTooltip:GetHeight() + 28); |
||
113 | |||
114 | -- resize tooltip |
||
115 | leng = getglobal(GameTooltip:GetName() .. "TextLeft" .. GameTooltip:NumLines()):GetStringWidth(); |
||
116 | leng = leng + 22; |
||
117 | |||
118 | if ( leng > GameTooltip:GetWidth() ) then |
||
119 | GameTooltip:SetWidth(leng); |
||
120 | end |
||
121 | |||
122 | found = true; |
||
123 | end |
||
124 | if(found) then |
||
125 | break; |
||
126 | end |
||
127 | end -- loop through all objectives |
||
128 | |||
129 | end |
||
130 | end |
||
131 | end |
||
132 | |||
133 | end -- loop through all quests |
||
134 | |||
135 | end |
||
136 | |||
137 | |||
138 | |||
139 | function EQL3_ScanTooltipForQuest() |
||
140 | |||
141 | end |