qh unhide fixed
[QuestHelper.git] / help.lua
blob16bd6a73967660121e13949c65bef144d961c9b6
1 QuestHelper_File["help.lua"] = "Development Version"
2 QuestHelper_Loadtime["help.lua"] = GetTime()
4 local QuestHelper_Version = QuestHelper_File["help.lua"]
6 function QuestHelper:scaleString(val)
7 return self:HighlightText(math.floor(val*100+0.5).."%")
8 end
10 function QuestHelper:genericSetScale(varname, name, mn, mx, input, onchange, ...)
11 if input == "" then
12 self:TextOut(string.format("Current %s scale is %s.", name, self:scaleString(QuestHelper_Pref[varname])))
13 else
14 local scale = tonumber(input)
16 if not scale then
17 local x = string.match(input or "", "^%s*([%d%.]+)%s*%%%s*$")
18 scale = tonumber(x) or 0
19 if not scale then
20 self:TextOut("I don't know how to interpret your input.")
21 return
22 end
23 scale = scale * 0.01
24 end
26 if scale < mn then
27 self:TextOut(string.format("I won't accept a scale less than %s.", self:scaleString(mn)))
28 elseif scale > mx then
29 self:TextOut(string.format("I won't accept a scale more than %s.", self:scaleString(mx)))
30 else
31 QuestHelper_Pref[varname] = scale
32 self:TextOut(string.format("Set %s scale set to %s.", name, self:scaleString(scale)))
33 if onchange then
34 onchange(...)
35 end
36 end
37 end
38 end
40 function QuestHelper:TrackerScale(scale)
41 QuestHelper:genericSetScale("track_scale", "tracker scale", .5, 2, scale,
42 function() QuestHelper.tracker:SetScale(QuestHelper_Pref.track_scale) end)
43 end
45 function QuestHelper:SetLocale(loc)
46 if not loc or loc == "" then
47 self:TextOut(QHText("LOCALE_LIST_BEGIN"))
48 for loc, tbl in pairs(QuestHelper_Translations) do
49 self:TextOut(string.format(" %s%s %s", self:HighlightText(loc),
50 loc == QuestHelper_Pref.locale and " *" or " ",
51 tbl.LOCALE_NAME or "???"))
52 end
53 else
54 for l, tbl in pairs(QuestHelper_Translations) do
55 if string.find(string.lower(l), "^"..string.lower(loc)) or
56 string.find(string.lower(tbl.LOCALE_NAME or ""), "^"..string.lower(loc)) then
57 QuestHelper_Pref.locale = l
58 QHFormatSetLocale(l)
59 self:SetLocaleFonts()
60 self:TextOut(QHFormat("LOCALE_CHANGED", l))
61 return
62 end
63 end
65 self:TextOut(QHFormat("LOCALE_UNKNOWN", tostring(loc) or "UNKNOWN"))
66 end
67 end
69 function QuestHelper:ToggleHide()
70 QuestHelper_Pref.hide = not QuestHelper_Pref.hide
72 -- Desaturate the button texture if QuestHelper is disabled.
73 if self.MapButton then
74 -- This should always be true, but just in case...
75 self.MapButton:GetNormalTexture():SetDesaturated(QuestHelper_Pref.hide)
76 end
78 if QuestHelper_Pref.hide then
79 if QuestHelper_Pref.track then
80 self:HideTracker()
81 end
83 self.map_overlay:Hide()
84 self:TextOut("QuestHelper is now |cffff0000hidden|r.")
85 else
86 if QuestHelper_Pref.track then
87 self:ShowTracker()
88 end
90 self.map_overlay:Show()
91 self.minimap_marker:Show()
92 self:TextOut("QuestHelper is now |cff00ff00shown|r.")
94 QH_Timeslice_Bonus(20) -- Let the corutine do some overtime...
95 end
96 end
98 function QuestHelper:ToggleShare()
99 QuestHelper_Pref.share = not QuestHelper_Pref.share
100 if QuestHelper_Pref.share then
101 if QuestHelper_Pref.solo then
102 self:TextOut("Objective sharing will been |cff00ff00enabled|r when you disable solo mode.")
103 else
104 self:TextOut("Objective sharing has been |cff00ff00enabled|r.")
105 self:EnableSharing()
107 else
108 self:TextOut("Objective sharing has been |cffff0000disabled|r.")
109 if QuestHelper_Pref.solo then
110 self:TextOut("Objective sharing won't be reenabled when you disable solo mode.")
111 else
112 self:DisableSharing()
117 function QuestHelper:ToggleFlightTimes()
118 QuestHelper_Pref.flight_time = not QuestHelper_Pref.flight_time
119 if QuestHelper_Pref.flight_time then
120 self:TextOut("The flight timer has been |cff00ff00enabled|r.")
121 else
122 self:TextOut("The flight timer has been |cffff0000disabled|r.")
126 function QuestHelper:ToggleTrack()
127 QuestHelper_Pref.track = not QuestHelper_Pref.track
128 if QuestHelper_Pref.track then
129 self:ShowTracker()
130 self:TextOut("The quest tracker has been |cff00ff00enabled|r.")
131 else
132 self:HideTracker()
133 self:TextOut("The quest tracker has been |cffff0000disabled|r.")
137 function QuestHelper:ToggleTooltip()
138 QuestHelper_Pref.tooltip = not QuestHelper_Pref.tooltip
139 if QuestHelper_Pref.tooltip then
140 self:TextOut("Objective tooltip information has been |cff00ff00enabled|r.")
141 else
142 self:TextOut("Objective tooltip information has been |cffff0000disabled|r.")
146 function QuestHelper:Purgewarning()
147 QuestHelper:TextOut("I would consider this a tragic loss, and would appreciate it if you sent me your saved data before going through with it.")
148 QuestHelper:TextOut("Enter "..self:HighlightText("/qh nag verbose").." to check and see if you're destroying anything important.")
149 QuestHelper:TextOut("Enter "..self:HighlightText("/qh submit").." for instructions on how to submit your collected data.")
150 QuestHelper:TextOut("See the "..self:HighlightText("How You Can Help").." section on the project website for instructions.")
153 function QuestHelper:Purge(code, force, noreload)
154 if code == self.purge_code or force then
155 QuestHelper_Quests = nil
156 QuestHelper_Objectives = nil
157 QuestHelper_FlightInstructors = nil
158 QuestHelper_FlightRoutes = nil
159 QuestHelper_Locale = nil
160 QuestHelper_UID = nil
161 QuestHelper_Version = nil
162 QuestHelper_SaveVersion = nil
164 QuestHelper_SaveDate = nil
165 QuestHelper_SeenRealms = nil
167 QuestHelper_Collector = nil
168 QuestHelper_Collector_Version = nil
170 if not noreload then ReloadUI() end
171 else
172 if not self.purge_code then self.purge_code = self:CreateUID(8) end
173 QuestHelper:TextOut("THIS COMMAND WILL DELETE ALL YOUR COLLECTED DATA")
174 QuestHelper:Purgewarning()
175 QuestHelper:TextOut("If you're sure you want to go through with this, enter: "..self:HighlightText("/qh purge "..self.purge_code))
179 function QuestHelper:HardReset(code)
180 if code == self.purge_code then
181 self:ResetTrackerPosition() -- do this before we kill off the prefs, since it touches a pref
182 QuestHelper_Pref = nil
183 QuestHelper_ErrorList = nil -- BIZAM
184 QuestHelper_KnownFlightRoutes = nil
185 QuestHelper_Home = nil
186 QuestHelper_CharVersion = nil
187 self:Purge(nil, true)
188 else
189 if not self.purge_code then self.purge_code = self:CreateUID(8) end
190 QuestHelper:TextOut("THIS COMMAND WILL DELETE ALL YOUR COLLECTED DATA AND RESET ALL YOUR PREFERENCES")
191 QuestHelper:Purgewarning()
192 QuestHelper:TextOut("If you're sure you want to go through with this, enter: "..self:HighlightText("/qh hardreset "..self.purge_code))
196 function QuestHelper:ToggleSolo()
197 QuestHelper_Pref.solo = not QuestHelper_Pref.solo
198 if QuestHelper_Pref.solo then
199 if QuestHelper_Pref.share then
200 self:DisableSharing()
201 self:TextOut("Objective sharing has been temporarly |cffff0000disabled|r.")
203 self:TextOut("Solo mode has been |cff00ff00enabled|r.")
204 else
205 self:TextOut("Solo mode has been |cffff0000disabled|r.")
206 if QuestHelper_Pref.share then
207 self:EnableSharing()
208 self:TextOut("Objective sharing has been re|cff00ff00enabled|r.")
213 function QuestHelper:ToggleComm()
214 if QuestHelper_Pref.comm then
215 QuestHelper_Pref.comm = false
216 self:TextOut("Communication display has been |cffff0000disabled|r.")
217 else
218 QuestHelper_Pref.comm = true
219 self:TextOut("Communication display has been |cff00ff00enabled|r.")
223 function QuestHelper:ToggleAnts()
224 if QuestHelper_Pref.show_ants then
225 QuestHelper_Pref.show_ants = false
226 self:TextOut("Ant trails have been |cffff0000disabled|r.")
227 else
228 QuestHelper_Pref.show_ants = true
229 self:TextOut("Ant trails have been |cff00ff00enabled|r.")
233 function QuestHelper:TogglePrecache()
234 QuestHelper_Pref.precache = not QuestHelper_Pref.precache
235 if QuestHelper_Pref.precache then
236 self:TextOut(QHText("SETTINGS_PRECACHE_ON"))
237 else
238 self:TextOut(QHText("SETTINGS_PRECACHE_OFF"))
242 function QuestHelper:LevelOffset(offset)
243 local level = tonumber(offset)
244 if level then
245 if level > 0 then
246 self:TextOut("Allowing quests up to "..self:HighlightText(level).." level"..(level==1 and " " or "s ")..self:HighlightText("above").." you.")
247 elseif level < 0 then
248 self:TextOut("Only allowing quests "..self:HighlightText(-level).." level"..(level==-1 and " " or "s ")..self:HighlightText("below").." you.")
249 else
250 self:TextOut("Only allowing quests "..self:HighlightText("at or below").." your current level.")
253 if not QuestHelper_Pref.filter_level then
254 self:TextOut("Note: This won't have any effect until you turn the level filter on.")
257 if QuestHelper_Pref.level ~= level then
258 QuestHelper_Pref.level = level
259 QH_Route_Filter_Rescan("filter_quest_level")
261 elseif offset == "" then
262 if QuestHelper_Pref.level <= 0 then
263 self:TextOut("Level offset is currently set to "..self:HighlightText(QuestHelper_Pref.level)..".")
264 else
265 self:TextOut("Level offset is currently set to "..self:HighlightText("+"..QuestHelper_Pref.level)..".")
268 if self.party_levels then for n, l in ipairs(self.party_levels) do
269 self:TextOut("Your effective level in a "..self:HighlightText(n).." player quest is "..self:HighlightText(string.format("%.1f", l))..".")
270 end end
272 if QuestHelper_Pref.solo then
273 self:TextOut("Peers aren't considered in your effective level, because you're playing solo.")
275 else
276 self:TextOut("Expected a level offset.")
280 function QuestHelper:Filter(input)
281 input = string.upper(input)
282 if input == "ZONE" then
283 QuestHelper_Pref.filter_zone = not QuestHelper_Pref.filter_zone
284 self:TextOut("Filter "..self:HighlightText("zone").." set to "..self:HighlightText(QuestHelper_Pref.filter_zone and "active" or "inactive")..".")
285 QH_Route_Filter_Rescan("filter_zone")
286 elseif input == "DONE" then
287 QuestHelper_Pref.filter_done = not QuestHelper_Pref.filter_done
288 self:TextOut("Filter "..self:HighlightText("done").." set to "..self:HighlightText(QuestHelper_Pref.filter_done and "active" or "inactive")..".")
289 QH_Route_Filter_Rescan("filter_quest_done")
290 elseif input == "LEVEL" then
291 QuestHelper_Pref.filter_level = not QuestHelper_Pref.filter_level
292 self:TextOut("Filter "..self:HighlightText("level").." set to "..self:HighlightText(QuestHelper_Pref.filter_level and "active" or "inactive")..".")
293 QH_Route_Filter_Rescan("filter_quest_level")
294 elseif input == "BLOCKED" or input == "BLOCK" then
295 QuestHelper_Pref.filter_blocked = not QuestHelper_Pref.filter_blocked
296 self:TextOut("Filter "..self:HighlightText("blocked").." set to "..self:HighlightText(QuestHelper_Pref.filter_blocked and "active" or "inactive")..".")
297 QH_Route_Filter_Rescan("filter_blocked")
298 elseif input == "WATCHED" or input == "WATCH" then
299 QuestHelper_Pref.filter_watched = not QuestHelper_Pref.filter_watched
300 self:TextOut("Filter "..self:HighlightText("watched").." set to "..self:HighlightText(QuestHelper_Pref.filter_watched and "active" or "inactive")..".")
301 QH_Route_Filter_Rescan("filter_quest_watched")
302 elseif input == "" then
303 self:TextOut("Filter "..self:HighlightText("zone")..": "..self:HighlightText(QuestHelper_Pref.filter_zone and "active" or "inactive"))
304 self:TextOut("Filter "..self:HighlightText("level")..": "..self:HighlightText(QuestHelper_Pref.filter_level and "active" or "inactive"))
305 self:TextOut("Filter "..self:HighlightText("done")..": "..self:HighlightText(QuestHelper_Pref.filter_done and "active" or "inactive"))
306 self:TextOut("Filter "..self:HighlightText("blocked")..": "..self:HighlightText(QuestHelper_Pref.filter_blocked and "active" or "inactive"))
307 self:TextOut("Filter "..self:HighlightText("watched")..": "..self:HighlightText(QuestHelper_Pref.filter_watched and "active" or "inactive"))
308 else
309 self:TextOut("Don't know what you want filtered, expect "..self:HighlightText("zone")..", "..self:HighlightText("done")..", "..self:HighlightText("level")..", "..self:HighlightText("blocked")..", or "..self:HighlightText("watched")..".")
313 function QuestHelper:ToggleArrow(text)
314 if text == "reset" then QH_Arrow_Reset() return end
316 QuestHelper_Pref.arrow = not QuestHelper_Pref.arrow
317 if QuestHelper_Pref.arrow then
318 QH_Arrow_Show()
319 self:TextOut(QHFormat("SETTINGS_ARROWLINK_ON", QHText("SETTINGS_ARROWLINK_ARROW")))
320 else
321 self:TextOut(QHFormat("SETTINGS_ARROWLINK_OFF", QHText("SETTINGS_ARROWLINK_ARROW")))
325 function QuestHelper:ToggleCartWP()
326 QuestHelper_Pref.cart_wp_new = not QuestHelper_Pref.cart_wp_new
327 if QuestHelper_Pref.cart_wp_new then
328 self:EnableCartographer()
329 if Cartographer_Waypoints then
330 if Waypoint and Waypoint.prototype then
331 self:TextOut("Would use "..self:HighlightText("Cartographer Waypoints").." to show objectives, but another mod is interfering with it.")
332 else
333 self:TextOut(QHFormat("SETTINGS_ARROWLINK_ON", QHText("SETTINGS_ARROWLINK_CART")))
335 else
336 self:TextOut("Would use "..self:HighlightText("Cartographer Waypoints").." to show objectives, except it doesn't seem to be present.")
338 else
339 self:DisableCartographer()
340 self:TextOut(QHFormat("SETTINGS_ARROWLINK_OFF", QHText("SETTINGS_ARROWLINK_CART")))
344 function QuestHelper:ToggleTomTomWP()
345 QuestHelper_Pref.tomtom_wp_new = not QuestHelper_Pref.tomtom_wp_new
346 if QuestHelper_Pref.tomtom_wp_new then
347 self:EnableTomTom()
348 if TomTom then
349 self:TextOut(QHFormat("SETTINGS_ARROWLINK_ON", QHText("SETTINGS_ARROWLINK_TOMTOM")))
350 else
351 self:TextOut("Would use "..self:HighlightText("TomTom").." to show objectives, except it doesn't seem to be present.")
353 else
354 self:DisableTomTom()
355 self:TextOut(QHFormat("SETTINGS_ARROWLINK_OFF", QHText("SETTINGS_ARROWLINK_TOMTOM")))
359 function QuestHelper:WantPathingReset()
360 self:TextOut("Will reset world graph.")
361 self.defered_graph_reset = true
364 function QuestHelper:PrintVersion()
365 self:TextOut("Version: "..self:HighlightText(GetAddOnMetadata("QuestHelper", "Version") or "Unknown"))
368 local function RecycleStatusString(fmt, usedcount, freetable, usedtable)
369 local freetablecount = QuestHelper:TableSize(freetable)
370 if usedtable then
371 local usedtablecount = QuestHelper:TableSize(usedtable)
372 return string.format(fmt, QuestHelper:ProgressString(string.format("%d/%d", usedtablecount, usedtablecount+freetablecount), ((usedtablecount+freetablecount == 0) and 1) or (1-usedtablecount/(usedtablecount+freetablecount)))) .. string.format(" (%d \"leaked\")", usedcount - usedtablecount)
373 else
374 return string.format(fmt, QuestHelper:ProgressString(string.format("%d/%d", usedcount, usedcount+freetablecount), ((usedcount+freetablecount == 0) and 1) or (1-usedcount/(usedcount+freetablecount))))
378 function QuestHelper:Top(cmd)
379 if cmd and string.find(cmd, "all") then
380 cmd = cmd .. " collected recycle clear boot usage"
383 if cmd and string.find(cmd, "boot") then
384 local bootv = {}
385 for k, v in pairs(QuestHelper_Loadtime) do
386 table.insert(bootv, {time = v, file = k})
388 table.sort(bootv, function (a, b) return a.time < b.time end)
390 if string.find(cmd, "sort") then
391 local boott = {}
392 for i = 1, #bootv - 1 do
393 table.insert(boott, {time = bootv[i + 1].time - bootv[i].time, file = bootv[i].file})
395 table.sort(boott, function(a, b) return a.time < b.time end)
397 for _, v in pairs(boott) do
398 QuestHelper:TextOut(string.format("%s: %f", v.file, v.time))
400 QuestHelper:TextOut(string.format("%s: shrug", bootv[#bootv].file))
401 else
402 for i = 1, #bootv do
403 QuestHelper:TextOut(string.format("%f: %s", bootv[i].time - bootv[1].time, bootv[i].file))
408 local pre_ttf
409 local pre_db
410 if cmd and string.find(cmd, "collected") then
411 pre_ttf = self:DumpTableTypeFrequencies(true)
412 pre_db = DB_DumpItems()
415 if cmd and string.find(cmd, "recycle") then
416 self:DumpTableTypeFrequencies()
417 self:TextOut(RecycleStatusString("Using %s lua tables.", self.used_tables, self.free_tables, self.recycle_tabletyping))
418 self:TextOut(RecycleStatusString("Using %s texture objects.", self.used_textures, self.free_textures))
419 self:TextOut(RecycleStatusString("Using %s font objects.", self.used_text, self.free_text))
420 self:TextOut(RecycleStatusString("Using %s frame objects.", self.used_frames, self.free_frames))
423 if cmd and string.find(cmd, "usage") then
424 self:DumpTableTypeFrequencies()
427 if cmd and string.find(cmd, "cache") then
428 self:DumpCacheData()
431 if cmd and string.find(cmd, "perf") then
432 QH_Timeslice_DumpPerf()
435 local uncd = 0
436 for k, v in pairs(QuestHelper_Collector) do
437 if not v.compressed then uncd = uncd + 1 end
439 uncd = uncd - 1
440 local uncs = ""
441 if uncd > 0 then
442 uncs = string.format(" (%d uncompressed IDs)", uncd)
445 UpdateAddOnMemoryUsage()
446 local pre_gc = GetAddOnMemoryUsage("QuestHelper")
448 collectgarbage("collect")
450 UpdateAddOnMemoryUsage()
451 local post_gc = GetAddOnMemoryUsage("QuestHelper")
453 if cmd and string.find(cmd, "collected") then
454 local post_ttf = self:DumpTableTypeFrequencies(true)
456 local union = {}
457 for k, v in pairs(pre_ttf) do union[k] = (pre_ttf[k] or 0) - (post_ttf[k] or 0) end
458 for k, v in pairs(post_ttf) do union[k] = (pre_ttf[k] or 0) - (post_ttf[k] or 0) end
460 local sorted = {}
461 for k, v in pairs(union) do
462 table.insert(sorted, {k = k, d = v})
465 table.sort(sorted, function(a, b) return a.d < b.d end)
466 for _, v in pairs(sorted) do
467 if v.d > 0 then
468 QuestHelper:TextOut(string.format("%d: %s", v.d, v.k))
472 local post_db = DB_DumpItems()
474 local st = {}
475 for k, v in pairs(pre_db) do
476 if not post_db[k] then
477 table.insert(st, k)
480 table.sort(st)
482 for _, v in ipairs(st) do
483 QuestHelper:TextOut("DB: " .. v)
487 self:TextOut(string.format("QuestHelper is using %dkb (pre-collect %dkb) of RAM (%s/%s/%s/%s)%s", post_gc, pre_gc, QuestHelper_local_version, QuestHelper_toc_version, GetBuildInfo(), GetLocale(), uncs))
489 if cmd and string.find(cmd, "clear") then
490 local cleared = QH_ClearPathcache()
492 collectgarbage("collect")
493 UpdateAddOnMemoryUsage()
494 local new_post_gc = GetAddOnMemoryUsage("QuestHelper")
495 self:TextOut(string.format("QuestHelper is using %dkb/%dkb/%dkb (%d pathcache cleared) of RAM (%s/%s/%s/%s)%s", pre_gc, post_gc, new_post_gc, cleared, QuestHelper_local_version, QuestHelper_toc_version, GetBuildInfo(), GetLocale(), uncs))
497 local cleared = QuestHelper:RecycleClear()
499 collectgarbage("collect")
500 UpdateAddOnMemoryUsage()
501 local new_post_gc_2 = GetAddOnMemoryUsage("QuestHelper")
502 self:TextOut(string.format("QuestHelper is using %dkb/%dkb/%dkb/%dkb (%d recycle cleared) of RAM (%s/%s/%s/%s)%s", pre_gc, post_gc, new_post_gc, new_post_gc_2, cleared, QuestHelper_local_version, QuestHelper_toc_version, GetBuildInfo(), GetLocale(), uncs))
506 function QuestHelper:ToggleMapButton()
507 QuestHelper_Pref.map_button = not QuestHelper_Pref.map_button
509 if QuestHelper_Pref.map_button then
510 QuestHelper:InitMapButton()
511 self:TextOut("Map button has been |cff00ff00enabled|r.")
512 else
513 QuestHelper:HideMapButton()
514 self:TextOut("Map button has been |cffff0000disabled|r. Use '/qh button' to restore it.")
518 function QuestHelper:ChangeLog()
519 self:ShowText(QuestHelper_ChangeLog, string.format("QuestHelper %s ChangeLog", QuestHelper_Version))
522 function QuestHelper:Submit()
523 self:ShowText([[
524 |TInterface\AddOns\QuestHelper\Art\Upload.tga:100:300|t
525 Your data can't be submitted automatically, since AddOns can't interact with anything outside of World of Warcraft.
527 To do this would require me to create some third party software, and I don't want to include such software with QuestHelper, because that's the kind of thing that ill intended people are likely to tamper with.
529 World of Warcraft stores QuestHelper's data in a file named |cff40bbffQuestHelper.lua|r.
531 To find this file, first find the the directory you installed World of Warcraft to. In Windows, this defaults to |cff40bbffC:\Program Files\World of Warcraft|r, and on Mac, I believe this is |cff40bbff/Applications/World of Warcraft|r.
533 If you're using Windows Vista, Windows might protect the Program Files directory from changes, and redirect Warcraft's saved data to |cff40bbffC:\Users\|cffff8000USER|cff40bbff\AppData\Local\VirtualStore\Program Files\World of Warcraft|r, or possibly |cff40bbffC:\Users\Public\Games\World of Warcraft|r.
535 In that directory, the needed file is in |cff40bbffWTF/Account/|cffff8000ACCOUNT|cff40bbff/SavedVariables|r, replacing ACCOUNT with the name of your account, and in that directory, you should find |cff40bbffQuestHelper.lua|r.
537 There are other directories with the names of the realms where your characters are stored, |cffffff00but don't enter them|r. They contain information specific to your characters, such as the flight points they know about, and don't contain the quest information I want.
539 After you find |cff40bbffQuestHelper.lua|r, you can email it to me here: |cff40bbffqhaddon@gmail.com|r
540 ]], "How To Submit Your Data")
543 function QuestHelper:ShowError(params)
544 if params and params == "full" then
545 QuestHelper_ErrorCatcher_GenerateReport()
547 QuestHelper_ErrorCatcher_ReportError()
550 local commands
552 function QuestHelper:Help(argument)
553 local text = ""
554 local argument = argument and argument:upper() or ""
556 for i1, cat in ipairs(commands) do
557 text = string.format("%s|cffffff00%s|r\n\n", text, cat[1])
558 for i, data in ipairs(cat[2]) do
559 if data[1]:find(argument, 1, true) then
560 text = string.format("%s |cffff8000%s|r %s\n", text, data[1], data[2])
562 if #data[3] > 0 then
563 text = string.format("%s\n %s\n", text, #data[3] == 1 and "Example:" or "Examples:")
564 for i, pair in ipairs(data[3]) do
565 text = string.format("%s |cff40bbff%s|r\n %s\n", text, pair[1], pair[2])
569 text = text .. "\n"
572 text = text .. "\n\n"
575 self:ShowText(text == "" and ("No commands containing '"..argument.."'") or text, "QuestHelper Slash Commands")
578 function QuestHelper:Donate(argument)
579 local text = ""
580 local argument = argument and argument:upper() or ""
582 for i1, cat in ipairs(commands) do
583 text = string.format("%s|cffffff00%s|r\n\n", text, cat[1])
584 for i, data in ipairs(cat[2]) do
585 if data[1]:find(argument, 1, true) then
586 text = string.format("%s |cffff8000%s|r %s\n", text, data[1], data[2])
588 if #data[3] > 0 then
589 text = string.format("%s\n %s\n", text, #data[3] == 1 and "Example:" or "Examples:")
590 for i, pair in ipairs(data[3]) do
591 text = string.format("%s |cff40bbff%s|r\n %s\n", text, pair[1], pair[2])
595 text = text .. "\n"
598 text = text .. "\n\n"
601 self:ShowText([[
602 QuestHelper currently survives on |cffff8000your donations|r. I'm trying to make this into a full-time job so I can add more features and fix bugs, and I can't do that without paying the bills.
604 There's a lot of stuff I plan to add if I can get enough donations to live off. Some of the most-requested features include:
606 |cff40bbffReduced memory and CPU usage for smoother gameplay|r
608 |cff40bbffFlying mount support for both Northrend and Outland|r
610 |cff40bbffBetter support for Northrend "phased" quests|r
612 |cff40bbffAchievementHelper, built right into QuestHelper|r
614 |cff40bbffPaths that lead you around obstacles instead of through them|r
616 I can't guarantee these will show up soon, as there's a lot of work involved in them, but every donation - no matter how small - helps!
618 To donate, open up your web browser and go to |cffff8000http://www.quest-helper.com/donate|r. Enter however much you feel comfortable donating, then bask in the knowledge that you're supporting QuestHelper.
620 Thanks!]], "Please Donate!", 500, 20, 10)
623 commands =
625 { "Common commands", {
626 {"HIDDEN",
627 "Compiles a list of objectives that QuestHelper is hiding from you. Depending on the reason, you can also unhide the objective.",
628 {}, QH_Hidden_Menu},
630 {"HIDE",
631 "Hides QuestHelper's modifications to the minimap and world map, and pauses routing calculations.",
632 {}, QuestHelper.ToggleHide, QuestHelper},
634 {"ARROW",
635 "Toggles Questhelper's built-in directional arrow.",
636 {{"/qh arrow reset", "Reset location to the center of the screen."}},
637 QuestHelper.ToggleArrow, QuestHelper},
639 {"CARTWP",
640 "Toggles displaying the current objective using Cartographer Waypoints (must be installed separately).",
641 {}, QuestHelper.ToggleCartWP, QuestHelper},
643 {"TOMTOM",
644 "Toggles displaying the current objective using TomTom (must be installed separately).",
645 {}, QuestHelper.ToggleTomTomWP, QuestHelper},
647 {"FIND",
648 "Search for an item, location, or npc.",
649 {{"/qh find item rune of teleport", "Finds a reagent vendor."},
650 {"/qh find npc bragok", "Finds the Ratchet flight point."},
651 {"/qh find loc stormwind 50 60", "Finds the Stormwind auction house."},
652 {"/qh find loc 50 50", "Finds the center of the zone you're in."},
653 {"/qh find something", "Searches for something in all categories."},
654 {"/qh find", "Lists objectives you manually created so that you can remove them."}}, QuestHelper.PerformSearch, QuestHelper},
656 {"SOLO",
657 "Toggles solo mode. When enabled, assumes your party members don't exist. Objective sharing with party members will also be disabled.",
658 {}, QuestHelper.ToggleSolo, QuestHelper},
661 { "Objective filtering", {
662 {"FILTER",
663 "Automatically ignores/unignores objectives based on criteria.",
664 {{"/qh filter zone", "Toggle showing objectives outside the current zone"},
665 {"/qh filter done", "Toggle showing objectives for uncompleted quests."},
666 {"/qh filter level", "Toggle showing objectives that are probably too hard, by considering the levels of you and your party members, and the offset set by the level command."},
667 {"/qh filter blocked", "Toggle showing blocked objectives, such as quest turn-ins for incomplete quests."},
668 {"/qh filter watched", "Toggle limiting to objectives watched in the Quest Log"}
669 }, QuestHelper.Filter, QuestHelper},
671 {"LEVEL",
672 "Adjusts the level offset used by the level filter. Naturally, the level filter must be turned on to have an effect.",
673 {{"/qh level", "See information related to the level filter."},
674 {"/qh level 0", "Only allow objectives at or below your current level."},
675 {"/qh level +2", "Allow objectives up to two levels above your current level."},
676 {"/qh level -1", "Only allow objectives below your current level."}}, QuestHelper.LevelOffset, QuestHelper},
678 {"SCALE",
679 "Scales the map icons used by QuestHelper. Will accept values between 50% and 300%.",
680 {{"/qh scale 1", "Uses the default icon size."},
681 {"/qh scale 2", "Makes icons twice their default size."},
682 {"/qh scale 80%", "Makes icons slightly smaller than their default size."}},
683 QuestHelper.genericSetScale, QuestHelper, "scale", "icon scale", .5, 3},
685 {"SHARE",
686 "Toggles objective sharing between QuestHelper users.",
687 {}, QuestHelper.ToggleShare, QuestHelper},
690 { "Interface", {
691 {"TRACK",
692 "Toggles the visibility of the QuestHelper's replacement quest tracker.",
693 {}, QuestHelper.ToggleTrack, QuestHelper},
695 {"TSCALE",
696 "Scales the quest tracker provided by QuestHelper. Will accept values between 50% and 300%.",
698 QuestHelper.TrackerScale, QuestHelper},
700 {"TRESET",
701 "Reset's the position of the quest tracker provided by QuestHelper, in cause you move it somewhere inaccessable.",
702 {{"/qh treset center", "Resets to the center of the screen, instead of a more normal quest tracker location."}}, QuestHelper.ResetTrackerPosition, QuestHelper},
704 {"TOOLTIP",
705 "Toggles appending information about tracked items and NPCs to their tooltips.",
706 {}, QuestHelper.ToggleTooltip, QuestHelper},
708 {"FTIME",
709 "Toggles display of flight time estimates.", {}, QuestHelper.ToggleFlightTimes, QuestHelper},
711 {"ANTS",
712 "Toggles the display of trails on the world map on and off.",
713 {}, QuestHelper.ToggleAnts, QuestHelper},
715 {"LOCALE",
716 "Select the locale to use for displayed messages.",
717 {}, QuestHelper.SetLocale, QuestHelper},
719 {"BUTTON",
720 "Toggles the display of QuestHelper's button on the world map.",
721 {}, QuestHelper.ToggleMapButton, QuestHelper},
723 {"SETTINGS",
724 "Opens the Settings menu at the current cursor location. Note that not all settings can be changed through the menu.",
725 {}, QuestHelper.DoSettingsMenu, QuestHelper},
728 { "Data collection", {
729 {"SUBMIT",
730 "Displays instructions for submitting your collected data.",
731 {}, QuestHelper.Submit, QuestHelper},
733 {"NAG",
734 "Tells you if you have anything that's missing from the static database. It can only check quests from your own faction, as the quests of your opposing faction are ommitted to save memory.",
735 {{"/qh nag verbose", "Prints the specific changes that were found."}}, QuestHelper.Nag, QuestHelper},
737 {"PURGE",
738 "Deletes all QuestHelper's collected data.", {}, QuestHelper.Purge, QuestHelper},
740 {"HARDRESET",
741 "Deletes all QuestHelper's collected data and resets QuestHelper preferences.", {}, QuestHelper.HardReset, QuestHelper},
744 { "Performance and debug", {
745 {"PERF",
746 "Sets or shows the route workload. Higher means more agressive route updating, lower means better performance Accepts numbers between 10% and 500%.",
747 {{"/qh perf", "Show current Performance Factor"},
748 {"/qh perf 1", "Sets standard performance"},
749 {"/qh perf 50%", "Does half as much background processing"},
750 {"/qh perf 3", "Computes routes 3 times more aggressively. Better have some good horsepower!"}},
751 QuestHelper.genericSetScale, QuestHelper, "perf_scale", "performance factor", .1, 5},
753 {"PERFLOAD",
754 "Sets or shows the initialization workload. Higher numbers will make QuestHelper load faster, lower numbers will result in better framerate while it's loading.",
755 {{"/qh perfload", "Show current Performance Factor"},
756 {"/qh perfload 1", "Sets standard performance"},
757 {"/qh perfload 50%", "Does half as much background processing"},
758 {"/qh perfload 3", "Loads 3 times as quickly."}},
759 QuestHelper.genericSetScale, QuestHelper, "perfload_scale", "boot performance factor", .2, 5},
761 {"PRECACHE",
762 "Toggles the routing precache on or off. Allowing precaching will increase performance significantly, at the expense of some memory, most notably at startup.",
763 {}, QuestHelper.TogglePrecache, QuestHelper},
765 {"TOP",
766 "Displays various performance stats on QuestHelper.",
768 {"/qh top recycle", "Displays detailed information on QuestHelper's recycled item pools"},
769 {"/qh top usage", "Displays detailed information on which table types are most common"},
770 {"/qh top cache", "Displays detailed information on the internal distance cache"},
771 {"/qh top perf", "Displays detailed information on coroutine CPU usage"},
772 }, QuestHelper.Top, QuestHelper},
774 {"ERROR",
775 "Displays the first QuestHelper error that has been generated this session in a form which can be copied out of WoW.",
776 {}, QuestHelper.ShowError, QuestHelper},
778 {"POS",
779 "Prints the player's current position. Exists mainly for my own personal convenience.",
780 {}, function (qh) qh:TextOut(qh:LocationString(qh.i, qh.x, qh.y) .. " " .. qh:Location_RawString(qh:Location_RawRetrieve()) .. " " .. qh:Location_AbsoluteString(qh:Location_AbsoluteRetrieve())) end, QuestHelper},
782 {"COMM",
783 "Toggles showing of the communication between QuestHelper users. Exists mainly for my own personal convenience.",
784 {}, QuestHelper.ToggleComm, QuestHelper},
786 {"RECALC",
787 "Recalculates the world graph and locations for any active objectives. Should not be necessary.", {}, QuestHelper.WantPathingReset, QuestHelper},
790 { "Help", {
791 {"HELP",
792 "Displays a list of help commands. Listed commands are filtered by the passed string.",
793 {}, QuestHelper.Help, QuestHelper},
795 {"VERSION",
796 "Displays QuestHelper's version.", {}, QuestHelper.PrintVersion, QuestHelper},
798 {"CHANGES",
799 "Displays a summary of changes recently made to QuestHelper.",
800 {}, QuestHelper.ChangeLog, QuestHelper},
802 --[[{"DONATE",
803 "Displays some instructions and a link for donating.",
804 {}, QuestHelper.Donate, QuestHelper},]]
808 function QuestHelper_SlashCommand(input)
809 local _, _, command, argument = string.find(input, "^%s*([^%s]-)%s+(.-)%s*$")
810 if not command then
811 command, argument = input, ""
814 command = string.upper(command)
816 for i1, cat in ipairs(commands) do
817 for i, data in ipairs(cat[2]) do
818 if data[1] == command then
819 local st = {}
821 for i = 5,#data do table.insert(st, data[i]) end
822 table.insert(st, argument)
824 if type(data[4]) == "function" then
825 data[4](unpack(st))
826 else
827 QuestHelper:TextOut(data[1].." is not yet implemented.")
830 return
835 QuestHelper:Help()
838 SLASH_QuestHelper1 = "/qh"
839 SLASH_QuestHelper2 = "/questhelper"
840 SlashCmdList["QuestHelper"] = function (text) QuestHelper_SlashCommand(text) end