View/Edit #12:@addhelp-db @rmhelp-db

Switch to edit mode.

Name(s): @addhelp-db @rmhelp-db
1:  "Copied from Quadir (#9780):@addhelp-db Dec 21 19:29:20 1999"
2:  "This verb was made by Quadir (#9780)"
3:  {a, b} = {verb[2..4] == "add", valid(caller_perms())}
4:  if (b ? !caller_perms():controls(this) | caller != this)
5:    return b ? raise(E_PERM) | player:tell(E_PERM)
6:  elseif (!valid(dobj = player:match_object(dobjstr, dobj)))
7:    return b ? E_INVARG | $cmd_utils:object_match_failed(dobj, dobjstr)
8:  elseif (!b && a && !dobj:isa($help_db) && !$cmd_utils:yes_or_no(`dobj:title() ! ANY => tostr(dobj.name, " [Borked Title]")', " (", dobj, ") is not a child of the generic help database (#86), are you sure you want to continue?"))
9:    return
10: endif
11: title = tostr(`dobj:title() ! ANY => tostr(dobj.name, " [Borked Title]")', " (", dobj, ")")
12: help_db = this.help_db
13: help_db = `{{help_db}, 0, 0, help_db}[typeof(help_db)] ! E_RANGE => {}'
14: if (a && dobj in help_db)
15:   return b ? 2 | player:tell(title, " is already one of your help databases.")
16: elseif (!a && !(dobj in help_db))
17:   return b ? 2 | player:tell(title, " is not one of your current help databases.")
18: elseif (a)
19:   b || player:tell(title, " has been added to your list of help databases.")
20:   help_db = setadd(help_db, dobj)
21: else
22:   b || player:tell(title, " has been removed from your list of help databases.")
23:   help_db = setremove(help_db, dobj)
24: endif
25: for x in (`player:ancestors() ! ANY => {}')
26:   if (x:has_property("help_db"))
27:     adb = x.help_db
28:     adb = `{{adb}, 0, 0, adb}[typeof(help_db)] ! E_RANGE => {}'
29:     for z in (adb)
30:       if (z in help_db)
31:         help_db = setremove(help_db, z)
32:         b || player:tell(`z:title() ! ANY => tostr(z.name, " [Borked Title]")', " (", z, ") has been removed from your help database listing, as it was defined on your ancestor ", `x:title() ! ANY => tostr(x.name, " [Borked Title]")', " (", x, ").")
33:         b || (dobj == z && player:tell("There is no need to try and add it again, its automatically used."))
34:       endif
35:       $cmd_utils:suspend_if_needed(0)
36:     endfor
37:   endif
38:   $cmd_utils:suspend_if_needed(0)
39: endfor
40: oldhelp_db = help_db
41: help_db = $func_utils:filter("return valid(args[1]);", help_db)
42: if (b && oldhelp_db != help_db)
43:   player:tell("An invalid number was detected in your help database listing, and has been removed.")
44: endif
45: ok = 1
46: for x in (b ? {} | help_db)
47:   if (!x:isa($help_db) && x != dobj)
48:     ok = 0
49:   endif
50:   $cmd_utils:suspend_if_needed(0)
51: endfor
52: b || ok || player:tell("Warning: One of your help databases is not a child of the generic help database, you may encounter problems because of this.")
53: if (length(help_db) == 0)
54:   help_db = 0
55: elseif (length(help_db) == 1)
56:   help_db = help_db[1]
57: endif
58: this.help_db = help_db
59: return 1
60: "This verb previously owned by manta (#7165), and chowned to $slacker upon dewizarding (Sat Aug 17 14:50:04 2002 MDT)."
61: "Last modified by MadHatter (#8371) on Thu Aug 29 15:27:42 2002 MDT."

Verb arguments: any none none
Verb perms: Readable eXecutable NOT-Debug
Verb owned by: Slacker (#55)

You are not logged in.

[home | help | who | search | setup | code]