Updated translations.
[QuestHelper.git] / help.lua
blob510ff1bf06bc33adaa236d0e75325e427fde7557
1 QuestHelper_File["help.lua"] = "Development Version"
3 function QuestHelper:scaleString(val)
4 return self:HighlightText(math.floor(val*100+0.5).."%")
5 end
7 function QuestHelper:genericSetScale(varname, name, mn, mx, input, onchange, ...)
8 if input == "" then
9 self:TextOut(string.format("Current %s scale is %s.", name, self:scaleString(QuestHelper_Pref[varname])))
10 else
11 local scale = tonumber(input)
13 if not scale then
14 local x = string.match(input or "", "^%s*([%d%.]+)%s*%%%s*$")
15 scale = tonumber(x) or 0
16 if not scale then
17 self:TextOut("I don't know how to interpret your input.")
18 return
19 end
20 scale = scale * 0.01
21 end
23 if scale < mn then
24 self:TextOut(string.format("I won't accept a scale less than %s.", self:scaleString(mn)))
25 elseif scale > mx then
26 self:TextOut(string.format("I won't accept a scale more than %s.", self:scaleString(mx)))
27 else
28 QuestHelper_Pref[varname] = scale
29 self:TextOut(string.format("Set %s scale set to %s.", name, self:scaleString(scale)))
30 if onchange then
31 onchange(...)
32 end
33 end
34 end
35 end
37 function QuestHelper:TrackerScale(scale)
38 QuestHelper:genericSetScale("track_scale", "tracker scale", .5, 2, scale,
39 function() QuestHelper.tracker:SetScale(QuestHelper_Pref.track_scale) end)
40 end
42 function QuestHelper:SetLocale(loc)
43 if not loc or loc == "" then
44 self:TextOut(QHText("LOCALE_LIST_BEGIN"))
45 for loc, tbl in pairs(QuestHelper_Translations) do
46 self:TextOut(string.format(" %s%s %s", self:HighlightText(loc),
47 loc == QuestHelper_Pref.locale and " *" or " ",
48 tbl.LOCALE_NAME or "???"))
49 end
50 else
51 for l, tbl in pairs(QuestHelper_Translations) do
52 if string.find(string.lower(l), "^"..string.lower(loc)) or
53 string.find(string.lower(tbl.LOCALE_NAME or ""), "^"..string.lower(loc)) then
54 QuestHelper_Pref.locale = l
55 QHFormatSetLocale(l)
56 self:SetLocaleFonts()
57 self:TextOut(QHFormat("LOCALE_CHANGED", l))
58 return
59 end
60 end
62 self:TextOut(QHFormat("LOCALE_UNKNOWN", tostring(loc) or "UNKNOWN"))
63 end
64 end
66 function QuestHelper:ToggleHide()
67 local current_objective = self.minimap_dodad.objective
69 QuestHelper_Pref.hide = not QuestHelper_Pref.hide
71 -- Desaturate the button texture if QuestHelper is disabled.
72 if self.MapButton then
73 -- This should always be true, but just in case...
74 self.MapButton:GetNormalTexture():SetDesaturated(QuestHelper_Pref.hide)
75 end
77 if QuestHelper_Pref.hide then
78 if QuestHelper_Pref.track then
79 self:HideTracker()
80 end
82 self.map_overlay:Hide()
83 self.minimap_dodad:SetObjective(nil)
84 self.minimap_dodad.objective = current_objective
85 self:TextOut("QuestHelper is now |cffff0000hidden|r.")
86 else
87 if QuestHelper_Pref.track then
88 self:ShowTracker()
89 end
91 self.map_overlay:Show()
92 self.minimap_dodad.objective = nil
93 self.minimap_dodad:SetObjective(current_objective)
94 self:TextOut("QuestHelper is now |cff00ff00shown|r.")
95 -- WoW Will lockup inside ForceRouteUpdate, and so the UPDATING_ROUTE message won't appear until afterwards, making
96 -- this message kind of redundant.
97 -- self:TextOut(QHText("UPDATING_ROUTE"))
98 self:ForceRouteUpdate(4) -- Let the corutine do some overtime...
99 end
102 function QuestHelper:ToggleShare()
103 QuestHelper_Pref.share = not QuestHelper_Pref.share
104 if QuestHelper_Pref.share then
105 if QuestHelper_Pref.solo then
106 self:TextOut("Objective sharing will been |cff00ff00enabled|r when you disable solo mode.")
107 else
108 self:TextOut("Objective sharing has been |cff00ff00enabled|r.")
109 self:EnableSharing()
111 else
112 self:TextOut("Objective sharing has been |cffff0000disabled|r.")
113 if QuestHelper_Pref.solo then
114 self:TextOut("Objective sharing won't be reenabled when you disable solo mode.")
115 else
116 self:DisableSharing()
121 function QuestHelper:ToggleFlightTimes()
122 QuestHelper_Pref.flight_time = not QuestHelper_Pref.flight_time
123 if QuestHelper_Pref.flight_time then
124 self:TextOut("The flight timer has been |cff00ff00enabled|r.")
125 else
126 self:TextOut("The flight timer has been |cffff0000disabled|r.")
130 function QuestHelper:ToggleTrack()
131 QuestHelper_Pref.track = not QuestHelper_Pref.track
132 if QuestHelper_Pref.track then
133 self:ShowTracker()
134 self:TextOut("The quest tracker has been |cff00ff00enabled|r.")
135 else
136 self:HideTracker()
137 self:TextOut("The quest tracker has been |cffff0000disabled|r.")
141 function QuestHelper:ToggleTrackLevel()
142 QuestHelper_Pref.track_level = not QuestHelper_Pref.track_level
143 if QuestHelper_Pref.track_level then
144 self:TextOut("Display of levels in the quest tracker has been |cff00ff00enabled|r.")
145 else
146 self:TextOut("Display of levels in the quest tracker has been |cffff0000disabled|r.")
148 self.tracker:reset()
151 function QuestHelper:ToggleTrackQColour()
152 QuestHelper_Pref.track_qcolour = not QuestHelper_Pref.track_qcolour
153 if QuestHelper_Pref.track_qcolour then
154 self:TextOut("Colour for quest difficulty in quest tracker has been |cff00ff00enabled|r.")
155 else
156 self:TextOut("Colour for quest difficulty in quest tracker has been |cffff0000disabled|r.")
158 self.tracker:reset()
161 function QuestHelper:ToggleTrackOColour()
162 QuestHelper_Pref.track_ocolour = not QuestHelper_Pref.track_ocolour
163 if QuestHelper_Pref.track_ocolour then
164 self:TextOut("Colour for objective progress in quest tracker has been |cff00ff00enabled|r.")
165 else
166 self:TextOut("Colour for objective progress in quest tracker has been |cffff0000disabled|r.")
168 self.tracker:reset()
171 function QuestHelper:ToggleTooltip()
172 QuestHelper_Pref.tooltip = not QuestHelper_Pref.tooltip
173 if QuestHelper_Pref.tooltip then
174 self:TextOut("Objectuve tooltip information has been |cff00ff00enabled|r.")
175 else
176 self:TextOut("Objectuve tooltip information has been |cffff0000disabled|r.")
180 function QuestHelper:Purge(code)
181 if code == self.purge_code then
182 QuestHelper_Quests = {}
183 QuestHelper_Objectives = {}
184 QuestHelper_FlightInstructors = {}
185 QuestHelper_FlightRoutes = {}
186 QuestHelper_Locale = GetLocale()
187 QuestHelper_UID = self:CreateUID()
188 ReloadUI()
189 else
190 if not self.purge_code then self.purge_code = self:CreateUID(8) end
191 QuestHelper:TextOut("THIS COMMAND WILL DELETE ALL YOUR COLLECTED DATA")
192 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.")
193 QuestHelper:TextOut("Enter "..self:HighlightText("/qh nag verbose").." to check and see if you're destroying anything important.")
194 QuestHelper:TextOut("See the "..self:HighlightText("How You Can Help").." section on the project website for instructions.")
195 QuestHelper:TextOut("If you're sure you want to go through with this, enter: "..self:HighlightText("/qh purge "..self.purge_code))
199 function QuestHelper:ToggleSolo()
200 QuestHelper_Pref.solo = not QuestHelper_Pref.solo
201 if QuestHelper_Pref.solo then
202 if QuestHelper_Pref.share then
203 self:DisableSharing()
204 self:TextOut("Objective sharing has been temporarly |cffff0000disabled|r.")
206 self:TextOut("Solo mode has been |cff00ff00enabled|r.")
207 else
208 self:TextOut("Solo mode has been |cffff0000disabled|r.")
209 if QuestHelper_Pref.share then
210 self:EnableSharing()
211 self:TextOut("Objective sharing has been re|cff00ff00enabled|r.")
216 function QuestHelper:ToggleComm()
217 if QuestHelper_Pref.comm then
218 QuestHelper_Pref.comm = false
219 self:TextOut("Communication display has been |cffff0000disabled|r.")
220 else
221 QuestHelper_Pref.comm = true
222 self:TextOut("Communication display has been |cff00ff00enabled|r.")
226 function QuestHelper:ToggleAnts()
227 if QuestHelper_Pref.show_ants then
228 QuestHelper_Pref.show_ants = false
229 self:TextOut("Ant trails have been |cffff0000disabled|r.")
230 else
231 QuestHelper_Pref.show_ants = true
232 self:TextOut("Ant trails have been |cff00ff00enabled|r.")
236 function QuestHelper:LevelOffset(offset)
237 local level = tonumber(offset)
238 if level then
239 if level > 0 then
240 self:TextOut("Allowing quests up to "..self:HighlightText(level).." level"..(level==1 and " " or "s ")..self:HighlightText("above").." you.")
241 elseif level < 0 then
242 self:TextOut("Only allowing quests "..self:HighlightText(-level).." level"..(level==-1 and " " or "s ")..self:HighlightText("below").." you.")
243 else
244 self:TextOut("Only allowing quests "..self:HighlightText("at or below").." your current level.")
247 if not QuestHelper_Pref.filter_level then
248 self:TextOut("Note: This won't have any effect until you turn the level filter on.")
251 if QuestHelper_Pref.level ~= level then
252 QuestHelper_Pref.level = level
253 self.defered_quest_scan = true
255 elseif offset == "" then
256 if QuestHelper_Pref.level <= 0 then
257 self:TextOut("Level offset is currently set to "..self:HighlightText(QuestHelper_Pref.level)..".")
258 else
259 self:TextOut("Level offset is currently set to "..self:HighlightText("+"..QuestHelper_Pref.level)..".")
262 if self.party_levels then for n, l in ipairs(self.party_levels) do
263 self:TextOut("Your effective level in a "..self:HighlightText(n).." player quest is "..self:HighlightText(string.format("%.1f", l))..".")
264 end end
266 if QuestHelper_Pref.solo then
267 self:TextOut("Peers aren't considered in your effective level, because you're playing solo.")
269 else
270 self:TextOut("Expected a level offset.")
274 function QuestHelper:Filter(input)
275 input = string.upper(input)
276 if input == "ZONE" then
277 QuestHelper_Pref.filter_zone = not QuestHelper_Pref.filter_zone
278 self:TextOut("Filter "..self:HighlightText("zone").." set to "..self:HighlightText(QuestHelper_Pref.filter_zone and "active" or "inactive")..".")
279 elseif input == "DONE" then
280 QuestHelper_Pref.filter_done = not QuestHelper_Pref.filter_done
281 self:TextOut("Filter "..self:HighlightText("done").." set to "..self:HighlightText(QuestHelper_Pref.filter_done and "active" or "inactive")..".")
282 elseif input == "LEVEL" then
283 QuestHelper_Pref.filter_level = not QuestHelper_Pref.filter_level
284 self:TextOut("Filter "..self:HighlightText("level").." set to "..self:HighlightText(QuestHelper_Pref.filter_level and "active" or "inactive")..".")
285 elseif input == "BLOCKED" or input == "BLOCK" then
286 QuestHelper_Pref.filter_blocked = not QuestHelper_Pref.filter_blocked
287 self:TextOut("Filter "..self:HighlightText("blocked").." set to "..self:HighlightText(QuestHelper_Pref.filter_blocked and "active" or "inactive")..".")
288 elseif input == "" then
289 self:TextOut("Filter "..self:HighlightText("zone")..": "..self:HighlightText(QuestHelper_Pref.filter_zone and "active" or "inactive"))
290 self:TextOut("Filter "..self:HighlightText("level")..": "..self:HighlightText(QuestHelper_Pref.filter_level and "active" or "inactive"))
291 self:TextOut("Filter "..self:HighlightText("done")..": "..self:HighlightText(QuestHelper_Pref.filter_done and "active" or "inactive"))
292 self:TextOut("Filter "..self:HighlightText("blocked")..": "..self:HighlightText(QuestHelper_Pref.filter_blocked and "active" or "inactive"))
293 else
294 self:TextOut("Don't know what you want filtered, expect "..self:HighlightText("zone")..", "..self:HighlightText("done")..", "..self:HighlightText("level")..", or "..self:HighlightText("blocked")..".")
298 function QuestHelper:ToggleCartWP()
299 QuestHelper_Pref.cart_wp = not QuestHelper_Pref.cart_wp
300 if QuestHelper_Pref.cart_wp then
301 self:EnableCartographer()
302 if Cartographer_Waypoints then
303 if Waypoint and Waypoint.prototype then
304 self:TextOut("Would use "..self:HightlightText("Cartographer Waypoints").." to show objectives, but another mod is interfering with it.")
305 else
306 self:TextOut("Will use "..self:HighlightText("Cartographer Waypoints").." to show objectives.")
308 else
309 self:TextOut("Would use "..self:HighlightText("Cartographer Waypoints").." to show objectives, except it doesn't seem to be present.")
311 else
312 self:DisableCartographer()
313 self:TextOut("Won't use "..self:HighlightText("Cartographer Waypoints").." to show objectives.")
317 function QuestHelper:ToggleTomTomWP()
318 QuestHelper_Pref.tomtom_wp = not QuestHelper_Pref.tomtom_wp
319 if QuestHelper_Pref.tomtom_wp then
320 self:EnableTomTom()
321 if TomTom then
322 self:TextOut("Will use "..self:HighlightText("TomTom").." to show objectives.")
323 else
324 self:TextOut("Would use "..self:HighlightText("TomTom").." to show objectives, except it doesn't seem to be present.")
326 else
327 self:DisableTomTom()
328 self:TextOut("Won't use "..self:HighlightText("TomTom").." to show objectives.")
332 function QuestHelper:WantPathingReset()
333 self:TextOut("Will reset world graph.")
334 self.defered_graph_reset = true
337 function QuestHelper:PrintVersion()
338 self:TextOut("Version: "..self:HighlightText(GetAddOnMetadata("QuestHelper", "Version") or "Unknown"))
341 local function RecycleStatusString(fmt, used, free)
342 return string.format(fmt, QuestHelper:ProgressString(string.format("%d/%d", used, used+free), ((used+free == 0) and 1) or (1-used/(used+free))))
345 function QuestHelper:RecycleInfo()
346 self:TextOut(RecycleStatusString("Using %s lua tables.", self.used_tables, #self.free_tables))
347 self:TextOut(RecycleStatusString("Using %s texture objects.", self.used_textures, #self.free_textures))
348 self:TextOut(RecycleStatusString("Using %s font objects.", self.used_text, #self.free_text))
349 self:TextOut(RecycleStatusString("Using %s frame objects.", self.used_frames, #self.free_frames))
352 function QuestHelper:ToggleMapButton()
353 QuestHelper_Pref.map_button = not QuestHelper_Pref.map_button
355 if QuestHelper_Pref.map_button then
356 QuestHelper:InitMapButton()
357 self:TextOut("Map button has been |cff00ff00enabled|r.")
358 else
359 QuestHelper:HideMapButton()
360 self:TextOut("Map button has been |cffff0000disabled|r. Use '/qh button' to restore it.")
364 function QuestHelper:ChangeLog()
365 self:ShowText(QuestHelper_ChangeLog, string.format("QuestHelper %s ChangeLog", QuestHelper_Version))
368 function QuestHelper:Submit()
369 self:ShowText([[
370 |TInterface\AddOns\QuestHelper\Art\Upload.tga:100:300|t
371 Your data can't be submitted automatically, since AddOns can't interact with anything outside of World of Warcraft.
373 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.
375 World of Warcraft stores QuestHelper's data in a file named |cff40bbffQuestHelper.lua|r.
377 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.
379 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.
381 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.
383 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.
385 After you find |cff40bbffQuestHelper.lua|r, you can email it to me here: |cff40bbffqhaddon@gmail.com|r
386 ]], "How To Submit Your Data")
389 local commands
391 function QuestHelper:Help(argument)
392 local text = ""
393 local argument = argument and argument:upper() or ""
395 for i, data in ipairs(commands) do
396 if data[1]:find(argument, 1, true) then
397 text = string.format("%s|cffff8000%s|r %s\n", text, data[1], data[2])
399 if #data[3] > 0 then
400 text = string.format("%s\n %s\n", text, #data[3] == 1 and "Example:" or "Examples:")
401 for i, pair in ipairs(data[3]) do
402 text = string.format("%s |cff40bbff%s|r\n %s\n", text, pair[1], pair[2])
406 text = text .. "\n"
410 self:ShowText(text == "" and ("No commands containing '"..argument.."'") or text, "QuestHelper Slash Commands")
413 commands =
415 {"VERSION",
416 "Displays QuestHelper's version.", {}, QuestHelper.PrintVersion, QuestHelper},
418 {"RECALC",
419 "Recalculates the world graph and locations for any active objectives.", {}, QuestHelper.WantPathingReset, QuestHelper},
421 {"FTIME",
422 "Toggles display of flight time estimates.", {}, QuestHelper.ToggleFlightTimes, QuestHelper},
424 {"PURGE",
425 "Deletes all QuestHelper's collected data.", {}, QuestHelper.Purge, QuestHelper},
427 {"FILTER",
428 "Automatically ignores/unignores objectives based on criteria.",
429 {{"/qh filter zone", "Toggle showing objectives outside the current zone"},
430 {"/qh filter done", "Toggle showing objectives for uncompleted quests."},
431 {"/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."},
432 {"/qh filter blocked", "Toggle showing blocked objectives, such as quest turn-ins for incomplete quests."}}, QuestHelper.Filter, QuestHelper},
434 {"LEVEL",
435 "Adjusts the level offset used by the level filter. Naturally, the level filter must be turned on to have an effect.",
436 {{"/qh level", "See information related to the level filter."},
437 {"/qh level 0", "Only allow objectives at or below your current level."},
438 {"/qh level +2", "Allow objectives up to two levels above your current level."},
439 {"/qh level -1", "Only allow objectives below your current level."}}, QuestHelper.LevelOffset, QuestHelper},
441 {"SCALE",
442 "Scales the map icons used by QuestHelper. Will accept values between 50% and 300%.",
443 {{"/qh scale 1", "Uses the default icon size."},
444 {"/qh scale 2", "Makes icons twice their default size."},
445 {"/qh scale 80%", "Makes icons slightly smaller than their default size."}},
446 QuestHelper.genericSetScale, QuestHelper, "scale", "icon scale", .5, 3},
448 {"TOOLTIP",
449 "Toggles appending information about tracked items and NPCs to their tooltips.",
450 {}, QuestHelper.ToggleTooltip, QuestHelper},
452 {"TRACK",
453 "Toggles the visibility of the QuestHelper's replacement quest tracker.",
454 {}, QuestHelper.ToggleTrack, QuestHelper},
456 {"TSCALE",
457 "Scales the quest tracker provided by QuestHelper. Will accept values between 50% and 300%.",
459 QuestHelper.TrackerScale, QuestHelper},
461 {"TLEVEL",
462 "Toggles display of levels in the quest tracker provided by QuestHelper.",
463 {}, QuestHelper.ToggleTrackLevel, QuestHelper},
465 {"TQCOL",
466 "Toggles display of colours for the difficulty level of quests in the quest tracker provided by QuestHelper.",
467 {}, QuestHelper.ToggleTrackQColour, QuestHelper},
469 {"TOCOL",
470 "Toggles display of colours for objective progress in the quest tracker provided by QuestHelper.",
471 {}, QuestHelper.ToggleTrackOColour, QuestHelper},
473 {"TRESET",
474 "Reset's the position of the quest tracker provided by QuestHelper, in cause you move it somewhere inaccessable.",
475 {}, QuestHelper.ResetTrackerPosition, QuestHelper},
477 {"NAG",
478 "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.",
479 {{"/qh nag verbose", "Prints the specific changes that were found."}}, QuestHelper.Nag, QuestHelper},
481 {"POS",
482 "Prints the player's current position. Exists mainly for my own personal convenience.",
483 {}, function (qh) qh:TextOut(qh:LocationString(qh.i, qh.x, qh.y)) end, QuestHelper},
485 {"HIDDEN",
486 "Compiles a list of objectives that QuestHelper is hiding from you. Depending on the reason, you can also unhide the objective.",
487 {}, QuestHelper.ShowHidden, QuestHelper},
489 {"FIND",
490 "Search for an item, location, or npc.",
491 {{"/qh find item rune of teleport", "Finds a reagent vendor."},
492 {"/qh find npc bragok", "Finds the Ratchet flight point."},
493 {"/qh find loc stormwind 50 60", "Finds the Stormwind auction house."},
494 {"/qh find loc 50 50", "Finds the center of the zone you're in."},
495 {"/qh find something", "Searches for something in all categories."},
496 {"/qh find", "Lists objectives you manually created so that you can remove them."}}, QuestHelper.PerformSearch, QuestHelper},
498 {"COMM",
499 "Toggles showing of the communication between QuestHelper users. Exists mainly for my own personal convenience.",
500 {}, QuestHelper.ToggleComm, QuestHelper},
502 {"RECYCLE",
503 "Displays how many unused entities QuestHelper is tracking, so that it can reuse them in the future instead of creating new ones in the future.",
504 {}, QuestHelper.RecycleInfo, QuestHelper},
506 {"CARTWP",
507 "Toggles displaying the current objective using Cartographer Waypoints.",
508 {}, QuestHelper.ToggleCartWP, QuestHelper},
510 {"TOMTOM",
511 "Toggles displaying the current objective using TomTom.",
512 {}, QuestHelper.ToggleTomTomWP, QuestHelper},
514 {"SHARE",
515 "Toggles objective sharing between QuestHelper users.",
516 {}, QuestHelper.ToggleShare, QuestHelper},
518 {"SOLO",
519 "Toggles solo mode. When enabled, assumes your party members don't exist. Objective sharing with party members will also be disabled.",
520 {}, QuestHelper.ToggleSolo, QuestHelper},
522 {"HIDE",
523 "Hides QuestHelper's modifications to the minimap and world map, and pauses routing calculations.",
524 {}, QuestHelper.ToggleHide, QuestHelper},
526 {"ANTS",
527 "Toggles the display of trails on the world map on and off.",
528 {}, QuestHelper.ToggleAnts, QuestHelper},
530 {"LOCALE",
531 "Select the locale to use for displayed messages.",
532 {}, QuestHelper.SetLocale, QuestHelper},
534 {"PERF",
535 "Sets or shows the route workload. Higher means more agressive route updating, lower means better performance Accepts numbers between 10% and 500%.",
536 {{"/qh perf", "Show current Performance Factor"},
537 {"/qh perf 1", "Sets standard performance"},
538 {"/qh perf 50%", "Does half as much background processing"},
539 {"/qh perf 3", "Computes routes 3 times more aggressively. Better have some good horsepower!"}},
540 QuestHelper.genericSetScale, QuestHelper, "perf_scale", "performance factor", .1, 5},
542 {"BUTTON",
543 "Toggles the display of QuestHelper's button on the world map.",
544 {}, QuestHelper.ToggleMapButton, QuestHelper},
546 {"SETTINGS",
547 "Opens the Settings menu at the current cursor location. Note that not all settings can be changed through the menu.",
548 {}, QuestHelper.DoSettingsMenu, QuestHelper},
550 {"CHANGES",
551 "Displays a summary of changes recently made to QuestHelper. This is always displayed when an upgrade is detected.",
552 {}, QuestHelper.ChangeLog, QuestHelper},
554 {"SUBMIT",
555 "Displays instructions for submitting your collected data.",
556 {}, QuestHelper.Submit, QuestHelper},
558 {"HELP",
559 "Displays a list of help commands. Listed commands are filtered by the passed string.",
560 {}, QuestHelper.Help, QuestHelper}
563 function QuestHelper:SlashCommand(input)
564 local _, _, command, argument = string.find(input, "^%s*([^%s]-)%s+(.-)%s*$")
565 if not command then
566 command, argument = input, ""
569 command = string.upper(command)
571 for i, data in ipairs(commands) do
572 if data[1] == command then
573 local st = self:CreateTable()
575 for i = 5,#data do table.insert(st, data[i]) end
576 table.insert(st, argument)
578 if type(data[4]) == "function" then
579 data[4](unpack(st))
580 else
581 self:TextOut(data[1].." is not yet implemented.")
584 self:ReleaseTable(st)
585 return
589 self:Help()
592 SLASH_QuestHelper1 = "/qh"
593 SLASH_QuestHelper2 = "/questhelper"
594 SlashCmdList["QuestHelper"] = function (text) QuestHelper:SlashCommand(text) end