#include <sys.h>

string name,short,long;
object owner;
int special,flags,value;

get_name() { if (name) return midstr(name,2,strlen(name)-2); }
get_short() { return short; }
get_long() { return long ? long : "You see nothing special."; }
get_owner() { return owner; }
get_special() { return special; }
get_flags() { return flags; }
get_value() { return value; }

self_destruct() { destruct(this_object()); return 1; }

set_name(arg) {
  int pos;

  name=";"+arg+";";
  pos=instr(arg,1,";");
  if (!short) 
    if (pos)
      short="a "+leftstr(arg,pos-1);
    else
      short="a "+arg;
  return 1;
}

set_short(arg) { short=arg; return 1; }
set_long(arg) { long=arg; return 1; }
set_owner(arg) { owner=arg; return 1; }
set_special(arg) { special=arg; return 1; }
set_flags(arg) { flags=arg; return 1; }
set_value(arg) { value=arg; return 1; }

id(arg) { return instr(name,1,";"+arg+";"); }

replicate() {
  object o;

  o=clone_object("/obj/object");
  call_other(o,"set_name",get_name());
  call_other(o,"set_short",short);
  call_other(o,"set_long",long);
  call_other(o,"set_owner",owner);
  call_other(o,"set_special",special);
  call_other(o,"set_flags",flags);
  call_other(o,"set_value",value);
  return o;
}

get() { return 1; }

get_type() { return TYPE_OBJECT; }

stat() {
  tell_player(this_player(),"Object Type: OBJECT\n");
  if (flags) tell_player(this_player(),"Flags: "+make_flags(flags)+"\n");
  if (special) tell_player(this_player(),"Special: "+itoa(special)+"\n");
  if (name) tell_player(this_player(),"Name: "+get_name()+"\n");
  if (short) tell_player(this_player(),"Short: "+short+"\n");
  if (long) tell_player(this_player(),"Long: "+long+"\n");
  tell_player(this_player(),"Value: "+itoa(value)+"\n");
  if (owner) tell_player(this_player(),"Owner: "+make_num(owner)+"\n");
  return 1;
}