vanilla-wow-addons – Blame information for rev 1

Subversion Repositories:
Rev:
Rev Author Line No. Line
1 office 1 --[[
2  
3 QuestLevels
4 >> http://www.insurgenceguild.com/insurgence/ui_mods.php
5  
6 By Halfhand <halfhand@insurgenceguild.com>
7  
8 Shows quest levels in the quest log, and speeds up quest text display.
9  
10 Based on code from Vjeux's QuestMinion mod (<3 QM).
11 >> http://www.curse-gaming.com/mod.php?addid=83
12  
13  
14 CHANGE LOG:
15  
16 v0.3 - 2005.03.28
17 - Quests are now automatically removed from the tracker when completed
18 - Added flags in tracker level based on quest tag (elite, dungeon, raid)
19 - Levels of quests in tracker are now coloured based on difficulty
20  
21 v0.2 - 2005.03.26
22 - Added quest levels to quest tracker frame
23 - Fixed position of check mark next to quest titles in main quest log for
24 incomplete quests (was positioned correctly for completed quests)
25 - Miscellaneous minor optimizations
26  
27 v0.1 - 2005.03.24
28 - WoW Build 1300
29 - Initial release
30  
31 ]]
32  
33 -- globals
34 QUESTLEVELS_VERSION = "0.3";
35  
36 -- labels
37 QUESTLEVELS_DUNGEON = "Dungeon";
38 QUESTLEVELS_RAID = "Raid";
39  
40 -- disable quest fading
41 QUEST_FADING_ENABLE = nil;
42  
43 function QuestLevels_OnLoad()
44 -- define pretty-print functions
45 if( not Print_Chat ) then
46 Print_Chat = function( x ) if( DEFAULT_CHAT_FRAME ) then DEFAULT_CHAT_FRAME:AddMessage( x, 1.0, 1.0, 0.0 ); end end
47 end
48  
49 if( not Print_UI ) then
50 Print_UI = function( x ) UIErrorsFrame:AddMessage( x, 1.0, 1.0, 0.0, 1.0, UIERRORS_HOLD_TIME ); end
51 end
52  
53 this:RegisterEvent( "QUEST_LOG_UPDATE" );
54  
55 QuestLevels_QuestLog_Update = QuestLog_Update;
56 QuestLevels_QuestWatch_Update = QuestWatch_Update;
57  
58 function QuestLog_Update()
59 QuestLevels_QuestLog_Update();
60  
61 local numHeaders = 0;
62 local numEntries = GetNumQuestLogEntries();
63  
64 for i = 1, QUESTS_DISPLAYED, 1 do
65 local questIndex = i + FauxScrollFrame_GetOffset( QuestLogListScrollFrame );
66 local questLogTitle = getglobal( "QuestLogTitle" .. i );
67 local questTitleTag = getglobal( "QuestLogTitle".. i .."Tag" );
68 local questCheck = getglobal( "QuestLogTitle" .. i .. "Check" );
69 local questNormalText = getglobal( "QuestLogTitle" .. i .. "NormalText" );
70 local questHighlightText = getglobal( "QuestLogTitle" .. i .. "HighlightText" );
71 local questDisabledText = getglobal( "QuestLogTitle" .. i .. "DisabledText" );
72  
73 if( questIndex <= numEntries ) then
74 local questLogTitleText, level, questTag, isHeader, isCollapsed, isComplete = GetQuestLogTitle( questIndex );
75  
76 if( level and not isHeader ) then
77 questLogTitle:SetText( " [" .. level .. "] " .. questLogTitleText );
78 QuestLogDummyText:SetText( questLogTitle:GetText() );
79  
80 -- set the quest tag
81 if( isComplete ) then
82 questTag = COMPLETE;
83 end
84  
85 if( not questTag ) then
86 questTitleTag:SetText( "" );
87  
88 -- reset to max text width
89 questNormalText:SetWidth( 275 );
90 questHighlightText:SetWidth( 275 );
91 questDisabledText:SetWidth( 275 );
92  
93 -- show check mark if quest is being watched
94 questCheck:Hide();
95  
96 if( IsQuestWatched( questIndex ) ) then
97 questCheck:SetPoint( "LEFT", questLogTitle:GetName(), "LEFT", QuestLogDummyText:GetWidth() + 24, 0 );
98 questCheck:Show();
99 end
100 end
101 end
102 end
103 end
104 end
105  
106 function QuestWatch_Update()
107 QuestLevels_QuestWatch_Update();
108  
109 local numObjectives;
110 local questWatchMaxWidth = 0;
111 local tempWidth;
112 local watchText;
113 local watchTextIndex = 1;
114 local questIndex;
115 local objectivesCompleted;
116 local text, type, finished;
117  
118 for i = 1, GetNumQuestWatches() do
119 local tempIndex = 0;
120  
121 questIndex = GetQuestIndexForWatch(i);
122  
123 if( questIndex ) then
124 numObjectives = GetNumQuestLeaderBoards(questIndex);
125  
126 -- if there are objectives, set the title
127 if ( numObjectives > 0 ) then
128 -- set title
129 local questLogTitleText, level, questTag, isHeader, isCollapsed = GetQuestLogTitle( questIndex );
130  
131 if( level and not isHeader ) then
132 local diff = GetDifficultyColor( level );
133 local useTag, levelTag
134  
135 -- show flags in quest level based on tag
136 if( questTag == ELITE ) then
137 useTag = "+";
138 elseif ( questTag == QUESTLEVELS_DUNGEON ) then
139 useTag = "d";
140 elseif ( questTag == QUESTLEVELS_RAID ) then
141 useTag = "r";
142 else
143 useTag = "";
144 end
145  
146 -- color quest level based on difficulty
147 levelTag = format( "|c%02X%02X%02X%02X%s|r", 255, diff.r * 255, diff.g * 255, diff.b * 255,
148 "[" .. level .. useTag .. "] " );
149  
150 watchText = getglobal( "QuestWatchLine" .. watchTextIndex );
151 watchText:SetText( levelTag .. GetQuestLogTitle( questIndex ) );
152  
153 tempWidth = watchText:GetWidth();
154  
155 if( tempWidth > questWatchMaxWidth ) then
156 questWatchMaxWidth = tempWidth;
157 end
158  
159 objectivesCompleted = 0;
160  
161 for j = 1, numObjectives do
162 text, type, finished = GetQuestLogLeaderBoard( j, questIndex );
163 tempIndex = watchTextIndex + j;
164  
165 watchText = getglobal( "QuestWatchLine" .. tempIndex );
166  
167 if( finished ) then
168 objectivesCompleted = objectivesCompleted + 1;
169 end
170  
171 if( objectivesCompleted == numObjectives ) then
172 -- spam quest completion message
173 Print_UI( "[" .. level .. "] " .. GetQuestLogTitle( questIndex ) .. " (Complete)" );
174  
175 -- remove completed quest from tracker
176 RemoveQuestWatch( questIndex );
177 QuestWatch_Update();
178 else
179 tempWidth = watchText:GetWidth();
180  
181 -- adjust tracker width there are incomplete objectives
182 if( tempWidth > questWatchMaxWidth ) then
183 questWatchMaxWidth = tempWidth;
184 end
185 end
186 end
187 end
188 end
189  
190 watchTextIndex = watchTextIndex + 1 + numObjectives;
191 end
192 end
193  
194 -- update width of tracker frame
195 QuestWatchFrame:SetWidth( questWatchMaxWidth + 10 );
196 end
197  
198 -- print mod version/load info to chat frame
199 -- Print_Chat( "QuestLevels " .. QUESTLEVELS_VERSION .. " AddOn loaded" );
200 end