コード例 #1
0
ファイル: clans.c プロジェクト: MUDOmnibus/Argila2
char *display_clan_ranks (CHAR_DATA *ch, CHAR_DATA *observer)
{
	CLAN_DATA	*clan = NULL;
	static char	buf [MAX_STRING_LENGTH] = { '\0' };
	char		*argument = NULL, *argument2 = NULL;
	char		ranks_list [MAX_STRING_LENGTH] = { '\0' };
	char		clan_name [MAX_STRING_LENGTH] = { '\0' };
	char		clan_name2 [MAX_STRING_LENGTH] = { '\0' };
	char		name [MAX_STRING_LENGTH] = { '\0' };
	int			flags = 0, flags2 = 0, clans = 0;
	bool		first = TRUE;
	char		*temp_arg = NULL;
	
	argument = observer->clans;

	*ranks_list = '\0';

	snprintf (buf, MAX_STRING_LENGTH,  "You recognize that %s carries the rank of", HSSH(ch));

    while ( get_next_clan (&argument, clan_name, &flags) ) {
    	argument2 = ch->clans;
        
        while ( get_next_clan (&argument2, clan_name2, &flags2) ) {
        	
        	if ( !str_cmp (clan_name, "osgi_citizens") ||
            	 !str_cmp (clan_name, "mm_denizens") )
                continue;
			
			clan = get_clandef (clan_name);
			
			if ( !clan )
				continue;
            
            if ( !str_cmp (clan_name, clan_name2) ) {
				if ( *ranks_list ) {
					strcat (buf, ranks_list);
			
					if ( !first )
						strcat (buf, ",");
				
					*ranks_list = '\0';
				}
						
				snprintf (name, MAX_STRING_LENGTH, "%s", clan->literal);
				
				if ( !cmp_strn (clan->literal, "The ", 4) )
					*name = tolower(*name);
				
				if ( cmp_strn (clan->literal, "the ", 4) ){
					temp_arg = get_clan_rank_name (flags2);
					snprintf (name, MAX_STRING_LENGTH, "the %s", clan->literal);
					snprintf (ranks_list + strlen(ranks_list), MAX_STRING_LENGTH, " %s in %s", temp_arg, name); 
				}
						
				first = FALSE;
				clans++;
            }
        }
    }

	if ( *ranks_list ) {
		if ( clans > 1 )
			strcat (buf, " and");
	
		strcat (buf, ranks_list);
	} 

	strcat (buf, ".");

	if (clan)
		free(clan);  /* clan = get_clandef (clan_name); */
		
	if ( clans )
		return buf;
	else
		return NULL;
		
}
コード例 #2
0
ファイル: dg_comm.c プロジェクト: Calebros/aol
void sub_write_to_char(char_data *ch, char *tokens[], void *otokens[], char type[])
{
    char sb[MAX_STRING_LENGTH];
    int i;

    strcpy(sb,"");

    for (i = 0; tokens[i + 1]; i++)
    {
	strcat(sb,tokens[i]);

	switch (type[i])
	{
	case '~':
	    if (!otokens[i])
		strcat(sb,"someone");
	    else if ((char_data *)otokens[i] == ch)
		strcat(sb,"you");
	    else
            {
                GET_PERS((char_data*) otokens[i], ch, chname);
		strcat(sb, chname);
                FREE_NAME(chname);
            }
	    break;

	case '@':
	    if (!otokens[i])
		strcat(sb,"someone's");
	    else if ((char_data *)otokens[i] == ch)
		strcat(sb,"your");
	    else
	    {
                GET_PERS((char_data*) otokens[i], ch, chname);
		strcat(sb, chname);
                FREE_NAME(chname);
		strcat(sb,"'s");
	    }
	    break;

	case '^':
	    if (!otokens[i] || !CAN_SEE(ch, (char_data *) otokens[i]))
		strcat(sb,"its");
	    else if (otokens[i] == ch)
		strcat(sb,"your");
	    else
		strcat(sb,HSHR((char_data *) otokens[i]));
	    break;
		
	case '&':
	    if (!otokens[i] || !CAN_SEE(ch, (char_data *) otokens[i]))
		strcat(sb,"it");
	    else if (otokens[i] == ch)
		strcat(sb,"you");
	    else
		strcat(sb,HSSH((char_data *) otokens[i]));
	    break;
	    
	case '*':
	    if (!otokens[i] || !CAN_SEE(ch, (char_data *) otokens[i]))
		strcat(sb,"it");
	    else if (otokens[i] == ch)
		strcat(sb,"you");
	    else
		strcat(sb,HMHR((char_data *) otokens[i]));
	    break;

	case '`':
	    if (!otokens[i])
		strcat(sb,"something");
	    else
		strcat(sb,OBJS(((obj_data *) otokens[i]), ch));
	    break;
	}
    }

    strcat(sb,tokens[i]);
    strcat(sb,"\n\r");
    sb[0] = toupper(sb[0]);
    send_to_char(sb,ch);
}
コード例 #3
0
ファイル: objsave.c プロジェクト: madvlad/doom-mud
int gen_receptionist(struct char_data *ch, struct char_data *recep,
		         int cmd, char *arg, int mode)
{
  int cost;
  const char *action_table[] = { "smile", "dance", "sigh", "blush", "burp",
	  "cough", "fart", "twiddle", "yawn" };

  if (!cmd && !rand_number(0, 5)) {
    do_action(recep, NULL, find_command(action_table[rand_number(0, 8)]), 0);
    return (FALSE);
  }

  if (!ch->desc || IS_NPC(ch))
    return (FALSE);

  if (!CMD_IS("offer") && !CMD_IS("rent"))
    return (FALSE);

  if (!AWAKE(recep)) {
    send_to_char(ch, "%s is unable to talk to you...\r\n", HSSH(recep));
    return (TRUE);
  }

  if (!CAN_SEE(recep, ch)) {
    act("$n says, 'I don't deal with people I can't see!'", FALSE, recep, 0, 0, TO_ROOM);
    return (TRUE);
  }

  if (free_rent) {
    act("$n tells you, 'Rent is free here.  Just quit, and your objects will be saved!'",
	FALSE, recep, 0, ch, TO_VICT);
    return (1);
  }

  if (CMD_IS("rent")) {
    char buf[128];

    if (!(cost = Crash_offer_rent(ch, recep, FALSE, mode)))
      return (TRUE);
    if (mode == RENT_FACTOR)
      snprintf(buf, sizeof(buf), "$n tells you, 'Rent will cost you %d gold coins per day.'", cost);
    else if (mode == CRYO_FACTOR)
      snprintf(buf, sizeof(buf), "$n tells you, 'It will cost you %d gold coins to be frozen.'", cost);
    act(buf, FALSE, recep, 0, ch, TO_VICT);

    if (cost > GET_GOLD(ch) + GET_BANK_GOLD(ch)) {
      act("$n tells you, '...which I see you can't afford.'",
	  FALSE, recep, 0, ch, TO_VICT);
      return (TRUE);
    }
    if (cost && (mode == RENT_FACTOR))
      Crash_rent_deadline(ch, recep, cost);

    if (mode == RENT_FACTOR) {
      act("$n stores your belongings and helps you into your private chamber.", FALSE, recep, 0, ch, TO_VICT);
      Crash_rentsave(ch, cost);
      mudlog(NRM, MAX(LVL_IMMORT, GET_INVIS_LEV(ch)), TRUE, "%s has rented (%d/day, %d tot.)",
		GET_NAME(ch), cost, GET_GOLD(ch) + GET_BANK_GOLD(ch));
    } else {			/* cryo */
      act("$n stores your belongings and helps you into your private chamber.\r\n"
	  "A white mist appears in the room, chilling you to the bone...\r\n"
	  "You begin to lose consciousness...",
	  FALSE, recep, 0, ch, TO_VICT);
      Crash_cryosave(ch, cost);
      mudlog(NRM, MAX(LVL_IMMORT, GET_INVIS_LEV(ch)), TRUE, "%s has cryo-rented.", GET_NAME(ch));
      SET_BIT(PLR_FLAGS(ch), PLR_CRYO);
    }

    act("$n helps $N into $S private chamber.", FALSE, recep, 0, ch, TO_NOTVICT);

    GET_LOADROOM(ch) = GET_ROOM_VNUM(IN_ROOM(ch));
    extract_char(ch);	/* It saves. */
  } else {
    Crash_offer_rent(ch, recep, TRUE, mode);
    act("$N gives $n an offer.", FALSE, ch, 0, recep, TO_ROOM);
  }
  return (TRUE);
}