static void
mount_changed_callback (GVolumeMonitor *volume_monitor,
			GMount *mount, 
			NautilusDesktopLinkMonitor *monitor)
{
	/* TODO: update the mount with other details */

	/* remove a mount if it goes into the shadows */
	if (g_mount_is_shadowed (mount) && has_mount (monitor, mount)) {
		remove_mount_link (monitor, mount);
	}}
static void
create_mount_link (NautilusDesktopLinkMonitor *monitor,
		   GMount *mount)
{
	NautilusDesktopLink *link;

	if (has_mount (monitor, mount))
		return;

	if ((!g_mount_is_shadowed (mount)) &&
	    g_settings_get_boolean (nautilus_desktop_preferences,
				    NAUTILUS_PREFERENCES_DESKTOP_VOLUMES_VISIBLE)) {
		link = nautilus_desktop_link_new_from_mount (mount);
		monitor->details->mount_links = g_list_prepend (monitor->details->mount_links, link);
	}
}
示例#3
0
bool spell_find_mount( char_data* ch, char_data*, void* vo,
  int level, int )
{
  if( null_caster( ch, SPELL_FIND_MOUNT ) ) 
    return FALSE;

  if( has_mount( ch ) )  {
    send( ch, "You can only have one mount at a time.\n\r" );
    return FALSE;
    }

  find_buddy( ch, (obj_data*) vo, level,
    LIST_FM_SPECIES, LIST_FM_REAGENT );

  return TRUE;
}
示例#4
0
bool spell_tame( char_data* ch, char_data* victim, void*, int level, int )
{
  if( null_caster( ch, SPELL_TAME ) )
    return TRUE;

  if( is_set( &victim->status, STAT_PET ) ) {
    send( ch, "%s is already tame.\r\n", victim );
    return TRUE;
    }

  if( victim->species == NULL
    || !is_set( &victim->species->act_flags, ACT_CAN_TAME )
    || makes_save( victim, ch, RES_MIND, SPELL_TAME, level )
    || victim->leader != NULL 
    || victim->shdata->level > ch->shdata->level ) {
    send( ch, "%s ignores you.\r\n", victim );
    send( *ch->array, "%s ignores %s.\r\n", victim, ch );
    return TRUE;
    }

  if( victim->shdata->level > ch->shdata->level-pet_levels( ch ) ) {
    send( ch, "You fail as you are unable to control more animals.\r\n" );
    return TRUE;
    }

  if( is_set( &victim->species->act_flags, ACT_MOUNT ) && has_mount( ch ) )
    return TRUE;

  if( ch->leader == victim )
    stop_follower( ch );

  set_bit( &victim->status, STAT_PET );
  set_bit( &victim->status, STAT_TAMED );

  remove_bit( &victim->status, STAT_AGGR_ALL );
  remove_bit( &victim->status, STAT_AGGR_GOOD );
  remove_bit( &victim->status, STAT_AGGR_EVIL );

  add_follower( victim, ch );

  return TRUE;
}
示例#5
0
void do_buy( char_data *ch, char *argument )
{
  char             buf  [ MAX_INPUT_LENGTH ];
  char_data*    keeper;
  char_data*       pet;
  obj_data*        obj;
  room_data*      room;
  thing_array*   array;

  if( ( keeper = find_keeper( ch ) ) == NULL )
    return;

  /* PET SHOP */

  if( is_set( &ch->in_room->room_flags, RFLAG_PET_SHOP ) ) {
    if( ch->species != NULL  ) {
      send( ch, "Monsters can't buy pets." );
      return;
      }

    if( ( room = get_room_index( ch->in_room->vnum+1 ) ) == NULL ) {
      send( ch, "The pet shop is still under construction.\r\n" );
      return;
      }

    thing_array list;

    for( int i = 0; i < room->contents; i++ ) 
      if( ( pet = character( room->contents[i] ) ) != NULL
        && buyable_pet( pet ) )
        list += pet;

    if( ( pet = one_character( ch, argument, "buy", &list ) ) == NULL )
      return;

    if( pet->shdata->level > ch->shdata->level ) {
      send( ch, "%s is too high a level for you.\r\n", pet );
      return;
      }

    if( pet->species->price == 0 ) {
      send( ch,
        "That pet is not for sale until a god sets a price for it.\r\n" );
      return;
      }

    if( is_set( &pet->species->act_flags, ACT_MOUNT ) ) {
      if( has_mount( ch ) )
        return;
      }
    else {
      if( number_of_pets( ch ) >= 2 ) {
        send( ch, "You already have two pets.\r\n" );
        return;
        }
      }

    sprintf( buf, "You hand %s", keeper->descr->name ); 
    if( !remove_coins( ch, pet->species->price, buf ) ) {
      if( ch->shdata->level < LEVEL_APPRENTICE ) {
        send( ch, "You can't afford it.\r\n" );
        return;
        }
      send( ch, "You don't have enough gold, but it doesn't seem to\
 matter.\r\n" );
      }

    pet->From( );
    pet->To( ch->array );

    set_bit( &pet->status, STAT_PET );
    add_follower( pet, ch );

    send( ch, "Enjoy your pet.\r\n" );
    fsend( ch, "%s bought %s as a pet.\r\n", ch, pet );

    if( pet->reset != NULL ) {
      pet->reset->count--;
      pet->reset = NULL;
      }
    return;
    }

  /* OBJECT SHOP */

  thing_array list;

  for( int i = 0; i < keeper->contents; i++ ) {
    obj = (obj_data*) keeper->contents[i];
    if( will_trade( keeper, obj ) )
      list += obj;
    }
    
  if( ( array = several_things( ch, argument, "buy", &list ) ) == NULL )
    return;

  thing_array   subset  [ 4 ];
  thing_func*     func  [ 4 ]  = { heavy, many, cantafford, buy };

  sort_objects( ch, *array, keeper, 4, subset, func );
  
  page_priv( ch, NULL, empty_string );
  page_priv( ch, &subset[0], "can't lift" );
  page_priv( ch, &subset[1], "can't handle" );
  page_priv( ch, &subset[2], "can't afford" );
  page_publ( ch, &subset[3], "buy", keeper, "from", "for" );

  delete array;
}