コード例 #1
0
ファイル: special.c プロジェクト: danielkrainas/ganadia
bool spec_new_republic_trooper(CHAR_DATA * ch)
{
	CHAR_DATA *victim;
	CHAR_DATA *v_next;

	if (!IS_AWAKE(ch) || ch->fighting)
		return FALSE;

	for (victim = ch->in_room->first_person; victim; victim = v_next) {
		v_next = victim->next_in_room;
		if (!can_see(ch, victim))
			continue;
		if (get_timer(victim, TIMER_RECENTFIGHT) > 0)
			continue;
		if ((IS_NPC(victim) && nifty_is_name("imperial", victim->name)
		     && victim->fighting && who_fighting(victim) != ch) ||
		    (!IS_NPC(victim) && victim->pcdata && victim->pcdata->clan
		     && IS_AWAKE(victim)
		     && nifty_is_name("empire", victim->pcdata->clan->name))) {
			do_yell(ch, "Long live the New Republic!");
			multi_hit(ch, victim, TYPE_UNDEFINED);
			return TRUE;
		}

	}

	return FALSE;

}
コード例 #2
0
ファイル: player.c プロジェクト: m241dan/swrproject
void do_title( CHAR_DATA * ch, const char *argument )
{
   if( IS_NPC( ch ) )
      return;

   if( IS_SET( ch->pcdata->flags, PCFLAG_NOTITLE ) )
   {
      send_to_char( "You try but the Force resists you.\r\n", ch );
      return;
   }


   if( argument[0] == '\0' )
   {
      send_to_char( "Change your title to what?\r\n", ch );
      return;
   }

   if( ( get_trust( ch ) <= LEVEL_IMMORTAL ) && ( !nifty_is_name( ch->name, argument ) ) )
   {
      send_to_char( "You must include your name somewhere in your title!", ch );
      return;
   }

   argument = smash_tilde_static( argument );
   set_title( ch, argument );
   send_to_char( "Ok.\r\n", ch );
}
コード例 #3
0
ファイル: special.c プロジェクト: ccubed/SWRCustom
bool spec_clan_guard( CHAR_DATA * ch )
{
  CHAR_DATA *victim = NULL;
  CHAR_DATA *v_next = NULL;

  if( !IS_AWAKE( ch ) || ch->fighting || !ch->mob_clan )
    return FALSE;

  for( victim = ch->in_room->first_person; victim; victim = v_next )
  {
    v_next = victim->next_in_room;
    if( !can_see( ch, victim ) )
      continue;
    if( get_timer( victim, TIMER_RECENTFIGHT ) > 0 )
      continue;
    if( !IS_NPC( victim ) && victim->pcdata && victim->pcdata->clan
	&& IS_AWAKE( victim ) && victim->pcdata->clan != ch->mob_clan
	&& nifty_is_name( victim->pcdata->clan->name,
	  ch->mob_clan->atwar ) )
    {
      char buf[MAX_STRING_LENGTH];
      snprintf( buf, MAX_STRING_LENGTH, "%s",
		"Hey you're not allowed in here!" );
      do_yell( ch, buf );
      multi_hit( ch, victim, TYPE_UNDEFINED );
      return TRUE;
    }
  }

  return FALSE;
}
コード例 #4
0
ファイル: shops.c プロジェクト: ccubed/SWRCustom
void do_list( CHAR_DATA * ch, char *argument )
{
  char arg[MAX_INPUT_LENGTH];
  CHAR_DATA *keeper = NULL;
  OBJ_DATA *obj = NULL;
  int cost = 0;
  int oref = 0;
  bool found = FALSE;

  one_argument( argument, arg );

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

  for( obj = keeper->last_carrying; obj; obj = obj->prev_content )
  {
    if( obj->wear_loc == WEAR_NONE && can_see_obj( ch, obj ) )
    {
      oref++;
      if( ( cost = get_cost( ch, keeper, obj, TRUE ) ) > 0
	  && ( arg[0] == '\0' || nifty_is_name( arg, obj->name ) ) )
      {
	if( !found )
	{
	  found = TRUE;
	  send_to_char( "[Price] {ref} Item\r\n", ch );
	}
	ch_printf( ch, "[%5d] {%3d} %s.\r\n",
	    cost, oref, capitalize( obj->short_descr ) );
      }
    }
  }

  if( !found )
  {
    if( arg[0] == '\0' )
      send_to_char( "You can't buy anything here.\r\n", ch );
    else
      send_to_char( "You can't buy that here.\r\n", ch );
  }
}
コード例 #5
0
ファイル: interp.c プロジェクト: m241dan/W4M-Repo
bool check_social( CHAR_DATA * ch, const char *command, const char *argument )
{
   char arg[MAX_INPUT_LENGTH];
   CHAR_DATA *victim, *victim_next;
   SOCIALTYPE *social;
   CHAR_DATA *removed[128];   /* What are the chances of more than 128? */
   ROOM_INDEX_DATA *room;
   int i = 0, k = 0;

   if( ( social = find_social( command ) ) == NULL )
      return FALSE;

   if( !IS_NPC( ch ) && xIS_SET( ch->act, PLR_NO_EMOTE ) )
   {
      send_to_char( "You are anti-social!\r\n", ch );
      return TRUE;
   }

   switch ( ch->position )
   {
      case POS_DEAD:
         send_to_char( "Lie still; you are DEAD.\r\n", ch );
         return TRUE;

      case POS_INCAP:
      case POS_MORTAL:
         send_to_char( "You are hurt far too bad for that.\r\n", ch );
         return TRUE;

      case POS_STUNNED:
         send_to_char( "You are too stunned to do that.\r\n", ch );
         return TRUE;

      case POS_SLEEPING:
         /*
          * I just know this is the path to a 12" 'if' statement.  :(
          * But two players asked for it already!  -- Furey
          */
         if( !str_cmp( social->name, "snore" ) )
            break;
         send_to_char( "In your dreams, or what?\r\n", ch );
         return TRUE;
   }

   /*
    * Search room for chars ignoring social sender and 
    * remove them from the room until social has been  
    * completed              
    */
   room = ch->in_room;
   for( victim = ch->in_room->first_person; victim; victim = victim_next )
   {
      if( i == 127 )
         break;
      victim_next = victim->next_in_room;
      if( is_ignoring( victim, ch ) )
      {
         if( !IS_IMMORTAL( ch ) || get_trust( victim ) > get_trust( ch ) )
         {
            removed[i] = victim;
            i++;
            UNLINK( victim, room->first_person, room->last_person, next_in_room, prev_in_room );
         }
         else
         {
            set_char_color( AT_IGNORE, victim );
            ch_printf( victim, "You attempt to ignore %s," " but are unable to do so.\r\n", ch->name );
         }
      }
   }

   one_argument( argument, arg );
   victim = NULL;
   if( arg[0] == '\0' )
   {
      act( AT_SOCIAL, social->others_no_arg, ch, NULL, victim, TO_ROOM );
      act( AT_SOCIAL, social->char_no_arg, ch, NULL, victim, TO_CHAR );
   }
   else if( ( victim = get_char_room( ch, arg ) ) == NULL )
   {
      /*
       * If they aren't in the room, they may be in the list of 
       * people ignoring...                 
       */
      if( i != 0 )
      {
         for( k = 0, victim = removed[0]; k < i; k++, victim = removed[k] )
         {
            if( nifty_is_name( victim->name, arg ) || nifty_is_name_prefix( arg, victim->name ) )
            {
               set_char_color( AT_IGNORE, ch );
               ch_printf( ch, "%s is ignoring you.\r\n", victim->name );
               break;
            }
         }
      }

      if( !victim )
         send_to_char( "They aren't here.\r\n", ch );
   }
   else if( victim == ch )
   {
      act( AT_SOCIAL, social->others_auto, ch, NULL, victim, TO_ROOM );
      act( AT_SOCIAL, social->char_auto, ch, NULL, victim, TO_CHAR );
   }
   else
   {
      act( AT_SOCIAL, social->others_found, ch, NULL, victim, TO_NOTVICT );
      act( AT_SOCIAL, social->char_found, ch, NULL, victim, TO_CHAR );
      act( AT_SOCIAL, social->vict_found, ch, NULL, victim, TO_VICT );

      if( !IS_NPC( ch ) && IS_NPC( victim )
          && !IS_AFFECTED( victim, AFF_CHARM ) && IS_AWAKE( victim ) && !HAS_PROG( victim->pIndexData, ACT_PROG ) )
      {
         switch ( number_bits( 4 ) )
         {
            case 0:
               if( IS_EVIL( ch ) && !is_safe( victim, ch, TRUE ) )   /* was IS_EVIL(ch) ||.... didn't make sense to me - FB */
                     multi_hit( victim, ch, TYPE_UNDEFINED );
               else if( IS_NEUTRAL( ch ) )
               {
                  act( AT_ACTION, "$n slaps $N.", victim, NULL, ch, TO_NOTVICT );
                  act( AT_ACTION, "You slap $N.", victim, NULL, ch, TO_CHAR );
                  act( AT_ACTION, "$n slaps you.", victim, NULL, ch, TO_VICT );
               }
               else
               {
                  act( AT_ACTION, "$n acts like $N doesn't even exist.", victim, NULL, ch, TO_NOTVICT );
                  act( AT_ACTION, "You just ignore $N.", victim, NULL, ch, TO_CHAR );
                  act( AT_ACTION, "$n appears to be ignoring you.", victim, NULL, ch, TO_VICT );
               }
               break;

            case 1:
            case 2:
            case 3:
            case 4:
            case 5:
            case 6:
            case 7:
            case 8:
               act( AT_SOCIAL, social->others_found, victim, NULL, ch, TO_NOTVICT );
               act( AT_SOCIAL, social->char_found, victim, NULL, ch, TO_CHAR );
               act( AT_SOCIAL, social->vict_found, victim, NULL, ch, TO_VICT );
               break;

            case 9:
            case 10:
            case 11:
            case 12:
               act( AT_ACTION, "$n slaps $N.", victim, NULL, ch, TO_NOTVICT );
               act( AT_ACTION, "You slap $N.", victim, NULL, ch, TO_CHAR );
               act( AT_ACTION, "$n slaps you.", victim, NULL, ch, TO_VICT );
               break;
         }
      }
   }

   /*
    * Replace the chars in the ignoring list to the room 
    * note that the ordering of the players in the room  
    * might change                
    */
   if( i != 0 )
   {
      for( k = 0, victim = removed[0]; k < i; k++, victim = removed[k] )
      {
         LINK( victim, room->first_person, room->last_person, next_in_room, prev_in_room );
      }
   }

   return TRUE;
}
コード例 #6
0
ファイル: shops.c プロジェクト: smthbh/SWFotE-Mud
void do_list( CHAR_DATA *ch, char *argument )
{
    if ( IS_SET(ch->in_room->room_flags, ROOM_PET_SHOP) )
    {
	ROOM_INDEX_DATA *pRoomIndexNext;
	CHAR_DATA *pet;
	bool found;

	pRoomIndexNext = get_room_index( ch->in_room->vnum + 1 );
	if ( !pRoomIndexNext )
	{
	    bug( "Do_list: bad pet shop at vnum %d.", ch->in_room->vnum );
	    send_to_char( "You can't do that here.\n\r", ch );
	    return;
	}

	found = FALSE;
	for ( pet = pRoomIndexNext->first_person; pet; pet = pet->next_in_room )
	{
	    if ( IS_SET(pet->act, ACT_PET) && IS_NPC(pet) )
	    {
		if ( !found )
		{
		    found = TRUE;
		    send_to_char( "Pets for sale:\n\r", ch );
		}
		ch_printf( ch, "[%2d] %8d - %s\n\r",
			pet->top_level,
			10 * pet->top_level * pet->top_level,
			pet->short_descr );
	    }
	}
	if ( !found )
	    send_to_char( "Sorry, we're out of pets right now.\n\r", ch );
	return;
    }
    else
    {
	char arg[MAX_INPUT_LENGTH];
	CHAR_DATA *keeper;
	OBJ_DATA *obj;
	int cost;
	int oref = 0;
	bool found;

	one_argument( argument, arg );

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

	found = FALSE;
	for ( obj = keeper->last_carrying; obj; obj = obj->prev_content )
	{
	    if ( obj->wear_loc == WEAR_NONE
	    &&   can_see_obj( ch, obj ) )
	    {
	       oref++;
	       if ( ( cost = get_cost( ch, keeper, obj, TRUE ) ) > 0
	       && ( arg[0] == '\0' || nifty_is_name( arg, obj->name ) ) )
	       {
	       	if (keeper->home != NULL)
		  cost = obj->cost;
		if ( !found )
		{
		    found = TRUE;
		    ch_printf( ch, "%s[Price] {ref} Item\n\r", color_str( AT_LIST, ch) );
		}
		ch_printf( ch, "%s[%5d] {%3d} %s%s%s.\n\r",
		    color_str(AT_LIST, ch), cost, oref, capitalize( obj->short_descr ), color_str(AT_LIST, ch),
		    IS_SET(obj->extra_flags, ITEM_HUTT_SIZE) ? " (hutt size)" :
		    ( IS_SET(obj->extra_flags, ITEM_LARGE_SIZE) ? " (large)" :
		    ( IS_SET(obj->extra_flags, ITEM_HUMAN_SIZE) ? " (medium)" :
		    ( IS_SET(obj->extra_flags, ITEM_SMALL_SIZE) ? " (small)" :
		    "" ) ) ) );
	       }
	    }
	}

	if ( !found )
	{
	    if ( arg[0] == '\0' )
		send_to_char( "You can't buy anything here.\n\r", ch );
	    else
		send_to_char( "You can't buy that here.\n\r", ch );
	}
	return;
    }
}