Let's give better responses to this
[QuestHelper.git] / help.lua
blob89e77099bd6c912690a8fd80ed68615b895a1279
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 self:TextOut("Objective sharing is currently broken. Zorba will make it work again once he can.")
100 do return end
102 QuestHelper_Pref.share = not QuestHelper_Pref.share
103 if QuestHelper_Pref.share then
104 if QuestHelper_Pref.solo then
105 self:TextOut("Objective sharing will been |cff00ff00enabled|r when you disable solo mode.")
106 else
107 self:TextOut("Objective sharing has been |cff00ff00enabled|r.")
108 self:EnableSharing()
110 else
111 self:TextOut("Objective sharing has been |cffff0000disabled|r.")
112 if QuestHelper_Pref.solo then
113 self:TextOut("Objective sharing won't be reenabled when you disable solo mode.")
114 else
115 self:DisableSharing()
120 function QuestHelper:ToggleFlightTimes()
121 QuestHelper_Pref.flight_time = not QuestHelper_Pref.flight_time
122 if QuestHelper_Pref.flight_time then
123 self:TextOut("The flight timer has been |cff00ff00enabled|r.")
124 else
125 self:TextOut("The flight timer has been |cffff0000disabled|r.")
129 function QuestHelper:ToggleTrack()
130 QuestHelper_Pref.track = not QuestHelper_Pref.track
131 if QuestHelper_Pref.track then
132 self:ShowTracker()
133 self:TextOut("The quest tracker has been |cff00ff00enabled|r.")
134 else
135 self:HideTracker()
136 self:TextOut("The quest tracker has been |cffff0000disabled|r.")
140 function QuestHelper:ToggleTooltip()
141 QuestHelper_Pref.tooltip = not QuestHelper_Pref.tooltip
142 if QuestHelper_Pref.tooltip then
143 self:TextOut("Objective tooltip information has been |cff00ff00enabled|r.")
144 else
145 self:TextOut("Objective tooltip information has been |cffff0000disabled|r.")
149 function QuestHelper:Purgewarning()
150 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.")
151 QuestHelper:TextOut("Enter "..self:HighlightText("/qh nag verbose").." to check and see if you're destroying anything important.")
152 QuestHelper:TextOut("Enter "..self:HighlightText("/qh submit").." for instructions on how to submit your collected data.")
153 QuestHelper:TextOut("See the "..self:HighlightText("How You Can Help").." section on the project website for instructions.")
156 function QuestHelper:Purge(code, force, noreload)
157 if code == self.purge_code or force then
158 QuestHelper_Quests = nil
159 QuestHelper_Objectives = nil
160 QuestHelper_FlightInstructors = nil
161 QuestHelper_FlightRoutes = nil
162 QuestHelper_Locale = nil
163 QuestHelper_UID = nil
164 QuestHelper_Version = nil
165 QuestHelper_SaveVersion = nil
167 QuestHelper_SaveDate = nil
168 QuestHelper_SeenRealms = nil
170 QuestHelper_Collector = nil
171 QuestHelper_Collector_Version = nil
173 if not noreload then ReloadUI() end
174 else
175 if not self.purge_code then self.purge_code = self:CreateUID(8) end
176 QuestHelper:TextOut("THIS COMMAND WILL DELETE ALL YOUR COLLECTED DATA")
177 QuestHelper:Purgewarning()
178 QuestHelper:TextOut("If you're sure you want to go through with this, enter: "..self:HighlightText("/qh purge "..self.purge_code))
182 function QuestHelper:HardReset(code)
183 if code == self.purge_code then
184 self:ResetTrackerPosition() -- do this before we kill off the prefs, since it touches a pref
185 QH_Arrow_Reset()
186 QuestHelper_Pref = nil
187 QuestHelper_ErrorList = nil -- BIZAM
188 QuestHelper_KnownFlightRoutes = nil
189 QuestHelper_Home = nil
190 QuestHelper_CharVersion = nil
191 self:Purge(nil, true)
192 else
193 if not self.purge_code then self.purge_code = self:CreateUID(8) end
194 QuestHelper:TextOut("THIS COMMAND WILL DELETE ALL YOUR COLLECTED DATA AND RESET ALL YOUR PREFERENCES")
195 QuestHelper:Purgewarning()
196 QuestHelper:TextOut("If you're sure you want to go through with this, enter: "..self:HighlightText("/qh hardreset "..self.purge_code))
200 function QuestHelper:ToggleSolo()
201 QuestHelper_Pref.solo = not QuestHelper_Pref.solo
202 if QuestHelper_Pref.solo then
203 if QuestHelper_Pref.share then
204 self:DisableSharing()
205 self:TextOut("Objective sharing has been temporarly |cffff0000disabled|r.")
207 self:TextOut("Solo mode has been |cff00ff00enabled|r.")
208 else
209 self:TextOut("Solo mode has been |cffff0000disabled|r.")
210 if QuestHelper_Pref.share then
211 self:EnableSharing()
212 self:TextOut("Objective sharing has been re|cff00ff00enabled|r.")
217 function QuestHelper:ToggleComm()
218 if QuestHelper_Pref.comm then
219 QuestHelper_Pref.comm = false
220 self:TextOut("Communication display has been |cffff0000disabled|r.")
221 else
222 QuestHelper_Pref.comm = true
223 self:TextOut("Communication display has been |cff00ff00enabled|r.")
227 function QuestHelper:ToggleAnts()
228 if QuestHelper_Pref.show_ants then
229 QuestHelper_Pref.show_ants = false
230 self:TextOut("Ant trails have been |cffff0000disabled|r.")
231 else
232 QuestHelper_Pref.show_ants = true
233 self:TextOut("Ant trails have been |cff00ff00enabled|r.")
237 function QuestHelper:LevelOffset(offset)
238 local level = tonumber(offset)
239 if level then
240 if level > 0 then
241 self:TextOut("Allowing quests up to "..self:HighlightText(level).." level"..(level==1 and " " or "s ")..self:HighlightText("above").." you.")
242 elseif level < 0 then
243 self:TextOut("Only allowing quests "..self:HighlightText(-level).." level"..(level==-1 and " " or "s ")..self:HighlightText("below").." you.")
244 else
245 self:TextOut("Only allowing quests "..self:HighlightText("at or below").." your current level.")
248 if not QuestHelper_Pref.filter_level then
249 self:TextOut("Note: This won't have any effect until you turn the level filter on.")
252 if QuestHelper_Pref.level ~= level then
253 QuestHelper_Pref.level = level
254 QH_Route_Filter_Rescan("filter_quest_level")
256 elseif offset == "" then
257 if QuestHelper_Pref.level <= 0 then
258 self:TextOut("Level offset is currently set to "..self:HighlightText(QuestHelper_Pref.level)..".")
259 else
260 self:TextOut("Level offset is currently set to "..self:HighlightText("+"..QuestHelper_Pref.level)..".")
263 if self.party_levels then for n, l in ipairs(self.party_levels) do
264 self:TextOut("Your effective level in a "..self:HighlightText(n).." player quest is "..self:HighlightText(string.format("%.1f", l))..".")
265 end end
267 if QuestHelper_Pref.solo then
268 self:TextOut("Peers aren't considered in your effective level, because you're playing solo.")
270 else
271 self:TextOut("Expected a level offset.")
275 function QuestHelper:Filter(input)
276 input = string.upper(input)
277 if input == "ZONE" then
278 QuestHelper_Pref.filter_zone = not QuestHelper_Pref.filter_zone
279 self:TextOut("Filter "..self:HighlightText("zone").." set to "..self:HighlightText(QuestHelper_Pref.filter_zone and "active" or "inactive")..".")
280 QH_Route_Filter_Rescan("filter_zone")
281 elseif input == "DONE" then
282 QuestHelper_Pref.filter_done = not QuestHelper_Pref.filter_done
283 self:TextOut("Filter "..self:HighlightText("done").." set to "..self:HighlightText(QuestHelper_Pref.filter_done and "active" or "inactive")..".")
284 QH_Route_Filter_Rescan("filter_quest_done")
285 elseif input == "LEVEL" then
286 QuestHelper_Pref.filter_level = not QuestHelper_Pref.filter_level
287 self:TextOut("Filter "..self:HighlightText("level").." set to "..self:HighlightText(QuestHelper_Pref.filter_level and "active" or "inactive")..".")
288 QH_Route_Filter_Rescan("filter_quest_level")
289 elseif input == "BLOCKED" or input == "BLOCK" then
290 QuestHelper_Pref.filter_blocked = not QuestHelper_Pref.filter_blocked
291 self:TextOut("Filter "..self:HighlightText("blocked").." set to "..self:HighlightText(QuestHelper_Pref.filter_blocked and "active" or "inactive")..".")
292 QH_Route_Filter_Rescan("filter_blocked")
293 elseif input == "WATCHED" or input == "WATCH" then
294 QuestHelper_Pref.filter_watched = not QuestHelper_Pref.filter_watched
295 self:TextOut("Filter "..self:HighlightText("watched").." set to "..self:HighlightText(QuestHelper_Pref.filter_watched and "active" or "inactive")..".")
296 QH_Route_Filter_Rescan("filter_quest_watched")
297 elseif input == "" then
298 self:TextOut("Filter "..self:HighlightText("zone")..": "..self:HighlightText(QuestHelper_Pref.filter_zone and "active" or "inactive"))
299 self:TextOut("Filter "..self:HighlightText("level")..": "..self:HighlightText(QuestHelper_Pref.filter_level and "active" or "inactive"))
300 self:TextOut("Filter "..self:HighlightText("done")..": "..self:HighlightText(QuestHelper_Pref.filter_done and "active" or "inactive"))
301 self:TextOut("Filter "..self:HighlightText("blocked")..": "..self:HighlightText(QuestHelper_Pref.filter_blocked and "active" or "inactive"))
302 self:TextOut("Filter "..self:HighlightText("watched")..": "..self:HighlightText(QuestHelper_Pref.filter_watched and "active" or "inactive"))
303 else
304 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")..".")
308 function QuestHelper:ToggleArrow(text)
309 if text == "reset" then QH_Arrow_Reset() return end
311 QuestHelper_Pref.arrow = not QuestHelper_Pref.arrow
312 if QuestHelper_Pref.arrow then
313 QH_Arrow_Show()
314 self:TextOut(QHFormat("SETTINGS_ARROWLINK_ON", QHText("SETTINGS_ARROWLINK_ARROW")))
315 else
316 self:TextOut(QHFormat("SETTINGS_ARROWLINK_OFF", QHText("SETTINGS_ARROWLINK_ARROW")))
320 function QuestHelper:ToggleCartWP()
321 QuestHelper_Pref.cart_wp_new = not QuestHelper_Pref.cart_wp_new
322 if QuestHelper_Pref.cart_wp_new then
323 self:EnableCartographer()
324 if Cartographer_Waypoints then
325 if Waypoint and Waypoint.prototype then
326 self:TextOut("Would use "..self:HighlightText("Cartographer Waypoints").." to show objectives, but another mod is interfering with it.")
327 else
328 self:TextOut(QHFormat("SETTINGS_ARROWLINK_ON", QHText("SETTINGS_ARROWLINK_CART")))
330 else
331 self:TextOut("Would use "..self:HighlightText("Cartographer Waypoints").." to show objectives, except it doesn't seem to be present.")
333 else
334 self:DisableCartographer()
335 self:TextOut(QHFormat("SETTINGS_ARROWLINK_OFF", QHText("SETTINGS_ARROWLINK_CART")))
339 function QuestHelper:ToggleTomTomWP()
340 QuestHelper_Pref.tomtom_wp_new = not QuestHelper_Pref.tomtom_wp_new
341 if QuestHelper_Pref.tomtom_wp_new then
342 self:EnableTomTom()
343 if TomTom then
344 self:TextOut(QHFormat("SETTINGS_ARROWLINK_ON", QHText("SETTINGS_ARROWLINK_TOMTOM")))
345 else
346 self:TextOut("Would use "..self:HighlightText("TomTom").." to show objectives, except it doesn't seem to be present.")
348 else
349 self:DisableTomTom()
350 self:TextOut(QHFormat("SETTINGS_ARROWLINK_OFF", QHText("SETTINGS_ARROWLINK_TOMTOM")))
354 function QuestHelper:WantPathingReset()
355 self:TextOut("Will reset world graph.")
356 self.defered_graph_reset = true
359 function QuestHelper:PrintVersion()
360 self:TextOut("Version: "..self:HighlightText(GetAddOnMetadata("QuestHelper", "Version") or "Unknown"))
363 local function RecycleStatusString(fmt, usedcount, freetable, usedtable)
364 local freetablecount = QuestHelper:TableSize(freetable)
365 if usedtable then
366 local usedtablecount = QuestHelper:TableSize(usedtable)
367 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)
368 else
369 return string.format(fmt, QuestHelper:ProgressString(string.format("%d/%d", usedcount, usedcount+freetablecount), ((usedcount+freetablecount == 0) and 1) or (1-usedcount/(usedcount+freetablecount))))
373 function QuestHelper:Top(cmd)
374 if cmd and string.find(cmd, "all") then
375 cmd = cmd .. " collected recycle clear boot usage"
378 if cmd and string.find(cmd, "boot") then
379 local bootv = {}
380 for k, v in pairs(QuestHelper_Loadtime) do
381 table.insert(bootv, {time = v, file = k})
383 table.sort(bootv, function (a, b) return a.time < b.time end)
385 if string.find(cmd, "sort") then
386 local boott = {}
387 for i = 1, #bootv - 1 do
388 table.insert(boott, {time = bootv[i + 1].time - bootv[i].time, file = bootv[i].file})
390 table.sort(boott, function(a, b) return a.time < b.time end)
392 for _, v in pairs(boott) do
393 QuestHelper:TextOut(string.format("%s: %f", v.file, v.time))
395 QuestHelper:TextOut(string.format("%s: shrug", bootv[#bootv].file))
396 else
397 for i = 1, #bootv do
398 QuestHelper:TextOut(string.format("%f: %s", bootv[i].time - bootv[1].time, bootv[i].file))
403 local pre_ttf
404 local pre_db
405 if cmd and string.find(cmd, "collected") then
406 pre_ttf = self:DumpTableTypeFrequencies(true)
407 pre_db = DB_DumpItems()
410 if cmd and string.find(cmd, "recycle") then
411 self:DumpTableTypeFrequencies()
412 self:TextOut(RecycleStatusString("Using %s lua tables.", self.used_tables, self.free_tables, self.recycle_tabletyping))
413 self:TextOut(RecycleStatusString("Using %s texture objects.", self.used_textures, self.free_textures))
414 self:TextOut(RecycleStatusString("Using %s font objects.", self.used_text, self.free_text))
415 self:TextOut(RecycleStatusString("Using %s frame objects.", self.used_frames, self.free_frames))
418 if cmd and string.find(cmd, "usage") then
419 self:DumpTableTypeFrequencies()
422 if cmd and string.find(cmd, "cache") then
423 self:DumpCacheData()
426 if cmd and string.find(cmd, "perf") then
427 QH_Timeslice_DumpPerf()
430 local uncd = 0
431 for k, v in pairs(QuestHelper_Collector) do
432 if not v.compressed then uncd = uncd + 1 end
434 uncd = uncd - 1
435 local uncs = ""
436 if uncd > 0 then
437 uncs = string.format(" (%d uncompressed IDs)", uncd)
440 UpdateAddOnMemoryUsage()
441 local pre_gc = GetAddOnMemoryUsage("QuestHelper")
443 collectgarbage("collect")
445 UpdateAddOnMemoryUsage()
446 local post_gc = GetAddOnMemoryUsage("QuestHelper")
448 if cmd and string.find(cmd, "collected") then
449 local post_ttf = self:DumpTableTypeFrequencies(true)
451 local union = {}
452 for k, v in pairs(pre_ttf) do union[k] = (pre_ttf[k] or 0) - (post_ttf[k] or 0) end
453 for k, v in pairs(post_ttf) do union[k] = (pre_ttf[k] or 0) - (post_ttf[k] or 0) end
455 local sorted = {}
456 for k, v in pairs(union) do
457 table.insert(sorted, {k = k, d = v})
460 table.sort(sorted, function(a, b) return a.d < b.d end)
461 for _, v in pairs(sorted) do
462 if v.d > 0 then
463 QuestHelper:TextOut(string.format("%d: %s", v.d, v.k))
467 local post_db = DB_DumpItems()
469 local st = {}
470 for k, v in pairs(pre_db) do
471 if not post_db[k] then
472 table.insert(st, k)
475 table.sort(st)
477 for _, v in ipairs(st) do
478 QuestHelper:TextOut("DB: " .. v)
482 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))
484 if cmd and string.find(cmd, "clear") then
485 local cleared = QH_ClearPathcache()
487 collectgarbage("collect")
488 UpdateAddOnMemoryUsage()
489 local new_post_gc = GetAddOnMemoryUsage("QuestHelper")
490 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))
492 local cleared = QuestHelper:RecycleClear()
494 collectgarbage("collect")
495 UpdateAddOnMemoryUsage()
496 local new_post_gc_2 = GetAddOnMemoryUsage("QuestHelper")
497 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))
501 function QuestHelper:ToggleMapButton()
502 QuestHelper_Pref.map_button = not QuestHelper_Pref.map_button
504 if QuestHelper_Pref.map_button then
505 QuestHelper:InitMapButton()
506 self:TextOut("Map button has been |cff00ff00enabled|r.")
507 else
508 QuestHelper:HideMapButton()
509 self:TextOut("Map button has been |cffff0000disabled|r. Use '/qh button' to restore it.")
513 function QuestHelper:ChangeLog()
514 self:ShowText(QuestHelper_ChangeLog, string.format("QuestHelper %s ChangeLog", QuestHelper_Version))
517 function QuestHelper:Submit()
518 self:ShowText([[
519 |TInterface\AddOns\QuestHelper\Art\Upload.tga:100:300|t
520 Your data can't be submitted automatically, since AddOns can't interact with anything outside of World of Warcraft.
522 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.
524 World of Warcraft stores QuestHelper's data in a file named |cff40bbffQuestHelper.lua|r.
526 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.
528 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.
530 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.
532 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.
534 After you find |cff40bbffQuestHelper.lua|r, you can email it to me here: |cff40bbffqhaddon@gmail.com|r
535 ]], "How To Submit Your Data")
538 function QuestHelper:ShowError(params)
539 if params and params == "full" then
540 QuestHelper_ErrorCatcher_GenerateReport()
542 QuestHelper_ErrorCatcher_ReportError()
545 local commands
547 function QuestHelper:Help(argument)
548 local text = ""
549 local argument = argument and argument:upper() or ""
551 for i1, cat in ipairs(commands) do
552 text = string.format("%s|cffffff00%s|r\n\n", text, cat[1])
553 for i, data in ipairs(cat[2]) do
554 if data[1]:find(argument, 1, true) then
555 text = string.format("%s |cffff8000%s|r %s\n", text, data[1], data[2])
557 if #data[3] > 0 then
558 text = string.format("%s\n %s\n", text, #data[3] == 1 and "Example:" or "Examples:")
559 for i, pair in ipairs(data[3]) do
560 text = string.format("%s |cff40bbff%s|r\n %s\n", text, pair[1], pair[2])
564 text = text .. "\n"
567 text = text .. "\n\n"
570 self:ShowText(text == "" and ("No commands containing '"..argument.."'") or text, "QuestHelper Slash Commands")
573 function QuestHelper:Donate(argument)
574 local text = ""
575 local argument = argument and argument:upper() or ""
577 for i1, cat in ipairs(commands) do
578 text = string.format("%s|cffffff00%s|r\n\n", text, cat[1])
579 for i, data in ipairs(cat[2]) do
580 if data[1]:find(argument, 1, true) then
581 text = string.format("%s |cffff8000%s|r %s\n", text, data[1], data[2])
583 if #data[3] > 0 then
584 text = string.format("%s\n %s\n", text, #data[3] == 1 and "Example:" or "Examples:")
585 for i, pair in ipairs(data[3]) do
586 text = string.format("%s |cff40bbff%s|r\n %s\n", text, pair[1], pair[2])
590 text = text .. "\n"
593 text = text .. "\n\n"
596 self:ShowText([[
597 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.
599 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:
601 |cff40bbffReduced memory and CPU usage for smoother gameplay|r
603 |cff40bbffFlying mount support for both Northrend and Outland|r
605 |cff40bbffBetter support for Northrend "phased" quests|r
607 |cff40bbffAchievementHelper, built right into QuestHelper|r
609 |cff40bbffPaths that lead you around obstacles instead of through them|r
611 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!
613 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.
615 Thanks!]], "Please Donate!", 500, 20, 10)
618 commands =
620 { "Common commands", {
621 {"HIDDEN",
622 "Compiles a list of objectives that QuestHelper is hiding from you. Depending on the reason, you can also unhide the objective.",
623 {}, QH_Hidden_Menu},
625 {"HIDE",
626 "Hides QuestHelper's modifications to the minimap and world map, and pauses routing calculations.",
627 {}, QuestHelper.ToggleHide, QuestHelper},
629 {"ARROW",
630 "Toggles Questhelper's built-in directional arrow.",
631 {{"/qh arrow reset", "Reset location to the center of the screen."}},
632 QuestHelper.ToggleArrow, QuestHelper},
634 {"CARTWP",
635 "Toggles displaying the current objective using Cartographer Waypoints (must be installed separately).",
636 {}, QuestHelper.ToggleCartWP, QuestHelper},
638 {"TOMTOM",
639 "Toggles displaying the current objective using TomTom (must be installed separately).",
640 {}, QuestHelper.ToggleTomTomWP, QuestHelper},
642 {"FIND",
643 "Search for an item, location, or npc.",
644 {{"/qh find item rune of teleport", "Finds a reagent vendor."},
645 {"/qh find npc bragok", "Finds the Ratchet flight point."},
646 {"/qh find loc stormwind 50 60", "Finds the Stormwind auction house."},
647 {"/qh find loc 50 50", "Finds the center of the zone you're in."},
648 {"/qh find something", "Searches for something in all categories."},
649 {"/qh find", "Lists objectives you manually created so that you can remove them."}}, QuestHelper.PerformSearch, QuestHelper},
651 {"SOLO",
652 "Toggles solo mode. When enabled, assumes your party members don't exist. Objective sharing with party members will also be disabled.",
653 {}, QuestHelper.ToggleSolo, QuestHelper},
656 { "Objective filtering", {
657 {"FILTER",
658 "Automatically ignores/unignores objectives based on criteria.",
659 {{"/qh filter zone", "Toggle showing objectives outside the current zone"},
660 {"/qh filter done", "Toggle showing objectives for uncompleted quests."},
661 {"/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."},
662 {"/qh filter blocked", "Toggle showing blocked objectives, such as quest turn-ins for incomplete quests."},
663 {"/qh filter watched", "Toggle limiting to objectives watched in the Quest Log"}
664 }, QuestHelper.Filter, QuestHelper},
666 {"LEVEL",
667 "Adjusts the level offset used by the level filter. Naturally, the level filter must be turned on to have an effect.",
668 {{"/qh level", "See information related to the level filter."},
669 {"/qh level 0", "Only allow objectives at or below your current level."},
670 {"/qh level +2", "Allow objectives up to two levels above your current level."},
671 {"/qh level -1", "Only allow objectives below your current level."}}, QuestHelper.LevelOffset, QuestHelper},
673 {"SCALE",
674 "Scales the map icons used by QuestHelper. Will accept values between 50% and 300%.",
675 {{"/qh scale 1", "Uses the default icon size."},
676 {"/qh scale 2", "Makes icons twice their default size."},
677 {"/qh scale 80%", "Makes icons slightly smaller than their default size."}},
678 QuestHelper.genericSetScale, QuestHelper, "scale", "icon scale", .5, 3},
680 {"SHARE",
681 "Toggles objective sharing between QuestHelper users.",
682 {}, QuestHelper.ToggleShare, QuestHelper},
685 { "Interface", {
686 {"TRACK",
687 "Toggles the visibility of the QuestHelper's replacement quest tracker.",
688 {}, QuestHelper.ToggleTrack, QuestHelper},
690 {"TSCALE",
691 "Scales the quest tracker provided by QuestHelper. Will accept values between 50% and 300%.",
693 QuestHelper.TrackerScale, QuestHelper},
695 {"TRESET",
696 "Reset's the position of the quest tracker provided by QuestHelper, in cause you move it somewhere inaccessable.",
697 {{"/qh treset center", "Resets to the center of the screen, instead of a more normal quest tracker location."}}, QuestHelper.ResetTrackerPosition, QuestHelper},
699 {"TOOLTIP",
700 "Toggles appending information about tracked items and NPCs to their tooltips.",
701 {}, QuestHelper.ToggleTooltip, QuestHelper},
703 {"FTIME",
704 "Toggles display of flight time estimates.", {}, QuestHelper.ToggleFlightTimes, QuestHelper},
706 {"ANTS",
707 "Toggles the display of trails on the world map on and off.",
708 {}, QuestHelper.ToggleAnts, QuestHelper},
710 {"LOCALE",
711 "Select the locale to use for displayed messages.",
712 {}, QuestHelper.SetLocale, QuestHelper},
714 {"BUTTON",
715 "Toggles the display of QuestHelper's button on the world map.",
716 {}, QuestHelper.ToggleMapButton, QuestHelper},
718 {"SETTINGS",
719 "Opens the Settings menu at the current cursor location. Note that not all settings can be changed through the menu.",
720 {}, QuestHelper.DoSettingsMenu, QuestHelper},
723 { "Data collection", {
724 {"SUBMIT",
725 "Displays instructions for submitting your collected data.",
726 {}, QuestHelper.Submit, QuestHelper},
728 {"NAG",
729 "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.",
730 {{"/qh nag verbose", "Prints the specific changes that were found."}}, QuestHelper.Nag, QuestHelper},
732 {"PURGE",
733 "Deletes all QuestHelper's collected data.", {}, QuestHelper.Purge, QuestHelper},
735 {"HARDRESET",
736 "Deletes all QuestHelper's collected data and resets QuestHelper preferences.", {}, QuestHelper.HardReset, QuestHelper},
739 { "Performance and debug", {
740 {"PERF",
741 "Sets or shows the route workload. Higher means more agressive route updating, lower means better performance Accepts numbers between 10% and 500%.",
742 {{"/qh perf", "Show current Performance Factor"},
743 {"/qh perf 1", "Sets standard performance"},
744 {"/qh perf 50%", "Does half as much background processing"},
745 {"/qh perf 3", "Computes routes 3 times more aggressively. Better have some good horsepower!"}},
746 QuestHelper.genericSetScale, QuestHelper, "perf_scale", "performance factor", .1, 5},
748 {"PERFLOAD",
749 "Sets or shows the initialization workload. Higher numbers will make QuestHelper load faster, lower numbers will result in better framerate while it's loading.",
750 {{"/qh perfload", "Show current Performance Factor"},
751 {"/qh perfload 1", "Sets standard performance"},
752 {"/qh perfload 50%", "Does half as much background processing"},
753 {"/qh perfload 3", "Loads 3 times as quickly."}},
754 QuestHelper.genericSetScale, QuestHelper, "perfload_scale", "boot performance factor", .2, 5},
756 {"TOP",
757 "Displays various performance stats on QuestHelper.",
759 {"/qh top recycle", "Displays detailed information on QuestHelper's recycled item pools"},
760 {"/qh top usage", "Displays detailed information on which table types are most common"},
761 {"/qh top cache", "Displays detailed information on the internal distance cache"},
762 {"/qh top perf", "Displays detailed information on coroutine CPU usage"},
763 }, QuestHelper.Top, QuestHelper},
765 {"ERROR",
766 "Displays the first QuestHelper error that has been generated this session in a form which can be copied out of WoW.",
767 {}, QuestHelper.ShowError, QuestHelper},
769 {"POS",
770 "Prints the player's current position. Exists mainly for my own personal convenience.",
771 {}, 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},
773 {"COMM",
774 "Toggles showing of the communication between QuestHelper users. Exists mainly for my own personal convenience.",
775 {}, QuestHelper.ToggleComm, QuestHelper},
777 {"RECALC",
778 "Recalculates the world graph and locations for any active objectives. Should not be necessary.", {}, QuestHelper.WantPathingReset, QuestHelper},
781 { "Help", {
782 {"HELP",
783 "Displays a list of help commands. Listed commands are filtered by the passed string.",
784 {}, QuestHelper.Help, QuestHelper},
786 {"VERSION",
787 "Displays QuestHelper's version.", {}, QuestHelper.PrintVersion, QuestHelper},
789 {"CHANGES",
790 "Displays a summary of changes recently made to QuestHelper.",
791 {}, QuestHelper.ChangeLog, QuestHelper},
793 --[[{"DONATE",
794 "Displays some instructions and a link for donating.",
795 {}, QuestHelper.Donate, QuestHelper},]]
799 function QuestHelper_SlashCommand(input)
800 local _, _, command, argument = string.find(input, "^%s*([^%s]-)%s+(.-)%s*$")
801 if not command then
802 command, argument = input, ""
805 command = string.upper(command)
807 for i1, cat in ipairs(commands) do
808 for i, data in ipairs(cat[2]) do
809 if data[1] == command then
810 local st = {}
812 for i = 5,#data do table.insert(st, data[i]) end
813 table.insert(st, argument)
815 if type(data[4]) == "function" then
816 data[4](unpack(st))
817 else
818 QuestHelper:TextOut(data[1].." is not yet implemented.")
821 return
826 QuestHelper:Help()
829 SLASH_QuestHelper1 = "/qh"
830 SLASH_QuestHelper2 = "/questhelper"
831 SlashCmdList["QuestHelper"] = function (text) QuestHelper_SlashCommand(text) end