phantasmal_dgd_v1/
phantasmal_dgd_v1/bin/
phantasmal_dgd_v1/doc/
phantasmal_dgd_v1/mud/doc/
phantasmal_dgd_v1/mud/doc/api/
phantasmal_dgd_v1/mud/doc/kernel/
phantasmal_dgd_v1/mud/doc/kernel/hook/
phantasmal_dgd_v1/mud/doc/kernel/lfun/
phantasmal_dgd_v1/mud/include/
phantasmal_dgd_v1/mud/include/kernel/
phantasmal_dgd_v1/mud/kernel/lib/
phantasmal_dgd_v1/mud/kernel/lib/api/
phantasmal_dgd_v1/mud/kernel/obj/
phantasmal_dgd_v1/mud/kernel/sys/
phantasmal_dgd_v1/mud/tmp/
phantasmal_dgd_v1/mud/usr/System/
phantasmal_dgd_v1/mud/usr/System/keys/
phantasmal_dgd_v1/mud/usr/System/obj/
phantasmal_dgd_v1/mud/usr/System/open/lib/
phantasmal_dgd_v1/mud/usr/common/data/
phantasmal_dgd_v1/mud/usr/common/lib/parsed/
phantasmal_dgd_v1/mud/usr/common/obj/telopt/
phantasmal_dgd_v1/mud/usr/common/obj/ustate/
phantasmal_dgd_v1/mud/usr/game/
phantasmal_dgd_v1/mud/usr/game/include/
phantasmal_dgd_v1/mud/usr/game/obj/
phantasmal_dgd_v1/mud/usr/game/object/
phantasmal_dgd_v1/mud/usr/game/object/stuff/
phantasmal_dgd_v1/mud/usr/game/sys/
phantasmal_dgd_v1/mud/usr/game/text/
phantasmal_dgd_v1/mud/usr/game/users/
phantasmal_dgd_v1/src/host/
phantasmal_dgd_v1/src/host/beos/
phantasmal_dgd_v1/src/host/mac/
phantasmal_dgd_v1/src/host/unix/
phantasmal_dgd_v1/src/host/win32/res/
phantasmal_dgd_v1/src/kfun/
phantasmal_dgd_v1/src/lpc/
phantasmal_dgd_v1/src/parser/
#include <kernel/kernel.h>

#include <phantasmal/map.h>
#include <phantasmal/lpc_names.h>

inherit MOBILE;

/* user associated with this mobile */
object user;

static void create(varargs int clone) {
  ::create(clone);
}

/* overridden functions from mobile.c */
string get_type(void) {
  return "user";
}

object get_user(void) {
  return user;
}

void set_user(object new_user) {
  if (!SYSTEM() && !COMMON() && !GAME()) {
    error("Only authorized objects can change the user!");
  }

  user = new_user;
}

void notify_moved(object obj) {
  if (user) {
    user->notify_moved(obj);
  }

  ::notify_moved(obj);
}

/* 
 * Hook function overrides
 */

void hook_say(object body, string message) {
  if (user) {
    user->send_phrase(body->get_brief());
    user->message(" says: " + message + "\r\n");
  }
}

void hook_emote(object body, string message) {
  if(user) {
    user->send_phrase(body->get_brief());
    user->message(" " + message + "\r\n");
  }
}

/* Args -- body, target, verb */
void hook_social(object body, object target, string verb) {
  string ret;

  if(user) {
    ret = SOULD->get_social_string(user, body, target, verb);
    if(!ret) {
      user->message("Error getting social string!\r\n");
    } else {
      user->message(ret + "\r\n");
    }
  }
}

void hook_whisper(object body, string message) {
  if (user) {
    user->send_phrase(body->get_brief());
    user->message(" whispers to you: " + message + "\r\n");
  }
}

void hook_whisper_other(object body, object target) {
  if (user) {
    user->send_phrase(body->get_brief());
    user->message(" whispers something to ");
    user->send_phrase(target->get_brief());
    user->message("\r\n");
  }
}

void hook_leave(object body, int dir) {
  if (user) {
    if (dir == DIR_TELEPORT) {
      user->send_phrase(body->get_brief());
      user->message(" disappears into thin air.\r\n");
    } else {
      user->send_phrase(body->get_brief()) ;
      user->message(" leaves going ");
      user->send_phrase(EXITD->get_name_for_dir(dir));
      user->message("\r\n");
    }
  }
}

void hook_enter(object body, int dir) {
  if (user) {
    if (dir == DIR_TELEPORT) {
      user->send_phrase(body->get_brief());
      user->message(" appears from thin air.\r\n");
    } else {
      user->send_phrase(body->get_brief()) ;
      user->message(" enters from the ");
      user->send_phrase(EXITD->get_name_for_dir(dir));
      user->message("\r\n");
    }
  }
}

void from_dtd_unq(mixed* unq) {
  /* Set the body, location and number fields */
  unq = mobile_from_dtd_unq(unq);

  /* User mobiles don't actually (yet) have any additional data.
     So we can just return. */
}