View/Edit #2:do_www_setup

Switch to edit mode.

Name(s): do_www_setup
1:  "Processes the POST arguments from a setup request."
2:  "This verb handles basic setup (name/location/parent/desc)."
3:  "Override to add more functionality.  Don't forget to pass."
4:  caller == this && player:isa($webber) || raise(E_PERM)
5:  if ($www:parse_POST("kick"))
6:    player:tell("<B>Kicking object.</B><BR>")
7:    this:kick()
8:  endif
9:  if (!$www:parse_POST("objectsetup"))
10:   return
11: endif
12: set_task_perms(player.user.wizard ? this.owner | player.user)
13: if ((x = $www:parse_POST("name")) != E_PROPNF)
14:   if (x != this.name)
15:     player:tell("<B>Renaming object.</B><BR>")
16:     result = `this:_set_name(x) ! ANY'
17:     if (result == E_PERM)
18:       $msg:mtell("www_error", "Permission denied!  You cannot rename this object.")
19:     elseif (result == E_INVARG)
20:       $msg:mtell("www_error", "That name is either conflicts with an existing name, or it is prohibited for some reason.")
21:     elseif (result == E_NACC)
22:       $msg:mtell("www_error", "Sorry, a name database is currently frozen.  Try again in a moment.")
23:     elseif (result == E_ARGS)
24:       $msg:mtell("www_error", "That name is waaay too long!")
25:     elseif (typeof(result) == $ERR)
26:       $msg:mtell("www_error", tostr("Unknown error: ", result))
27:     endif
28:   endif
29: endif
30: if ((x = $www:parse_POST("location")) != E_PROPNF && x != $su:nn(this.location))
31:   newloc = $su:match_nn_object(x, this.location, player.user)
32:   valid(newloc) || (newloc = $room_db:find(x))
33:   if (newloc == this.location)
34:     "Don't touch it."
35:   elseif (valid(newloc))
36:     player:tell("<B>Moving object to ", $su:nn(newloc), ".</B><BR>")
37:     x = `this:moveto(newloc) ! ANY'
38:     suspend(0)
39:     if (this.location != newloc)
40:       $msg:mtell("www_error", tostr("Unable to move ", this.name, " to ", newloc.name, " (", x, ")."))
41:     endif
42:   else
43:     $msg:mtell("www_error", "Couldn't match new location (" + x + ").")
44:   endif
45: endif
46: if ((x = $www:parse_POST("parent")) != E_PROPNF && x != $su:nn(parent(this)))
47:   newpar = $su:match_nn_object(x, this.location, player.user)
48:   if (newpar == parent(this))
49:     "Don't touch it."
50:   elseif (valid(newpar))
51:     player:tell("<B>Chparenting object to ", $su:nn(newpar), ".</B><BR>")
52:     x = `$building_utils:chparent(this, newpar) ! ANY'
53:     suspend(0)
54:     if (typeof(x) == $ERR)
55:       $msg:mtell("www_error", tostr("Error during chparent (", x, ")."))
56:       if (x == E_INVARG)
57:         player:sub_tell(" <B>Some property (or -o verb) on %2 is defined on %1 or one of %1~p descendants.</B> ", this, newpar)
58:       endif
59:     endif
60:   else
61:     $msg:mtell("www_error", "Couldn't match new parent (" + x + ").")
62:   endif
63: endif
64: if ((x = $www:parse_POST("desc")) != E_PROPNF && !equal(x, this:_get_description()))
65:   player:tell("<B>Setting the new description.</B><BR>")
66:   this:_set_description(x)
67: endif
68: "Last modified by Dax (#789) on Tue May  3 13:45:55 2005 MDT."

Verb arguments: this none this
Verb perms: Readable eXecutable NOT-Debug
Verb owned by: Dax (#789)

You are not logged in.

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