Exemplo n.º 1
0
void perform_mob_flag_list(struct char_data * ch, char *arg)
{
  int num, mob_flag, found = 0, len;
  struct char_data *mob;
  char buf[MAX_STRING_LENGTH];

  mob_flag = atoi(arg);

  if (mob_flag < 0 || mob_flag > NUM_MOB_FLAGS) {
    send_to_char(ch, "Invalid flag number!\r\n");
    return;
  }

  len = snprintf(buf, sizeof(buf), "Listing mobiles with %s%s%s flag set.\r\n", QYEL, action_bits[mob_flag], QNRM);

  for(num=0;num<=top_of_mobt;num++) {
    if(IS_SET_AR((mob_proto[num].char_specials.saved.act), mob_flag)) {

      if ((mob = read_mobile(num, REAL)) != NULL) {
        char_to_room(mob, 0);
        len += snprintf(buf + len, sizeof(buf) - len, "%s%3d. %s[%s%5d%s]%s Level %s%-3d%s %s%s\r\n", CCNRM(ch, C_NRM),++found,
                      CCCYN(ch, C_NRM), CCYEL(ch, C_NRM), GET_MOB_VNUM(mob), CCCYN(ch, C_NRM), CCNRM(ch, C_NRM),
                      CCYEL(ch, C_NRM), GET_LEVEL(mob), CCNRM(ch, C_NRM), GET_NAME(mob), CCNRM(ch, C_NRM));
        extract_char(mob); /* Finished with the mob - remove it from the MUD */
        if (len > sizeof(buf))
		  break;
      }
    }
  }
  if (!found)
    send_to_char(ch,"None Found!\r\n");
  else
    page_string(ch->desc, buf, TRUE);
  return;
}
Exemplo n.º 2
0
void perform_mob_level_list(struct char_data * ch, char *arg)
{
  int num, mob_level, found = 0, len;
  struct char_data *mob;
  char buf[MAX_STRING_LENGTH];

  mob_level = atoi(arg);

  if (mob_level < 0 || mob_level > 99) {
    send_to_char(ch, "Invalid mob level!\r\n");
    return;
  }

  len = snprintf(buf, sizeof(buf), "Listing mobiles of level %s%d%s\r\n", QYEL, mob_level, QNRM);
  for(num=0;num<=top_of_mobt;num++) {
    if((mob_proto[num].player.level) == mob_level) {

      if ((mob = read_mobile(num, REAL)) != NULL) {
        char_to_room(mob, 0);
        len += snprintf(buf + len, sizeof(buf) - len, "%s%3d. %s[%s%5d%s]%s %s%s\r\n", CCNRM(ch, C_NRM),++found,
                      CCCYN(ch, C_NRM), CCYEL(ch, C_NRM), GET_MOB_VNUM(mob), CCCYN(ch, C_NRM), CCNRM(ch, C_NRM),
                      GET_NAME(mob), CCNRM(ch, C_NRM));
        extract_char(mob); /* Finished with the mob - remove it from the MUD */
        if (len > sizeof(buf))
		  break;
      }
    }
  }
  if (!found)
    send_to_char(ch,"None Found!\r\n");
  else
    page_string(ch->desc, buf, TRUE);

  return;
}
Exemplo n.º 3
0
/* Set the color string pointers for that which this char will see at color
 * level NRM.  Changing the entries here will change the colour scheme
 * throughout the OLC. */
