fix upgrade.lua freakout
[QuestHelper.git] / help.lua
blob12ca8651a6209c4f0e5f6b3c142b2dcb7eec1624
1 QuestHelper_File["help.lua"] = "Development Version"
2 QuestHelper_Loadtime["help.lua"] = GetTime()
4 function QuestHelper:scaleString(val)
5 return self:HighlightText(math.floor(val*100+0.5).."%")
6 end
8 function QuestHelper:genericSetScale(varname, name, mn, mx, input, onchange, ...)
9 if input == "" then
10 self:TextOut(string.format("Current %s scale is %s.", name, self:scaleString(QuestHelper_Pref[varname])))
11 else
12 local scale = tonumber(input)
14 if not scale then
15 local x = string.match(input or "", "^%s*([%d%.]+)%s*%%%s*$")
16 scale = tonumber(x) or 0
17 if not scale then
18 self:TextOut("I don't know how to interpret your input.")
19 return
20 end
21 scale = scale * 0.01
22 end
24 if scale < mn then
25 self:TextOut(string.format("I won't accept a scale less than %s.", self:scaleString(mn)))
26 elseif scale > mx then
27 self:TextOut(string.format("I won't accept a scale more than %s.", self:scaleString(mx)))
28 else
29 QuestHelper_Pref[varname] = scale
30 self:TextOut(string.format("Set %s scale set to %s.", name, self:scaleString(scale)))
31 if onchange then
32 onchange(...)
33 end
34 end
35 end
36 end
38 function QuestHelper:TrackerScale(scale)
39 QuestHelper:genericSetScale("track_scale", "tracker scale", .5, 2, scale,
40 function() QuestHelper.tracker:SetScale(QuestHelper_Pref.track_scale) end)
41 end
43 function QuestHelper:SetLocale(loc)
44 if not loc or loc == "" then
45 self:TextOut(QHText("LOCALE_LIST_BEGIN"))
46 for loc, tbl in pairs(QuestHelper_Translations) do
47 self:TextOut(string.format(" %s%s %s", self:HighlightText(loc),
48 loc == QuestHelper_Pref.locale and " *" or " ",
49 tbl.LOCALE_NAME or "???"))
50 end
51 else
52 for l, tbl in pairs(QuestHelper_Translations) do
53 if string.find(string.lower(l), "^"..string.lower(loc)) or
54 string.find(string.lower(tbl.LOCALE_NAME or ""), "^"..string.lower(loc)) then
55 QuestHelper_Pref.locale = l
56 QHFormatSetLocale(l)
57 self:SetLocaleFonts()
58 self:TextOut(QHFormat("LOCALE_CHANGED", l))
59 return
60 end
61 end
63 self:TextOut(QHFormat("LOCALE_UNKNOWN", tostring(loc) or "UNKNOWN"))
64 end
65 end
67 function QuestHelper:ToggleHide()
68 local current_objective = self.minimap_dodad.objective
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.minimap_dodad:SetObjective(nil)
85 self.minimap_dodad.objective = current_objective
86 self:TextOut("QuestHelper is now |cffff0000hidden|r.")
87 else
88 if QuestHelper_Pref.track then
89 self:ShowTracker()
90 end
92 self.map_overlay:Show()
93 self.minimap_dodad.objective = nil
94 self.minimap_dodad:SetObjective(current_objective)
95 self:TextOut("QuestHelper is now |cff00ff00shown|r.")
96 -- WoW Will lockup inside ForceRouteUpdate, and so the UPDATING_ROUTE message won't appear until afterwards, making
97 -- this message kind of redundant.
98 -- self:TextOut(QHText("UPDATING_ROUTE"))
99 QH_Timeslice_Bonus(20) -- Let the corutine do some overtime...
103 function QuestHelper:ToggleShare()
104 QuestHelper_Pref.share = not QuestHelper_Pref.share
105 if QuestHelper_Pref.share then
106 if QuestHelper_Pref.solo then
107 self:TextOut("Objective sharing will been |cff00ff00enabled|r when you disable solo mode.")
108 else
109 self:TextOut("Objective sharing has been |cff00ff00enabled|r.")
110 self:EnableSharing()
112 else
113 self:TextOut("Objective sharing has been |cffff0000disabled|r.")
114 if QuestHelper_Pref.solo then
115 self:TextOut("Objective sharing won't be reenabled when you disable solo mode.")
116 else
117 self:DisableSharing()
122 function QuestHelper:ToggleFlightTimes()
123 QuestHelper_Pref.flight_time = not QuestHelper_Pref.flight_time
124 if QuestHelper_Pref.flight_time then
125 self:TextOut("The flight timer has been |cff00ff00enabled|r.")
126 else
127 self:TextOut("The flight timer has been |cffff0000disabled|r.")
131 function QuestHelper:ToggleTrack()
132 QuestHelper_Pref.track = not QuestHelper_Pref.track
133 if QuestHelper_Pref.track then
134 self:ShowTracker()
135 self:TextOut("The quest tracker has been |cff00ff00enabled|r.")
136 else
137 self:HideTracker()
138 self:TextOut("The quest tracker has been |cffff0000disabled|r.")
142 function QuestHelper:ToggleTrackLevel()
143 QuestHelper_Pref.track_level = not QuestHelper_Pref.track_level
144 if QuestHelper_Pref.track_level then
145 self:TextOut("Display of levels in the quest tracker has been |cff00ff00enabled|r.")
146 else
147 self:TextOut("Display of levels in the quest tracker has been |cffff0000disabled|r.")
149 self.tracker:reset()
152 function QuestHelper:ToggleTrackQColour()
153 QuestHelper_Pref.track_qcolour = not QuestHelper_Pref.track_qcolour
154 if QuestHelper_Pref.track_qcolour then
155 self:TextOut("Colour for quest difficulty in quest tracker has been |cff00ff00enabled|r.")
156 else
157 self:TextOut("Colour for quest difficulty in quest tracker has been |cffff0000disabled|r.")
159 self.tracker:reset()
162 function QuestHelper:ToggleTrackOColour()
163 QuestHelper_Pref.track_ocolour = not QuestHelper_Pref.track_ocolour
164 if QuestHelper_Pref.track_ocolour then
165 self:TextOut("Colour for objective progress in quest tracker has been |cff00ff00enabled|r.")
166 else
167 self:TextOut("Colour for objective progress in quest tracker has been |cffff0000disabled|r.")
169 self.tracker:reset()
172 function QuestHelper:ToggleTooltip()
173 QuestHelper_Pref.tooltip = not QuestHelper_Pref.tooltip
174 if QuestHelper_Pref.tooltip then
175 self:TextOut("Objective tooltip information has been |cff00ff00enabled|r.")
176 else
177 self:TextOut("Objective tooltip information has been |cffff0000disabled|r.")
181 function QuestHelper:Purgewarning()
182 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.")
183 QuestHelper:TextOut("Enter "..self:HighlightText("/qh nag verbose").." to check and see if you're destroying anything important.")
184 QuestHelper:TextOut("Enter "..self:HighlightText("/qh submit").." for instructions on how to submit your collected data.")
185 QuestHelper:TextOut("See the "..self:HighlightText("How You Can Help").." section on the project website for instructions.")
188 function QuestHelper:Purge(code, force, noreload)
189 if code == self.purge_code or force then
190 QuestHelper_Quests = nil
191 QuestHelper_Objectives = nil
192 QuestHelper_FlightInstructors = nil
193 QuestHelper_FlightRoutes = nil
194 QuestHelper_Locale = nil
195 QuestHelper_UID = nil
196 QuestHelper_Version = nil
197 QuestHelper_SaveVersion = nil
199 QuestHelper_SaveDate = nil
200 QuestHelper_SeenRealms = nil
202 QuestHelper_Collector = nil
203 QuestHelper_Collector_Version = nil
205 if not noreload then ReloadUI() end
206 else
207 if not self.purge_code then self.purge_code = self:CreateUID(8) end
208 QuestHelper:TextOut("THIS COMMAND WILL DELETE ALL YOUR COLLECTED DATA")
209 QuestHelper:Purgewarning()
210 QuestHelper:TextOut("If you're sure you want to go through with this, enter: "..self:HighlightText("/qh purge "..self.purge_code))
214 function QuestHelper:HardReset(code)
215 if code == self.purge_code then
216 QuestHelper_Pref = nil
217 QuestHelper_ErrorList = nil -- BIZAM
218 QuestHelper_KnownFlightRoutes = nil
219 QuestHelper_Home = nil
220 QuestHelper_CharVersion = nil
221 self:Purge(nil, true)
222 else
223 if not self.purge_code then self.purge_code = self:CreateUID(8) end
224 QuestHelper:TextOut("THIS COMMAND WILL DELETE ALL YOUR COLLECTED DATA AND RESET ALL YOUR PREFERENCES")
225 QuestHelper:Purgewarning()
226 QuestHelper:TextOut("If you're sure you want to go through with this, enter: "..self:HighlightText("/qh hardreset "..self.purge_code))
230 function QuestHelper:ToggleSolo()
231 QuestHelper_Pref.solo = not QuestHelper_Pref.solo
232 if QuestHelper_Pref.solo then
233 if QuestHelper_Pref.share then
234 self:DisableSharing()
235 self:TextOut("Objective sharing has been temporarly |cffff0000disabled|r.")
237 self:TextOut("Solo mode has been |cff00ff00enabled|r.")
238 else
239 self:TextOut("Solo mode has been |cffff0000disabled|r.")
240 if QuestHelper_Pref.share then
241 self:EnableSharing()
242 self:TextOut("Objective sharing has been re|cff00ff00enabled|r.")
247 function QuestHelper:ToggleComm()
248 if QuestHelper_Pref.comm then
249 QuestHelper_Pref.comm = false
250 self:TextOut("Communication display has been |cffff0000disabled|r.")
251 else
252 QuestHelper_Pref.comm = true
253 self:TextOut("Communication display has been |cff00ff00enabled|r.")
257 function QuestHelper:ToggleAnts()
258 if QuestHelper_Pref.show_ants then
259 QuestHelper_Pref.show_ants = false
260 self:TextOut("Ant trails have been |cffff0000disabled|r.")
261 else
262 QuestHelper_Pref.show_ants = true
263 self:TextOut("Ant trails have been |cff00ff00enabled|r.")
267 function QuestHelper:LevelOffset(offset)
268 local level = tonumber(offset)
269 if level then
270 if level > 0 then
271 self:TextOut("Allowing quests up to "..self:HighlightText(level).." level"..(level==1 and " " or "s ")..self:HighlightText("above").." you.")
272 elseif level < 0 then
273 self:TextOut("Only allowing quests "..self:HighlightText(-level).." level"..(level==-1 and " " or "s ")..self:HighlightText("below").." you.")
274 else
275 self:TextOut("Only allowing quests "..self:HighlightText("at or below").." your current level.")
278 if not QuestHelper_Pref.filter_level then
279 self:TextOut("Note: This won't have any effect until you turn the level filter on.")
282 if QuestHelper_Pref.level ~= level then
283 QuestHelper_Pref.level = level
284 self.defered_quest_scan = true
286 elseif offset == "" then
287 if QuestHelper_Pref.level <= 0 then
288 self:TextOut("Level offset is currently set to "..self:HighlightText(QuestHelper_Pref.level)..".")
289 else
290 self:TextOut("Level offset is currently set to "..self:HighlightText("+"..QuestHelper_Pref.level)..".")
293 if self.party_levels then for n, l in ipairs(self.party_levels) do
294 self:TextOut("Your effective level in a "..self:HighlightText(n).." player quest is "..self:HighlightText(string.format("%.1f", l))..".")
295 end end
297 if QuestHelper_Pref.solo then
298 self:TextOut("Peers aren't considered in your effective level, because you're playing solo.")
300 else
301 self:TextOut("Expected a level offset.")
305 function QuestHelper:Filter(input)
306 input = string.upper(input)
307 if input == "ZONE" then
308 QuestHelper_Pref.filter_zone = not QuestHelper_Pref.filter_zone
309 self:TextOut("Filter "..self:HighlightText("zone").." set to "..self:HighlightText(QuestHelper_Pref.filter_zone and "active" or "inactive")..".")
310 elseif input == "DONE" then
311 QuestHelper_Pref.filter_done = not QuestHelper_Pref.filter_done
312 self:TextOut("Filter "..self:HighlightText("done").." set to "..self:HighlightText(QuestHelper_Pref.filter_done and "active" or "inactive")..".")
313 elseif input == "LEVEL" then
314 QuestHelper_Pref.filter_level = not QuestHelper_Pref.filter_level
315 self:TextOut("Filter "..self:HighlightText("level").." set to "..self:HighlightText(QuestHelper_Pref.filter_level and "active" or "inactive")..".")
316 elseif input == "BLOCKED" or input == "BLOCK" then
317 QuestHelper_Pref.filter_blocked = not QuestHelper_Pref.filter_blocked
318 self:TextOut("Filter "..self:HighlightText("blocked").." set to "..self:HighlightText(QuestHelper_Pref.filter_blocked and "active" or "inactive")..".")
319 elseif input == "WATCHED" or input == "WATCH" then
320 QuestHelper_Pref.filter_watched = not QuestHelper_Pref.filter_watched
321 self:TextOut("Filter "..self:HighlightText("watched").." set to "..self:HighlightText(QuestHelper_Pref.filter_watched and "active" or "inactive")..".")
322 elseif input == "" then
323 self:TextOut("Filter "..self:HighlightText("zone")..": "..self:HighlightText(QuestHelper_Pref.filter_zone and "active" or "inactive"))
324 self:TextOut("Filter "..self:HighlightText("level")..": "..self:HighlightText(QuestHelper_Pref.filter_level and "active" or "inactive"))
325 self:TextOut("Filter "..self:HighlightText("done")..": "..self:HighlightText(QuestHelper_Pref.filter_done and "active" or "inactive"))
326 self:TextOut("Filter "..self:HighlightText("blocked")..": "..self:HighlightText(QuestHelper_Pref.filter_blocked and "active" or "inactive"))
327 self:TextOut("Filter "..self:HighlightText("watched")..": "..self:HighlightText(QuestHelper_Pref.filter_watched and "active" or "inactive"))
328 else
329 self:TextOut("Don't know what you want filtered, expect "..self:HighlightText("zone")..", "..self:HighlightText("done")..", "..self:HighlightText("level")..", or "..self:HighlightText("blocked")..".")
333 function QuestHelper:ToggleCartWP()
334 QuestHelper_Pref.cart_wp = not QuestHelper_Pref.cart_wp
335 if QuestHelper_Pref.cart_wp then
336 self:EnableCartographer()
337 if Cartographer_Waypoints then
338 if Waypoint and Waypoint.prototype then
339 self:TextOut("Would use "..self:HightlightText("Cartographer Waypoints").." to show objectives, but another mod is interfering with it.")
340 else
341 self:TextOut("Will use "..self:HighlightText("Cartographer Waypoints").." to show objectives.")
343 else
344 self:TextOut("Would use "..self:HighlightText("Cartographer Waypoints").." to show objectives, except it doesn't seem to be present.")
346 else
347 self:DisableCartographer()
348 self:TextOut("Won't use "..self:HighlightText("Cartographer Waypoints").." to show objectives.")
352 function QuestHelper:ToggleTomTomWP()
353 QuestHelper_Pref.tomtom_wp = not QuestHelper_Pref.tomtom_wp
354 if QuestHelper_Pref.tomtom_wp then
355 self:EnableTomTom()
356 if TomTom then
357 self:TextOut("Will use "..self:HighlightText("TomTom").." to show objectives.")
358 else
359 self:TextOut("Would use "..self:HighlightText("TomTom").." to show objectives, except it doesn't seem to be present.")
361 else
362 self:DisableTomTom()
363 self:TextOut("Won't use "..self:HighlightText("TomTom").." to show objectives.")
367 function QuestHelper:WantPathingReset()
368 self:TextOut("Will reset world graph.")
369 self.defered_graph_reset = true
372 function QuestHelper:PrintVersion()
373 self:TextOut("Version: "..self:HighlightText(GetAddOnMetadata("QuestHelper", "Version") or "Unknown"))
376 local function RecycleStatusString(fmt, usedcount, freetable, usedtable)
377 local freetablecount = QuestHelper:TableSize(freetable)
378 if usedtable then
379 local usedtablecount = QuestHelper:TableSize(usedtable)
380 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)
381 else
382 return string.format(fmt, QuestHelper:ProgressString(string.format("%d/%d", usedcount, usedcount+freetablecount), ((usedcount+freetablecount == 0) and 1) or (1-usedcount/(usedcount+freetablecount))))
386 function QuestHelper:Top(cmd)
388 if cmd and string.find(cmd, "boot") then
389 local bootv = {}
390 for k, v in pairs(QuestHelper_Loadtime) do
391 table.insert(bootv, {time = v, file = k})
393 table.sort(bootv, function (a, b) return a.time < b.time end)
395 local boott = {}
396 for i = 1, #bootv - 1 do
397 table.insert(boott, {time = bootv[i + 1].time - bootv[i].time, file = bootv[i].file})
399 table.sort(boott, function(a, b) return a.time < b.time end)
401 for _, v in pairs(boott) do
402 QuestHelper:TextOut(string.format("%s: %f", v.file, v.time))
404 QuestHelper:TextOut(string.format("%s: shrug", bootv[#bootv].file))
407 if cmd and string.find(cmd, "recycle") then
408 self:DumpTableTypeFrequencies()
409 self:TextOut(RecycleStatusString("Using %s lua tables.", self.used_tables, self.free_tables, self.recycle_tabletyping))
410 self:TextOut(RecycleStatusString("Using %s texture objects.", self.used_textures, self.free_textures))
411 self:TextOut(RecycleStatusString("Using %s font objects.", self.used_text, self.free_text))
412 self:TextOut(RecycleStatusString("Using %s frame objects.", self.used_frames, self.free_frames))
415 if cmd and string.find(cmd, "usage") then
416 self:DumpTableTypeFrequencies()
419 if cmd and string.find(cmd, "cache") then
420 self:DumpCacheData()
423 if cmd and string.find(cmd, "perf") then
424 QH_Timeslice_DumpPerf()
427 UpdateAddOnMemoryUsage()
428 self:TextOut(string.format("QuestHelper is using %dkb of RAM (%s/%s/%s/%s).", GetAddOnMemoryUsage("QuestHelper"), QuestHelper_local_version, QuestHelper_toc_version, GetBuildInfo(), GetLocale()))
431 function QuestHelper:ToggleMapButton()
432 QuestHelper_Pref.map_button = not QuestHelper_Pref.map_button
434 if QuestHelper_Pref.map_button then
435 QuestHelper:InitMapButton()
436 self:TextOut("Map button has been |cff00ff00enabled|r.")
437 else
438 QuestHelper:HideMapButton()
439 self:TextOut("Map button has been |cffff0000disabled|r. Use '/qh button' to restore it.")
443 function QuestHelper:ChangeLog()
444 self:ShowText(QuestHelper_ChangeLog, string.format("QuestHelper %s ChangeLog", QuestHelper_Version))
447 function QuestHelper:Submit()
448 self:ShowText([[
449 |TInterface\AddOns\QuestHelper\Art\Upload.tga:100:300|t
450 Your data can't be submitted automatically, since AddOns can't interact with anything outside of World of Warcraft.
452 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.
454 World of Warcraft stores QuestHelper's data in a file named |cff40bbffQuestHelper.lua|r.
456 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.
458 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.
460 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.
462 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.
464 After you find |cff40bbffQuestHelper.lua|r, you can email it to me here: |cff40bbffqhaddon@gmail.com|r
465 ]], "How To Submit Your Data")
468 function QuestHelper:ShowError()
469 QuestHelper_ErrorCatcher_ReportError()
472 local commands
474 function QuestHelper:Help(argument)
475 local text = ""
476 local argument = argument and argument:upper() or ""
478 for i1, cat in ipairs(commands) do
479 text = string.format("%s|cffffff00%s|r\n\n", text, cat[1])
480 for i, data in ipairs(cat[2]) do
481 if data[1]:find(argument, 1, true) then
482 text = string.format("%s |cffff8000%s|r %s\n", text, data[1], data[2])
484 if #data[3] > 0 then
485 text = string.format("%s\n %s\n", text, #data[3] == 1 and "Example:" or "Examples:")
486 for i, pair in ipairs(data[3]) do
487 text = string.format("%s |cff40bbff%s|r\n %s\n", text, pair[1], pair[2])
491 text = text .. "\n"
494 text = text .. "\n\n"
497 self:ShowText(text == "" and ("No commands containing '"..argument.."'") or text, "QuestHelper Slash Commands")
500 function QuestHelper:Donate(argument)
501 local text = ""
502 local argument = argument and argument:upper() or ""
504 for i1, cat in ipairs(commands) do
505 text = string.format("%s|cffffff00%s|r\n\n", text, cat[1])
506 for i, data in ipairs(cat[2]) do
507 if data[1]:find(argument, 1, true) then
508 text = string.format("%s |cffff8000%s|r %s\n", text, data[1], data[2])
510 if #data[3] > 0 then
511 text = string.format("%s\n %s\n", text, #data[3] == 1 and "Example:" or "Examples:")
512 for i, pair in ipairs(data[3]) do
513 text = string.format("%s |cff40bbff%s|r\n %s\n", text, pair[1], pair[2])
517 text = text .. "\n"
520 text = text .. "\n\n"
523 self:ShowText([[
524 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.
526 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:
528 |cff40bbffFlying mount support for both Northrend and Outland|r
530 |cff40bbffAchievementHelper, built right into QuestHelper|r
532 |cff40bbffPaths that lead you around obstacles instead of through them|r
534 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!
536 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.
538 Thanks!]], "Please Donate!", 500, 20, 10)
541 commands =
543 { "Common commands", {
544 {"HIDDEN",
545 "Compiles a list of objectives that QuestHelper is hiding from you. Depending on the reason, you can also unhide the objective.",
546 {}, QuestHelper.ShowHidden, QuestHelper},
548 {"HIDE",
549 "Hides QuestHelper's modifications to the minimap and world map, and pauses routing calculations.",
550 {}, QuestHelper.ToggleHide, QuestHelper},
552 {"CARTWP",
553 "Toggles displaying the current objective using Cartographer Waypoints (must be installed separately).",
554 {}, QuestHelper.ToggleCartWP, QuestHelper},
556 {"TOMTOM",
557 "Toggles displaying the current objective using TomTom (must be installed separately).",
558 {}, QuestHelper.ToggleTomTomWP, QuestHelper},
560 {"FIND",
561 "Search for an item, location, or npc.",
562 {{"/qh find item rune of teleport", "Finds a reagent vendor."},
563 {"/qh find npc bragok", "Finds the Ratchet flight point."},
564 {"/qh find loc stormwind 50 60", "Finds the Stormwind auction house."},
565 {"/qh find loc 50 50", "Finds the center of the zone you're in."},
566 {"/qh find something", "Searches for something in all categories."},
567 {"/qh find", "Lists objectives you manually created so that you can remove them."}}, QuestHelper.PerformSearch, QuestHelper},
569 {"SOLO",
570 "Toggles solo mode. When enabled, assumes your party members don't exist. Objective sharing with party members will also be disabled.",
571 {}, QuestHelper.ToggleSolo, QuestHelper},
574 { "Objective filtering", {
575 {"FILTER",
576 "Automatically ignores/unignores objectives based on criteria.",
577 {{"/qh filter zone", "Toggle showing objectives outside the current zone"},
578 {"/qh filter done", "Toggle showing objectives for uncompleted quests."},
579 {"/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."},
580 {"/qh filter blocked", "Toggle showing blocked objectives, such as quest turn-ins for incomplete quests."},
581 {"/qh filter watched", "Toggle limiting to objectives watched in the Quest Log"}
582 }, QuestHelper.Filter, QuestHelper},
584 {"LEVEL",
585 "Adjusts the level offset used by the level filter. Naturally, the level filter must be turned on to have an effect.",
586 {{"/qh level", "See information related to the level filter."},
587 {"/qh level 0", "Only allow objectives at or below your current level."},
588 {"/qh level +2", "Allow objectives up to two levels above your current level."},
589 {"/qh level -1", "Only allow objectives below your current level."}}, QuestHelper.LevelOffset, QuestHelper},
591 {"SCALE",
592 "Scales the map icons used by QuestHelper. Will accept values between 50% and 300%.",
593 {{"/qh scale 1", "Uses the default icon size."},
594 {"/qh scale 2", "Makes icons twice their default size."},
595 {"/qh scale 80%", "Makes icons slightly smaller than their default size."}},
596 QuestHelper.genericSetScale, QuestHelper, "scale", "icon scale", .5, 3},
598 {"SHARE",
599 "Toggles objective sharing between QuestHelper users.",
600 {}, QuestHelper.ToggleShare, QuestHelper},
603 { "Interface", {
604 {"TRACK",
605 "Toggles the visibility of the QuestHelper's replacement quest tracker.",
606 {}, QuestHelper.ToggleTrack, QuestHelper},
608 {"TSCALE",
609 "Scales the quest tracker provided by QuestHelper. Will accept values between 50% and 300%.",
611 QuestHelper.TrackerScale, QuestHelper},
613 {"TLEVEL",
614 "Toggles display of levels in the quest tracker provided by QuestHelper.",
615 {}, QuestHelper.ToggleTrackLevel, QuestHelper},
617 {"TQCOL",
618 "Toggles display of colours for the difficulty level of quests in the quest tracker provided by QuestHelper.",
619 {}, QuestHelper.ToggleTrackQColour, QuestHelper},
621 {"TOCOL",
622 "Toggles display of colours for objective progress in the quest tracker provided by QuestHelper.",
623 {}, QuestHelper.ToggleTrackOColour, QuestHelper},
625 {"TRESET",
626 "Reset's the position of the quest tracker provided by QuestHelper, in cause you move it somewhere inaccessable.",
627 {{"/qh treset center", "Resets to the center of the screen, instead of a more normal quest tracker location."}}, QuestHelper.ResetTrackerPosition, QuestHelper},
629 {"TOOLTIP",
630 "Toggles appending information about tracked items and NPCs to their tooltips.",
631 {}, QuestHelper.ToggleTooltip, QuestHelper},
633 {"FTIME",
634 "Toggles display of flight time estimates.", {}, QuestHelper.ToggleFlightTimes, QuestHelper},
636 {"ANTS",
637 "Toggles the display of trails on the world map on and off.",
638 {}, QuestHelper.ToggleAnts, QuestHelper},
640 {"LOCALE",
641 "Select the locale to use for displayed messages.",
642 {}, QuestHelper.SetLocale, QuestHelper},
644 {"BUTTON",
645 "Toggles the display of QuestHelper's button on the world map.",
646 {}, QuestHelper.ToggleMapButton, QuestHelper},
648 {"SETTINGS",
649 "Opens the Settings menu at the current cursor location. Note that not all settings can be changed through the menu.",
650 {}, QuestHelper.DoSettingsMenu, QuestHelper},
653 { "Data collection", {
654 {"SUBMIT",
655 "Displays instructions for submitting your collected data.",
656 {}, QuestHelper.Submit, QuestHelper},
658 {"NAG",
659 "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.",
660 {{"/qh nag verbose", "Prints the specific changes that were found."}}, QuestHelper.Nag, QuestHelper},
662 {"PURGE",
663 "Deletes all QuestHelper's collected data.", {}, QuestHelper.Purge, QuestHelper},
665 {"HARDRESET",
666 "Deletes all QuestHelper's collected data and resets QuestHelper preferences.", {}, QuestHelper.HardReset, QuestHelper},
669 { "Performance and debug", {
670 {"PERF",
671 "Sets or shows the route workload. Higher means more agressive route updating, lower means better performance Accepts numbers between 10% and 500%.",
672 {{"/qh perf", "Show current Performance Factor"},
673 {"/qh perf 1", "Sets standard performance"},
674 {"/qh perf 50%", "Does half as much background processing"},
675 {"/qh perf 3", "Computes routes 3 times more aggressively. Better have some good horsepower!"}},
676 QuestHelper.genericSetScale, QuestHelper, "perf_scale", "performance factor", .01, 5},
678 {"TOP",
679 "Displays various performance stats on QuestHelper.",
681 {"/qh top recycle", "Displays detailed information on QuestHelper's recycled item pools"},
682 {"/qh top usage", "Displays detailed information on which table types are most common"},
683 {"/qh top cache", "Displays detailed information on the internal distance cache"},
684 {"/qh top perf", "Displays detailed information on coroutine CPU usage"},
685 }, QuestHelper.Top, QuestHelper},
687 {"ERROR",
688 "Displays the first QuestHelper error that has been generated this session in a form which can be copied out of WoW.",
689 {}, QuestHelper.ShowError, QuestHelper},
691 {"POS",
692 "Prints the player's current position. Exists mainly for my own personal convenience.",
693 {}, function (qh) qh:TextOut(qh:LocationString(qh.i, qh.x, qh.y) .. " " .. qh:LocationStringRaw(qh:RetrieveRawLocation())) end, QuestHelper},
695 {"COMM",
696 "Toggles showing of the communication between QuestHelper users. Exists mainly for my own personal convenience.",
697 {}, QuestHelper.ToggleComm, QuestHelper},
699 {"RECALC",
700 "Recalculates the world graph and locations for any active objectives. Should not be necessary.", {}, QuestHelper.WantPathingReset, QuestHelper},
703 { "Help", {
704 {"HELP",
705 "Displays a list of help commands. Listed commands are filtered by the passed string.",
706 {}, QuestHelper.Help, QuestHelper},
708 {"VERSION",
709 "Displays QuestHelper's version.", {}, QuestHelper.PrintVersion, QuestHelper},
711 {"CHANGES",
712 "Displays a summary of changes recently made to QuestHelper.",
713 {}, QuestHelper.ChangeLog, QuestHelper},
715 {"DONATE",
716 "Displays some instructions and a link for donating.",
717 {}, QuestHelper.Donate, QuestHelper},
721 function QuestHelper_SlashCommand(input)
722 local _, _, command, argument = string.find(input, "^%s*([^%s]-)%s+(.-)%s*$")
723 if not command then
724 command, argument = input, ""
727 command = string.upper(command)
729 for i1, cat in ipairs(commands) do
730 for i, data in ipairs(cat[2]) do
731 if data[1] == command then
732 local st = {}
734 for i = 5,#data do table.insert(st, data[i]) end
735 table.insert(st, argument)
737 if type(data[4]) == "function" then
738 data[4](unpack(st))
739 else
740 QuestHelper:TextOut(data[1].." is not yet implemented.")
743 return
748 QuestHelper:Help()
751 SLASH_QuestHelper1 = "/qh"
752 SLASH_QuestHelper2 = "/questhelper"
753 SlashCmdList["QuestHelper"] = function (text) QuestHelper_SlashCommand(text) end