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; }
/* * message for doing damage with a spell or skill * C3.0: Also used for weapon damage on miss and death blows */ int skill_message(int dam, struct char_data * ch, struct char_data * vict, int attacktype) { int i, j, nr; struct message_type *msg; struct obj_data *weap = GET_EQ(ch, WEAR_WIELD); for (i = 0; i < MAX_MESSAGES; i++) { if (fight_messages[i].a_type == attacktype) { nr = dice(1, fight_messages[i].number_of_attacks); for (j = 1, msg = fight_messages[i].msg; (j < nr) && msg; j++) msg = msg->next; if (!IS_NPC(vict) && (GET_LEVEL(vict) >= LVL_IMMORT)) { act(msg->god_msg.attacker_msg, FALSE, ch, weap, vict, TO_CHAR); act(msg->god_msg.victim_msg, FALSE, ch, weap, vict, TO_VICT); act(msg->god_msg.room_msg, FALSE, ch, weap, vict, TO_NOTVICT); } else if (dam != 0) { if (GET_POS(vict) == POS_DEAD) { send_to_char(CCYEL(ch, C_CMP), ch); act(msg->die_msg.attacker_msg, FALSE, ch, weap, vict, TO_CHAR); send_to_char(CCNRM(ch, C_CMP), ch); send_to_char(CCRED(vict, C_CMP), vict); act(msg->die_msg.victim_msg, FALSE, ch, weap, vict, TO_VICT | TO_SLEEP); send_to_char(CCNRM(vict, C_CMP), vict); act(msg->die_msg.room_msg, FALSE, ch, weap, vict, TO_NOTVICT); } else { send_to_char(CCYEL(ch, C_CMP), ch); act(msg->hit_msg.attacker_msg, FALSE, ch, weap, vict, TO_CHAR); send_to_char(CCNRM(ch, C_CMP), ch); send_to_char(CCRED(vict, C_CMP), vict); act(msg->hit_msg.victim_msg, FALSE, ch, weap, vict, TO_VICT | TO_SLEEP); send_to_char(CCNRM(vict, C_CMP), vict); act(msg->hit_msg.room_msg, FALSE, ch, weap, vict, TO_NOTVICT); } } else if (ch != vict) { /* Dam == 0 */ send_to_char(CCYEL(ch, C_CMP), ch); act(msg->miss_msg.attacker_msg, FALSE, ch, weap, vict, TO_CHAR); send_to_char(CCNRM(ch, C_CMP), ch); send_to_char(CCRED(vict, C_CMP), vict); act(msg->miss_msg.victim_msg, FALSE, ch, weap, vict, TO_VICT | TO_SLEEP); send_to_char(CCNRM(vict, C_CMP), vict); act(msg->miss_msg.room_msg, FALSE, ch, weap, vict, TO_NOTVICT); } return (1); } } return (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); }
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; }
void check_thief(struct creature *ch, struct creature *victim) { struct creature *perp; // First we need to find the perp perp = find_responsible_party(ch, victim); int gain = pk_reputation_gain(perp, victim); if (!gain) return; gain = MAX(1, gain / 10); gain_reputation(perp, gain); send_to_char(perp, "%sYou have gained %d reputation for stealing from %s.%s\r\n", CCRED(perp, C_NRM), gain, GET_NAME(victim), CCNRM(perp, C_NRM)); send_to_char(victim, "%s%s has gained %d reputation for stealing from you.%s\r\n", CCYEL(victim, C_NRM), GET_NAME(perp), gain, CCNRM(victim, C_NRM)); mudlog(LVL_IMMORT, CMP, true, "%s gained %d reputation for stealing from %s", GET_NAME(perp), gain, GET_NAME(victim)); create_grievance(victim, perp, gain, THEFT); if (is_arena_combat(ch, victim)) mudlog(LVL_POWER, CMP, true, "%s pstealing from %s in arena", GET_NAME(perp), GET_NAME(victim)); }
void count_pkill(struct creature *killer, struct creature *victim) { bool award_bounty(struct creature *, struct creature *); struct creature *perp; if (is_arena_combat(killer, victim)) return; perp = find_responsible_party(killer, victim); GET_PKILLS(perp)++; if (award_bounty(perp, victim)) return; int gain = pk_reputation_gain(perp, victim); if (!gain) return; gain_reputation(perp, gain); send_to_char(perp, "%sYou have gained %d reputation for heinously murdering %s.%s\r\n", CCRED(killer, C_NRM), gain, GET_NAME(victim), CCNRM(perp, C_NRM)); send_to_char(victim, "%s%s has gained %d reputation for heinously murdering you.%s\r\n", CCYEL(killer, C_NRM), GET_NAME(perp), gain, CCNRM(victim, C_NRM)); mudlog(LVL_IMMORT, CMP, true, "%s gained %d reputation for murdering %s", GET_NAME(perp), gain, GET_NAME(victim)); create_grievance(victim, perp, gain, MURDER); }
void check_attack(struct creature *attacker, struct creature *victim) { bool is_bountied(struct creature *hunter, struct creature *vict); struct creature *perp; // No reputation for attacking in arena if (is_arena_combat(attacker, victim)) return; perp = find_responsible_party(attacker, victim); // no reputation for attacking a bountied person if (is_bountied(perp, victim)) return; int gain = pk_reputation_gain(perp, victim); if (!gain) return; gain = MAX(1, gain / 5); gain_reputation(perp, gain); send_to_char(perp, "%sYou have gained %d reputation for viciously attacking %s.%s\r\n", CCRED(perp, C_NRM), gain, GET_NAME(victim), CCNRM(perp, C_NRM)); send_to_char(victim, "%s%s has gained %d reputation for viciously attacking you.%s\r\n", CCYEL(victim, C_NRM), GET_NAME(perp), gain, CCNRM(victim, C_NRM)); mudlog(LVL_IMMORT, CMP, true, "%s gained %d reputation for attacking %s", GET_NAME(perp), gain, GET_NAME(victim)); create_grievance(victim, perp, gain, ATTACK); }
// 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); } }
/* * 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); }
void check_dyntext_updates(struct creature *ch) { dynamic_text_file *dyntext = NULL; for (dyntext = dyntext_list; dyntext; dyntext = dyntext->next) { if (dyntext->last_edit[0].tEdit > ch->account->entry_time) { if (!strcmp(dyntext->filename, "inews") && GET_LEVEL(ch) < LVL_AMBASSADOR) continue; if (!strcmp(dyntext->filename, "tnews") && GET_LEVEL(ch) < LVL_AMBASSADOR && !is_tester(ch)) continue; if (!strncmp(dyntext->filename, "fate", 4) || !strncmp(dyntext->filename, "arenalist", 9)) continue; send_to_char(ch, "%s [ The %s file has been updated. Use the %s command to view. ]%s\r\n", CCYEL(ch, C_NRM), dyntext->filename, dyntext->filename, CCNRM(ch, C_NRM)); } } }
/* message for doing damage with a weapon */ void dam_message(int dam, struct char_data *ch, struct char_data *victim, int w_type) { char *buf; int msgnum; static struct dam_weapon_type { const char *to_room; const char *to_char; const char *to_victim; } dam_weapons[] = { /* use #w for singular (i.e. "slash") and #W for plural (i.e. "slashes") */ { "$n tries to #w $N, but misses.", /* 0: 0 */ "You try to #w $N, but miss.", "$n tries to #w you, but misses." }, { "$n tickles $N as $e #W $M.", /* 1: 1..2 */ "You tickle $N as you #w $M.", "$n tickles you as $e #W you." }, { "$n barely #W $N.", /* 2: 3..4 */ "You barely #w $N.", "$n barely #W you." }, { "$n #W $N.", /* 3: 5..6 */ "You #w $N.", "$n #W you." }, { "$n #W $N hard.", /* 4: 7..10 */ "You #w $N hard.", "$n #W you hard." }, { "$n #W $N very hard.", /* 5: 11..14 */ "You #w $N very hard.", "$n #W you very hard." }, { "$n #W $N extremely hard.", /* 6: 15..19 */ "You #w $N extremely hard.", "$n #W you extremely hard." }, { "$n massacres $N to small fragments with $s #w.", /* 7: 19..23 */ "You massacre $N to small fragments with your #w.", "$n massacres you to small fragments with $s #w." }, { "$n OBLITERATES $N with $s deadly #w!!", /* 8: > 23 */ "You OBLITERATE $N with your deadly #w!!", "$n OBLITERATES you with $s deadly #w!!" } }; w_type -= TYPE_HIT; /* Change to base of table with text */ if (dam == 0) msgnum = 0; else if (dam <= 2) msgnum = 1; else if (dam <= 4) msgnum = 2; else if (dam <= 6) msgnum = 3; else if (dam <= 10) msgnum = 4; else if (dam <= 14) msgnum = 5; else if (dam <= 19) msgnum = 6; else if (dam <= 23) msgnum = 7; else msgnum = 8; /* damage message to onlookers */ buf = replace_string(dam_weapons[msgnum].to_room, attack_hit_text[w_type].singular, attack_hit_text[w_type].plural); act(buf, FALSE, ch, NULL, victim, CommTarget::TO_NOTVICT); /* damage message to damager */ send_to_char(ch, CCYEL(ch, C_CMP)); buf = replace_string(dam_weapons[msgnum].to_char, attack_hit_text[w_type].singular, attack_hit_text[w_type].plural); act(buf, FALSE, ch, NULL, victim, CommTarget::TO_CHAR); send_to_char(ch, CCNRM(ch, C_CMP)); /* damage message to damagee */ send_to_char(victim, CCRED(victim, C_CMP)); buf = replace_string(dam_weapons[msgnum].to_victim, attack_hit_text[w_type].singular, attack_hit_text[w_type].plural); act(buf, FALSE, ch, NULL, victim, CommTarget::TO_VICT | CommTarget::TO_SLEEP); send_to_char(victim, CCNRM(victim, C_CMP)); }