void get_char_colors(struct char_data *ch)
{
  nrm = CCNRM(ch, C_NRM);
  grn = CCGRN(ch, C_NRM);
  cyn = CCCYN(ch, C_NRM);
  yel = CCYEL(ch, C_NRM);
}
Exemplo n.º 4
0
// Returns a tmpstr allocated char* containing an appropriate ANSI
// color code for the given target struct creature (tch) with the given
// recipient struct creature(ch)'s color settings in mind.
const char *
get_char_class_color_code(struct creature *ch, struct creature *tch,
    int char_class)
{
    switch (char_class) {
    case CLASS_MAGIC_USER:
        return CCMAG(ch, C_NRM);
    case CLASS_CLERIC:
        if (IS_GOOD(tch)) {
            return CCBLU_BLD(ch, C_NRM);
        } else if (IS_EVIL(tch)) {
            return CCRED_BLD(ch, C_NRM);
        } else {
            return CCYEL(ch, C_NRM);
        }
    case CLASS_KNIGHT:
        if (IS_GOOD(tch)) {
            return CCBLU_BLD(ch, C_NRM);
        } else if (IS_EVIL(tch)) {
            return CCRED(ch, C_NRM);
        } else {
            return CCYEL(ch, C_NRM);
        }
    case CLASS_RANGER:
        return CCGRN(ch, C_NRM);
    case CLASS_BARB:
        return CCCYN(ch, C_NRM);
    case CLASS_THIEF:
        return CCNRM_BLD(ch, C_NRM);
    case CLASS_CYBORG:
        return CCCYN(ch, C_NRM);
    case CLASS_PSIONIC:
        return CCMAG(ch, C_NRM);
    case CLASS_PHYSIC:
        return CCNRM_BLD(ch, C_NRM);
    case CLASS_BARD:
        return CCYEL_BLD(ch, C_NRM);
    case CLASS_MONK:
        return CCGRN(ch, C_NRM);
    case CLASS_MERCENARY:
        return CCYEL(ch, C_NRM);
    default:
        return CCNRM(ch, C_NRM);
    }
}
Exemplo n.º 5
0
/*
* Set the colour string pointers for that which this char will
* see at color level NRM.  Changing the entries here will change
* the colour scheme throughout the OLC. */
void get_char_cols(CHAR_DATA * ch)
{
	nrm = CCNRM(ch, C_NRM);
	grn = CCGRN(ch, C_NRM);
	cyn = CCCYN(ch, C_NRM);
	yel = CCYEL(ch, C_NRM);
	iyel = CCIYEL(ch, C_NRM);
	ired = CCIRED(ch, C_NRM);
}
Exemplo n.º 6
0
void enchant::print(CHAR_DATA *ch) const
{
	send_to_char(ch, "Зачаровано %s :%s\r\n", name_.c_str(), CCCYN(ch, C_NRM));

	for (std::vector<obj_affected_type>::const_iterator i = affected_.begin(),
		iend = affected_.end(); i != iend; ++i)
	{
		print_obj_affects(ch, *i);
	}

	if (sprintbits(affects_flags_, weapon_affects, buf2, ","))
	{
		send_to_char(ch, "%s   аффекты: %s%s\r\n",
			CCCYN(ch, C_NRM), buf2, CCNRM(ch, C_NRM));
	}

	if (sprintbits(extra_flags_, extra_bits, buf2, ","))
	{
		send_to_char(ch, "%s   экстрафлаги: %s%s\r\n",
			CCCYN(ch, C_NRM), buf2, CCNRM(ch, C_NRM));
	}

	if (sprintbits(no_flags_, no_bits, buf2, ","))
	{
		send_to_char(ch, "%s   неудобен: %s%s\r\n",
			CCCYN(ch, C_NRM), buf2, CCNRM(ch, C_NRM));
	}

	if (weight_ != 0)
	{
		send_to_char(ch, "%s   %s вес на %d%s\r\n", CCCYN(ch, C_NRM),
			weight_ > 0 ? "увеличивает" : "уменьшает",
			abs(weight_), CCNRM(ch, C_NRM));
	}

	if (ndice_ != 0 || sdice_ != 0)
	{
		if (ndice_ >= 0 && sdice_ >= 0)
		{
			send_to_char(ch, "%s   увеличивает урон на %dD%d%s\r\n",
				CCCYN(ch, C_NRM), abs(ndice_), abs(sdice_), CCNRM(ch, C_NRM));
		}
		else if (ndice_ <= 0 && sdice_ <= 0)
		{
			send_to_char(ch, "%s   уменьшает урон на %dD%d%s\r\n",
				CCCYN(ch, C_NRM), abs(ndice_),  abs(sdice_), CCNRM(ch, C_NRM));
		}
		else
		{
			send_to_char(ch, "%s   изменяет урон на %+dD%+d%s\r\n",
				CCCYN(ch, C_NRM), ndice_, sdice_, CCNRM(ch, C_NRM));
		}
	}
}
Exemplo n.º 7
0
void medit_disp_class_menu(struct descriptor_data *d)
{
    int c;

    CLS(CH);
    for (c = 0; c < NUM_MOB_CLASSES; c++)
    {
        send_to_char(CH, "%2d) %-20s\r\n", c + 1, npc_classes[c]);
    }
    sprinttype(GET_RACE(MOB), npc_classes, buf1);
    send_to_char(CH, "Mob class: %s%s%s\r\n"
                 "Enter mob class, 0 to quit: ", CCCYN(CH, C_CMP), buf1, CCNRM(CH, C_CMP));
}
Exemplo n.º 8
0
void medit_disp_skill_menu(struct descriptor_data *d)
{

    CLS(CH);
    send_to_char(CH, "1) Skill: %s%s%s (%s%d%s)\r\n", CCCYN(CH, C_CMP),
                 skills[MOB->mob_specials.mob_skills[0]].name, CCNRM(CH, C_CMP), CCCYN(CH, C_CMP),
                 MOB->mob_specials.mob_skills[1], CCNRM(CH, C_CMP));
    send_to_char(CH, "2) Skill: %s%s%s (%s%d%s)\r\n", CCCYN(CH, C_CMP),
                 skills[MOB->mob_specials.mob_skills[2]].name, CCNRM(CH, C_CMP), CCCYN(CH, C_CMP),
                 MOB->mob_specials.mob_skills[3], CCNRM(CH, C_CMP));
    send_to_char(CH, "3) Skill: %s%s%s (%s%d%s)\r\n", CCCYN(CH, C_CMP),
                 skills[MOB->mob_specials.mob_skills[4]].name, CCNRM(CH, C_CMP), CCCYN(CH, C_CMP),
                 MOB->mob_specials.mob_skills[5], CCNRM(CH, C_CMP));
    send_to_char(CH, "4) Skill: %s%s%s (%s%d%s)\r\n", CCCYN(CH, C_CMP),
                 skills[MOB->mob_specials.mob_skills[6]].name, CCNRM(CH, C_CMP), CCCYN(CH, C_CMP),
                 MOB->mob_specials.mob_skills[7], CCNRM(CH, C_CMP));
    send_to_char(CH, "5) Skill: %s%s%s (%s%d%s)\r\n", CCCYN(CH, C_CMP),
                 skills[MOB->mob_specials.mob_skills[8]].name, CCNRM(CH, C_CMP), CCCYN(CH, C_CMP),
                 MOB->mob_specials.mob_skills[9], CCNRM(CH, C_CMP));
    send_to_char("0) Quit\r\n", CH);

    send_to_char("Enter your choice: ", CH);
}
Exemplo n.º 9
0
void medit_disp_affected_menu(struct descriptor_data *d)
{

    int c;

    CLS(CH);
    for (c = 0; c < AFF_MAX; c += 2)
    {
        send_to_char(CH, "%2d) %-20s %2d) %-20s\r\n",
                     c + 1, affected_bits[c],
                     c + 2, c + 1 < AFF_MAX ?
                     affected_bits[c + 1] : "");
    }
    AFF_FLAGS(MOB).PrintBits(buf1, MAX_STRING_LENGTH, affected_bits, AFF_MAX);
    send_to_char(CH, "Affected flags: %s%s%s\r\n"
                 "Enter affected flag, 0 to quit:", CCCYN(CH, C_CMP),
                 buf1, CCNRM(CH, C_CMP));
}
Exemplo n.º 10
0
void medit_disp_mobflags_menu(struct descriptor_data *d)
{

    int c;

    CLS(CH);
    for (c = 0; c < MOB_MAX; c += 2)
    {
        send_to_char(CH, "%2d) %-20s %2d) %-20s\r\n",
                     c + 1, action_bits[c],
                     c + 2, c + 1 < MOB_MAX ?
                     action_bits[c + 1] : "");
    }
    MOB_FLAGS(MOB).PrintBits(buf1, MAX_STRING_LENGTH, action_bits, MOB_MAX);
    send_to_char(CH, "Mob flags: %s%s%s\r\n"
                 "Enter mob flag, 0 to quit:", CCCYN(CH, C_CMP),
                 buf1, CCNRM(CH, C_CMP));
}
Exemplo n.º 11
0
void medit_disp_att_menu(struct descriptor_data *d)
{

    CLS(CH);
    send_to_char(CH, "1) Body:       %s%d%s\r\n", CCCYN(CH, C_CMP), GET_REAL_BOD(MOB), CCNRM(CH, C_CMP));
    send_to_char(CH, "2) Quickness:  %s%d%s\r\n", CCCYN(CH, C_CMP), GET_REAL_QUI(MOB), CCNRM(CH, C_CMP));
    send_to_char(CH, "3) Strength:   %s%d%s\r\n", CCCYN(CH, C_CMP), GET_REAL_STR(MOB), CCNRM(CH, C_CMP));
    send_to_char(CH, "4) Charisma:   %s%d%s\r\n", CCCYN(CH, C_CMP), GET_REAL_CHA(MOB), CCNRM(CH, C_CMP));
    send_to_char(CH, "5) Intel.:     %s%d%s\r\n", CCCYN(CH, C_CMP), GET_REAL_INT(MOB), CCNRM(CH, C_CMP));
    send_to_char(CH, "6) Willpower:  %s%d%s\r\n", CCCYN(CH, C_CMP), GET_REAL_WIL(MOB), CCNRM(CH, C_CMP));
    send_to_char(CH, "7) Magic:      %s%d%s\r\n", CCCYN(CH, C_CMP), MOB->real_abils.mag / 100,
                 CCNRM(CH, C_CMP));
    send_to_char(CH, "q) Quit\r\n");

    send_to_char("\r\nEnter your choice:\r\n", CH);
    d->edit_mode = MEDIT_ATTRIBUTES;
}
Exemplo n.º 12
0
int Board_show_board(int board_type, struct char_data * ch, char *arg)
{
  int i;
  char tmp[MAX_STRING_LENGTH], buf[MAX_STRING_LENGTH];

  if (!ch->desc)
    return 0;

  one_argument(arg, tmp);

  if (!*tmp || !isname(tmp, "board bulletin"))
    return 0;

  if (READ_LVL(board_type) != 0 && !COM_FLAGGED(ch, READ_LVL(board_type))) {
    send_to_char("You try but fail to understand the holy words.\r\n", ch);
    return 1;
  }
  act("$n studies the board.", TRUE, ch, 0, 0, TO_ROOM);

  strcpy(buf, "This is a bulletin board.  Usage: READ/REMOVE <messg #>, WRITE <header>.\r\n"
      "You will need to look at the board to save your message.\r\n");
  if (!num_of_msgs[board_type])
    strcat(buf, "The board is empty.\r\n");
  else {
    sprintf(buf + strlen(buf), "There are %d messages on the board.\r\n", num_of_msgs[board_type]);
    /* uncomment below if want most recent message at bottom */
    /* for (i = 0; i < num_of_msgs[board_type]; i++) { */
    for (i = num_of_msgs[board_type] - 1; i >= 0; i--) {
      if (MSG_HEADING(board_type, i))
        sprintf(buf + strlen(buf), "%s%-2d%s : %s%s\r\n", CBWHT(ch, C_NRM), i + 1, CCCYN(ch, C_NRM), MSG_HEADING(board_type, i), CCNRM(ch, C_NRM));
      else {
        stderr_log("SYSERR: The board is fubar'd.");
        send_to_char("Sorry, the board isn't working.\r\n", ch);
        return 1;
      }
    }
  }
  page_string(ch->desc, buf, 1);

  return 1;
}
Exemplo n.º 13
0
/*
 * auction_output : takes two strings and dispenses them to everyone connected
 *             based on if they have color on or not.  Note that the buf's are
 *             commonly used *color and *black so I allocate my own buffer.
 */
