give.c

gurba-0.40/lib/cmds/verb/give.c · 1.3 KB

From the archive gurba.tgz

Download the archive   « Back to the archive contents

mixed *query_verb_info( void ) {
  return( ({ "", "OBJI", "OBJI to LIV" }) );
}

mixed can_give( void ) {
  return( "Give what to who?" );
}

mixed can_give_obj( object obj ) {
  if( obj->is_undroppable() ) {
    this_player()->targetted_action( "$N $vare unable to give away $o.", 0, obj );
    return( 0 );
  }
  return( "Give " + obj->query_id() + " to who?" );
}

mixed can_give_obj_to_liv( object obj, string s, object liv ) {
  if( obj->is_undroppable() ) {
    this_player()->targetted_action( "$N $vare unable to give $o to $T.", liv, obj );
    return( 0 );
  }

  /* Should check if the target has room in it's inventory.*/

  if( liv->is_container() == 0 ) {
    return( 0 );
  }

  if( liv == this_player() )
    return( "What's the point of giving something to yourself?" );

  return( 1 );
}



mixed do_give_obj_to_liv( object obj, string s, object liv ) {
  if( obj->is_worn() ) {
    this_player()->do_remove( obj );
    this_player()->targetted_action( obj->query_remove_message(), 0, obj );
  }
  
  if( obj->is_wielded() ) {
    this_player()->do_unwield( obj );
    this_player()->targetted_action( obj->query_unwield_message(), 0, obj );
  }
  
  if( obj->move( liv ) ) {
    this_player()->targetted_action( "$N $vgive $o to $T.", liv, obj );
  } else {
    this_player()->targetted_action( "$N $vtry to give $o to $T, but $vfail.", liv, obj ); 
  }
}

Site Stats

Snippets: 1791
Codebases: 571