/
lib/banish/
lib/d/
lib/doc/
lib/doc/domains/
lib/doc/efun/
lib/doc/examples/
lib/doc/examples/armour/
lib/doc/examples/contain/
lib/doc/examples/food/
lib/doc/examples/magic/
lib/doc/examples/monster/
lib/doc/examples/room/
lib/doc/examples/weapons/
lib/include/
lib/include/fn_specs/
lib/include/skills/
lib/info/
lib/inherit/base/
lib/log/
lib/manuals/312/
lib/news/
lib/obj/party/
lib/objects/components/
lib/open/
lib/open/library/
lib/open/party/
lib/players/
lib/players/zilanthius/
lib/room/
lib/room/city/arena/
lib/room/city/creator/
lib/room/city/garden/monst/
lib/room/city/obj/
lib/room/city/shop/
lib/room/death/
lib/room/registry/
lib/secure/
lib/secure/UDP_CMD_DIR/
lib/skills/
lib/skills/fighter/
lib/skills/thief/
lib/usr/
lib/usr/creators/
lib/usr/players/
/* CLOTHING.c   Angel, Sept 1993.
 * As armour is actual armour, and clothing, by no stretch of the imagination
 * actually confers protection (if it does its armour). This object is used
 * so people can create hats, robes, scarves, necklaces, and the works as
 * items of fashion as opposed to items of protection. Note, also, that 
 * armour types slowly decay as they are bashed about. These items are 
 * always as good as if they were just coded.
 */  

#include <mudlib.h>
inherit BASE;

#define NAME (string)this_player()->query_name()   

status worn;                 /* flag true if worn */    
    
init() {    
  ::init();
  add_action("wear", "wear");    
  add_action("remove", "remove");    
}    
    
    
status get() { return 1; }    

status drop(status silently) {    
  if(worn && !silently) {    
    tell_object(environment(), "You drop your worn "+ query_name() +".\n");    
  }
  worn = 0;    
  return 0;    
}    
    

string short(status wiz) {    
  if(!::short(wiz)) return 0;    
  return ::short(wiz) +((worn) ? " (worn)" : "");      
}    
   
 
status wear(string str) {    
  int i;
  object ob;    
   
  if(!str) {
    notify_fail("wear what?\n");
    return 0;
  }
  if(!(ob = present(str, this_player()))) {
    notify_fail("You do not have a "+ str +".\n");
    return 0;
  }
  if(ob != this_object()) {
    notify_fail("You can't do that!\n");
    return 0;
  }
  if(worn) {    
    write("You already wear it!\n");    
    return 1;    
  }    
  sscanf(str,"%s %d",str,i);
  for(i = 1; (ob = present(str +" "+ i, this_player())); i++) {
    if(ob->query_worn()) { 
      write("You are already wearing a "+ query_name() +".\n");    
      return 1;
    }
  }
  write("You wear "+ query_name() +".\n");
  say(NAME +" wears "+ query_name() +".\n");
  worn = 1;
  return 1;    
}    


status query_worn() {
return worn;
}
    

status remove(string str) {    
  int i;
  object ob;

  if(!str) {
    notify_fail("remove what?\n");
    return 0;
  }
  if(!(ob = present(str, this_player()))) {
    notify_fail("You do not have a "+ str +".\n");
    return 0;
  }
  if(ob != this_object()) {
    notify_fail("You can't do that!\n");
    return 0;
  }
  if(!worn) {
    write("You are not wearing it.\n");
    return 1;
  }    
  write("You remove your "+ query_name() +".\n");
  say(NAME +" removes "+ query_name() +".\n");
  worn = 0;    
  return 1;    
}