void auction_output(char *color, char *black)
{
	char buffer[MAX_STRING_LENGTH];
	struct descriptor_data *d;
	
	if (!auction.auctioneer)
		auction.auctioneer = str_dup(DEFAULT_AUCTIONEER);
	
	for (d = descriptor_list; d; d = d->next)
		if (!d->connected && d->character &&
			!PLR_FLAGGED(d->character, PLR_WRITING) &&
			!PRF_FLAGGED(d->character, PRF_NOAUCT) &&
			!ROOM_FLAGGED(d->character->in_room, ROOM_SOUNDPROOF) &&
			!ROOM_FLAGGED(d->character->in_room, ROOM_PRISON)) {
			sprintf(buffer, "%s%s%s auctions, '%s%s%s'%s\r\n",
				CCMAG(d->character,C_NRM), auction.auctioneer,
				CCCYN(d->character,C_NRM), CCNRM(d->character,C_NRM),
				(COLOR_LEV(d->character) > C_NRM) ? color : black,
				CCMAG(d->character,C_NRM),CCNRM(d->character,C_NRM));
			send_to_char(buffer, d->character);
		}
}
Exemplo n.º 14
0
void medit_disp_menu(struct descriptor_data *d)
{
    int base = calc_karma(NULL, MOB);

    CLS(CH);
    send_to_char(CH, "Mob number: %s%d%s\r\n", CCCYN(CH, C_CMP), d->edit_number,
                 CCNRM(CH, C_CMP));
    send_to_char(CH, "1) Keywords: %s%s%s\r\n", CCCYN(CH, C_CMP),
                 MOB->player.physical_text.keywords, CCNRM(CH, C_CMP));
    send_to_char(CH, "2) Name: %s%s%s\r\n", CCCYN(CH, C_CMP),
                 MOB->player.physical_text.name, CCNRM(CH, C_CMP));
    send_to_char(CH, "3) Room description:\r\n%s%s%s\r\n", CCCYN(CH, C_CMP),
                 MOB->player.physical_text.room_desc,CCNRM(CH, C_CMP));
    send_to_char(CH, "4) Look description:\r\n%s\r\n",
                 MOB->player.physical_text.look_desc);
    MOB_FLAGS(MOB).PrintBits(buf1, MAX_STRING_LENGTH, action_bits, MOB_MAX);
    send_to_char(CH, "5) Mob Flags: %s%s%s\r\n", CCCYN(CH, C_CMP), buf1,
                 CCNRM(CH, C_CMP));
    MOB->char_specials.saved.affected_by.PrintBits(buf1, MAX_STRING_LENGTH,
            affected_bits, AFF_MAX);
    send_to_char(CH, "6) Affected Flags: %s%s%s\r\n", CCCYN(CH, C_CMP), buf1,
                 CCNRM(CH, C_CMP));
    send_to_char(CH, "8) Avg. nuyen: %s%6d%s      Avg. credstick value: %s%6d%s\r\n", CCCYN(CH, C_CMP),
                 GET_NUYEN(MOB), CCNRM(CH, C_CMP), CCCYN(CH, C_CMP),
                 GET_BANK(MOB), CCNRM(CH, C_CMP));
    send_to_char(CH, "9) Bonus karma points: %s%d%s    (Total karma points: %s%d%s)\r\n",
                 CCCYN(CH, C_CMP), GET_KARMA(MOB), CCNRM(CH, C_CMP), CCCYN(CH, C_CMP), base, CCNRM(CH, C_CMP));
    send_to_char(CH, "a) Attributes: B(%s%d%s), Q(%s%d%s), S(%s%d%s), C(%s%d%s), "
                 "I(%s%d%s), W(%s%d%s), M(%s%d%s), R(%s%d%s)\r\n",
                 CCCYN(CH, C_CMP), GET_REAL_BOD(MOB), CCNRM(CH, C_CMP),
                 CCCYN(CH, C_CMP), GET_REAL_QUI(MOB), CCNRM(CH, C_CMP),
                 CCCYN(CH, C_CMP), GET_REAL_STR(MOB), CCNRM(CH, C_CMP),
                 CCCYN(CH, C_CMP), GET_REAL_CHA(MOB), CCNRM(CH, C_CMP),
                 CCCYN(CH, C_CMP), GET_REAL_INT(MOB), CCNRM(CH, C_CMP),
                 CCCYN(CH, C_CMP), GET_REAL_WIL(MOB), CCNRM(CH, C_CMP),
                 CCCYN(CH, C_CMP), MOB->real_abils.mag / 100, CCNRM(CH, C_CMP),
                 CCCYN(CH, C_CMP), GET_REAL_REA(MOB), CCNRM(CH, C_CMP));
    send_to_char(CH, "b) Level: %s%d%s\r\n", CCCYN(CH, C_CMP), GET_LEVEL(MOB),
                 CCNRM(CH, C_CMP));
    send_to_char(CH, "c) Ballistic: %s%d%s, ", CCCYN(CH, C_CMP), GET_BALLISTIC(MOB),
                 CCNRM(CH, C_CMP));
    send_to_char(CH, "d) Impact: %s%d%s\r\n", CCCYN(CH, C_CMP), GET_IMPACT(MOB),
                 CCNRM(CH, C_CMP));
    send_to_char(CH, "e) Max physical points: %s%d%s, f) Max mental points: %s%d%s\r\n", CCCYN(CH, C_CMP),
                 (int)(GET_MAX_PHYSICAL(MOB) / 100), CCNRM(CH, C_CMP), CCCYN(CH, C_CMP),
                 (int)(GET_MAX_MENTAL(MOB) / 100), CCNRM(CH, C_CMP));
    sprinttype(GET_POS(MOB), position_types, buf1);
    send_to_char(CH, "g) Position: %s%s%s, ", CCCYN(CH, C_CMP), buf1,
                 CCNRM(CH, C_CMP));
    sprinttype(GET_DEFAULT_POS(MOB), position_types, buf1);
    send_to_char(CH, "h) Default Position: %s%s%s\r\n", CCCYN(CH, C_CMP), buf1,
                 CCNRM(CH, C_CMP));
    sprinttype(GET_SEX(MOB), genders, buf1);
    //  strcpy(buf1, genders[GET_SEX(d->edit_mob)]);
    send_to_char(CH, "i) Gender: %s%s%s, ", CCCYN(CH, C_CMP), buf1,
                 CCNRM(CH, C_CMP));
    send_to_char(CH, "j) Weight: %s%d%s, ", CCCYN(CH, C_CMP), GET_WEIGHT(MOB),
                 CCNRM(CH, C_CMP));
    send_to_char(CH, "k) Height: %s%d%s\r\n", CCCYN(CH, C_CMP), GET_HEIGHT(MOB),
                 CCNRM(CH, C_CMP));
    sprinttype(GET_RACE(MOB), npc_classes, buf1);
    send_to_char(CH, "l) Mob class: %s%s%s\r\n", CCCYN(CH, C_CMP), buf1, CCNRM(CH, C_CMP));
    // gotta subtract TYPE_HIT to make it work properly
    sprinttype(!(MOB->mob_specials.attack_type) ? 0 :
               (MOB->mob_specials.attack_type - TYPE_HIT), attack_types, buf1);
    send_to_char(CH, "m) Attack Type: %s%s%s\r\n", CCCYN(CH, C_CMP), buf1,
                 CCNRM(CH, C_CMP));
    send_to_char("n) Skill menu.\r\n", CH);
    send_to_char(CH, "o) Arrive text: ^c%s^n,  p) Leave text: ^c%s^n\r\n",
                 MOB->mob_specials.arrive, MOB->mob_specials.leave);
    send_to_char("q) Quit and save\r\n", CH);
    send_to_char("x) Exit and abort\r\n", CH);
    send_to_char("Enter your choice:\r\n", CH);
    d->edit_mode = MEDIT_MAIN_MENU;
}