struct obj_data *unequip_char(struct char_data *ch, int pos) { int j; struct obj_data *obj; if ((pos < 0 || pos >= NUM_WEARS) || GET_EQ(ch, pos) == NULL) { core_dump(); return (NULL); } obj = GET_EQ(ch, pos); obj->worn_by = NULL; obj->worn_on = -1; if (GET_OBJ_TYPE(obj) == ITEM_ARMOR) GET_AC(ch) += apply_ac(ch, pos); if (IN_ROOM(ch) != NOWHERE) { if (pos == WEAR_LIGHT && GET_OBJ_TYPE(obj) == ITEM_LIGHT) if (GET_OBJ_VAL(obj, 2)) /* if light is ON */ world[IN_ROOM(ch)].light--; } else log("SYSERR: IN_ROOM(ch) = NOWHERE when unequipping char %s.", GET_NAME(ch)); GET_EQ(ch, pos) = NULL; for (j = 0; j < MAX_OBJ_AFFECT; j++) affect_modify_ar(ch, obj->affected[j].location, obj->affected[j].modifier, GET_OBJ_AFFECT(obj), FALSE); affect_total(ch); return (obj); }
struct obj_data *unequip_char(struct char_data *ch, int pos) { int j; struct obj_data *obj; assert(pos>=0 && pos<MAX_WEAR); assert(ch->equipment[pos]); obj = ch->equipment[pos]; assert(!obj->in_obj && obj->in_room == NOWHERE && !obj->carried_by); if (GET_ITEM_TYPE(obj) == ITEM_ARMOR) GET_AC(ch) += apply_ac(ch, pos); ch->equipment[pos] = 0; obj->equipped_by = 0; obj->eq_pos = -1; for(j=0; j<MAX_OBJ_AFFECT; j++) affect_modify(ch, obj->affected[j].location, (int)obj->affected[j].modifier, obj->obj_flags.bitvector, FALSE); affect_total(ch); return(obj); }
int compute_armor_class(struct char_data *ch) { int armorclass = GET_AC(ch); if (AWAKE(ch)) armorclass += dex_app[GET_DEX(ch)].defensive * 10; return (MAX(-100, armorclass)); /* -100 is lowest */ }
void equip_char(struct char_data *ch, struct obj_data *obj, int pos) { int j; if (pos < 0 || pos >= NUM_WEARS) { core_dump(); return; } if (GET_EQ(ch, pos)) { log("SYSERR: Char is already equipped: %s, %s", GET_NAME(ch), obj->short_description); return; } if (obj->carried_by) { log("SYSERR: EQUIP: Obj is carried_by when equip."); return; } if (IN_ROOM(obj) != NOWHERE) { log("SYSERR: EQUIP: Obj is in_room when equip."); return; } if (invalid_align(ch, obj) || invalid_class(ch, obj)) { act("You are zapped by $p and instantly let go of it.", FALSE, ch, obj, 0, TO_CHAR); act("$n is zapped by $p and instantly lets go of it.", FALSE, ch, obj, 0, TO_ROOM); /* Changed to drop in inventory instead of the ground. */ obj_to_char(obj, ch); return; } GET_EQ(ch, pos) = obj; obj->worn_by = ch; obj->worn_on = pos; if (GET_OBJ_TYPE(obj) == ITEM_ARMOR) GET_AC(ch) -= apply_ac(ch, pos); if (IN_ROOM(ch) != NOWHERE) { if (pos == WEAR_LIGHT && GET_OBJ_TYPE(obj) == ITEM_LIGHT) if (GET_OBJ_VAL(obj, 2)) /* if light is ON */ world[IN_ROOM(ch)].light++; } else log("SYSERR: IN_ROOM(ch) = NOWHERE when equipping char %s.", GET_NAME(ch)); for (j = 0; j < MAX_OBJ_AFFECT; j++) affect_modify_ar(ch, obj->affected[j].location, obj->affected[j].modifier, GET_OBJ_AFFECT(obj), TRUE); affect_total(ch); }
int DamageItem(struct char_data *ch, struct obj_data *o) { int temp,i; if (!o) return 0; if (ROOM_FLAGGED(ch->in_room, ROOM_ARENA | ROOM_PEACEFUL)) return 0; temp = number(1, 2); if(GET_OBJ_COND(o) == 101){ return FALSE; } else{ for (i = 0; i < NUM_WEARS; i++) { if (GET_EQ(ch, i)) GET_AC(ch) += apply_ac(ch, i); } GET_OBJ_COND(o) -= temp; for (i = 0; i < NUM_WEARS; i++) { if (GET_EQ(ch, i)) GET_AC(ch) -= apply_ac(ch, i); } } save_char(ch, NOWHERE); sprintf(buf, "&G%s&g was &Gdamaged&g in the combat!&n\r\n", (CAN_SEE_OBJ(ch, o) ? CAP(o->short_description) : "Something")); send_to_char(buf, ch); if (GET_OBJ_COND(o) < 0) { GET_OBJ_COND(o) = 0; return TRUE; } return FALSE; }
int write_mobile_record(mob_vnum mvnum, struct char_data *mob, FILE *fd) { char ldesc[MAX_STRING_LENGTH], ddesc[MAX_STRING_LENGTH]; ldesc[MAX_STRING_LENGTH - 1] = '\0'; ddesc[MAX_STRING_LENGTH - 1] = '\0'; strip_cr(strncpy(ldesc, GET_LDESC(mob), MAX_STRING_LENGTH - 1)); strip_cr(strncpy(ddesc, GET_DDESC(mob), MAX_STRING_LENGTH - 1)); fprintf(fd, "#%d\n" "%s%c\n" "%s%c\n" "%s%c\n" "%s%c\n", mvnum, GET_ALIAS(mob), STRING_TERMINATOR, GET_SDESC(mob), STRING_TERMINATOR, ldesc, STRING_TERMINATOR, ddesc, STRING_TERMINATOR ); fprintf(fd, "%ld %ld %d E\n" "%d %d %d %dd%d+%d %dd%d+%d\n", MOB_FLAGS(mob), AFF_FLAGS(mob), GET_ALIGNMENT(mob), GET_LEVEL(mob), 20 - GET_HITROLL(mob), GET_AC(mob) / 10, GET_HIT(mob), GET_MANA(mob), GET_MOVE(mob), GET_NDD(mob), GET_SDD(mob), GET_DAMROLL(mob) ); fprintf(fd, "%d %d\n" "%d %d %d\n", GET_GOLD(mob), GET_EXP(mob), GET_POS(mob), GET_DEFAULT_POS(mob), GET_SEX(mob) ); if (write_mobile_espec(mvnum, mob, fd) < 0) log("SYSERR: GenOLC: Error writing E-specs for mobile #%d.", mvnum); script_save_to_disk(fd, mob, MOB_TRIGGER); #if CONFIG_GENOLC_MOBPROG if (write_mobile_mobprog(mvnum, mob, fd) < 0) log("SYSERR: GenOLC: Error writing MobProgs for mobile #%d.", mvnum); #endif return TRUE; }
struct obj_data *unequip_char(struct char_data * ch, int pos) { int j; struct obj_data *obj; assert(pos >= 0 && pos < NUM_WEARS); assert(GET_EQ(ch, pos)); obj = GET_EQ(ch, pos); obj->worn_by = NULL; obj->worn_on = -1; if (GET_OBJ_TYPE(obj) == ITEM_ARMOR) GET_AC(ch) += apply_ac(ch, pos); if (ch->in_room != NOWHERE) { if (pos == WEAR_LIGHT && GET_OBJ_TYPE(obj) == ITEM_LIGHT) if (GET_OBJ_VAL(obj, 2)) /* if light is ON */ world[ch->in_room].light--; } else { log("SYSERR: ch->in_room = NOWHERE when un-equipping char."); } GET_EQ(ch, pos) = NULL; for (j = 0; j < MAX_OBJ_AFFECT; j++) affect_modify(ch, obj->affected[j].location, obj->affected[j].modifier, obj->obj_flags.bitvector, FALSE); if (affected_by_spell(ch, SKILL_ENVENOM) && (pos == WEAR_WIELD)) { send_to_char("As your weapon leaves your hand, the venom on it dissipates.\r\n", ch); affect_from_char(ch, SKILL_ENVENOM); } if (affected_by_spell(ch, SPELL_ADAMANT_MACE) && (pos == WEAR_WIELD)) affect_from_char(ch, SPELL_ADAMANT_MACE); affect_total(ch); return (obj); }
void equip_char(struct char_data *ch, struct obj_data *obj, int pos) { int j; assert(pos>=0 && pos<MAX_WEAR); assert(!(ch->equipment[pos])); if (obj->carried_by) { log("EQUIP: Obj is carried_by when equip."); return; } if (obj->in_room!=NOWHERE) { log("EQUIP: Obj is in_room when equip."); return; } if ((IS_OBJ_STAT(obj, ITEM_ANTI_EVIL) && IS_EVIL(ch)) || (IS_OBJ_STAT(obj, ITEM_ANTI_GOOD) && IS_GOOD(ch)) || (IS_OBJ_STAT(obj, ITEM_ANTI_NEUTRAL) && IS_NEUTRAL(ch))) { if (ch->in_room != NOWHERE) { /* act("You are zapped by $p and instantly drop it.", FALSE, ch, obj, 0, TO_CHAR); act("$n is zapped by $p and instantly drop it.", FALSE, ch, obj, 0, TO_ROOM); obj_to_room(obj, ch->in_room); return; */ } else { log("ch->in_room = NOWHERE when equipping char."); } } ch->equipment[pos] = obj; if (GET_ITEM_TYPE(obj) == ITEM_ARMOR) GET_AC(ch) -= apply_ac(ch, pos); for(j=0; j<MAX_OBJ_AFFECT; j++) affect_modify(ch, obj->affected[j].location, obj->affected[j].modifier, obj->obj_flags.bitvector, TRUE); affect_total(ch); }
void medit_autoroll_stats(struct descriptor_data *d) { int mob_lev; mob_lev = GET_LEVEL(OLC_MOB(d)); mob_lev = GET_LEVEL(OLC_MOB(d)) = LIMIT(mob_lev, 1, LVL_IMPL); GET_MOVE(OLC_MOB(d)) = mob_lev*10; /* hit point bonus (mobs don't use movement points */ GET_HIT(OLC_MOB(d)) = mob_lev/5; /* number of hitpoint dice */ GET_MANA(OLC_MOB(d)) = mob_lev/5; /* size of hitpoint dice */ GET_NDD(OLC_MOB(d)) = MAX(1, mob_lev/6); /* number damage dice 1-5 */ GET_SDD(OLC_MOB(d)) = MAX(2, mob_lev/6); /* size of damage dice 2-5 */ GET_DAMROLL(OLC_MOB(d)) = mob_lev/6; /* damroll (dam bonus) 0-5 */ GET_HITROLL(OLC_MOB(d)) = mob_lev/3; /* hitroll 0-10 */ GET_EXP(OLC_MOB(d)) = (mob_lev*mob_lev*100); GET_GOLD(OLC_MOB(d)) = (mob_lev*10); GET_AC(OLC_MOB(d)) = (100-(mob_lev*6)); /* AC 94 to -80 */ /* 'Advanced' stats are only rolled if advanced options are enabled */ if (CONFIG_MEDIT_ADVANCED) { GET_STR(OLC_MOB(d)) = LIMIT((mob_lev*2)/3, 11, 18); /* 2/3 level in range 11 to 18 */ GET_INT(OLC_MOB(d)) = LIMIT((mob_lev*2)/3, 11, 18); GET_WIS(OLC_MOB(d)) = LIMIT((mob_lev*2)/3, 11, 18); GET_DEX(OLC_MOB(d)) = LIMIT((mob_lev*2)/3, 11, 18); GET_CON(OLC_MOB(d)) = LIMIT((mob_lev*2)/3, 11, 18); GET_CHA(OLC_MOB(d)) = LIMIT((mob_lev*2)/3, 11, 18); GET_SAVE(OLC_MOB(d), SAVING_PARA) = mob_lev / 4; /* All Saving throws */ GET_SAVE(OLC_MOB(d), SAVING_ROD) = mob_lev / 4; /* set to a quarter */ GET_SAVE(OLC_MOB(d), SAVING_PETRI) = mob_lev / 4; /* of the mobs level */ GET_SAVE(OLC_MOB(d), SAVING_BREATH) = mob_lev / 4; GET_SAVE(OLC_MOB(d), SAVING_SPELL) = mob_lev / 4; } }
void do_mpstat(CHAR_DATA * ch, char *argument) { char buf[MAX_STRING_LENGTH]; char arg[MAX_INPUT_LENGTH]; MPROG_DATA *mprg; CHAR_DATA *victim; one_argument(argument, arg); if (arg[0] == '\0') { send_to_char(C_DEFAULT, "MobProg stat whom?\n\r", ch); return; } if ((victim = get_char_world(ch, arg)) == NULL) { send_to_char(C_DEFAULT, "They aren't here.\n\r", ch); return; } if (!IS_NPC(victim)) { send_to_char(C_DEFAULT, "Only Mobiles can have Programs!\n\r", ch); return; } if (!(victim->pIndexData->progtypes)) { send_to_char(C_DEFAULT, "That Mobile has no Programs set.\n\r", ch); return; } sprintf(buf, "Name: %s. Vnum: %d.\n\r", victim->name, victim->pIndexData->vnum); send_to_char(C_DEFAULT, buf, ch); sprintf(buf, "Short description: %s.\n\rLong description: %s", victim->short_descr, victim->long_descr[0] != '\0' ? victim->long_descr : "(none).\n\r"); send_to_char(C_DEFAULT, buf, ch); sprintf(buf, "Hp: %d/%d(%d). Mana: %d/%d(%d). Move: %d/%d(%d).\n\r", victim->hit, victim->perm_hit, MAX_HIT(victim), victim->mana, victim->perm_mana, MAX_MANA(victim), victim->move, victim->perm_move, MAX_MOVE(victim)); send_to_char(C_DEFAULT, buf, ch); #ifdef NEW_MONEY sprintf(buf, "Lv: %d. Class: %s. Align: %d. AC: %d. Exp: %d.\n\r", victim->level, class_numbers(victim, FALSE), victim->alignment, GET_AC(victim), victim->exp); send_to_char(C_DEFAULT, buf, ch); sprintf(buf, "Gold: %d Silver: %d Copper: %d.\n\r", victim->money.gold, victim->money.silver, victim->money.copper); send_to_char(C_DEFAULT, buf, ch); #else sprintf(buf, "Lv: %d. Class: %s. Align: %d. AC: %d. Gold: %d. Exp: %d.\n\r", victim->level, class_numbers(victim, FALSE), victim->alignment, GET_AC(victim), victim->gold, victim->exp); send_to_char(C_DEFAULT, buf, ch); #endif for (mprg = victim->pIndexData->mobprogs; mprg != NULL; mprg = mprg->next) { sprintf(buf, ">%s %s\n\r%s\n\r\n\r", mprog_type_to_name(mprg->type), mprg->arglist, mprg->comlist); send_to_char(C_DEFAULT, buf, ch); } return; }
void affect_modify(struct char_data *ch,byte loc, long mod, long bitv,bool add) { int i; char buff[200]; if (loc == APPLY_IMMUNE) { if (add) { if(bitv && !mod) SET_BIT(ch->immune, bitv); else SET_BIT(ch->immune, mod); } else { if(bitv && !mod) REMOVE_BIT(ch->immune, bitv); else REMOVE_BIT(ch->immune, mod); } } else if (loc == APPLY_SUSC) { if (add) { SET_BIT(ch->susc, mod); } else { REMOVE_BIT(ch->susc, mod); } } else if (loc == APPLY_M_IMMUNE) { if (add) { SET_BIT(ch->M_immune, mod); } else { REMOVE_BIT(ch->M_immune, mod); } } else if (loc == APPLY_SPELL) { if (add) { SET_BIT(ch->specials.affected_by, mod); } else { REMOVE_BIT(ch->specials.affected_by, mod); } } else if (loc == APPLY_WEAPON_SPELL) { return; } else if (loc == APPLY_BV2) { if (add) { SET_BIT(ch->specials.affected_by2, bitv); } else { REMOVE_BIT(ch->specials.affected_by2, bitv); } return; } else { if (add) { SET_BIT(ch->specials.affected_by, bitv); } else { REMOVE_BIT(ch->specials.affected_by, bitv); mod = -mod; } } switch(loc) { case APPLY_NONE: case APPLY_INTRINSIC: break; case APPLY_STR: ChangeStrength(ch, mod); break; case APPLY_DEX: #if 0 temp = GET_DEX(ch); temp2=GET_DEX(ch); if(temp2 < ch->abilities.dex) GET_DEX(ch)=ch->abilities.dex; if(temp > 18) temp=18; if(GET_DEX(ch) > 18) GET_DEX(ch)=18; GET_AC(ch) -= dex_app[temp].defensive; GET_AC(ch) += dex_app[GET_DEX(ch)].defensive; #endif GET_DEX(ch) += mod; break; case APPLY_INT: GET_INT(ch) += mod; break; case APPLY_WIS: GET_WIS(ch) += mod; break; case APPLY_CON: GET_CON(ch) += mod; break; case APPLY_SEX: GET_SEX(ch) = (!(ch->player.sex-1))+1; break; case APPLY_CHR: GET_CHR(ch) += mod; break; case APPLY_LEVEL: break; case APPLY_AGE: ch->player.time.birth -= SECS_PER_MUD_YEAR*mod; break; case APPLY_CHAR_WEIGHT: GET_WEIGHT(ch) += mod; break; case APPLY_CHAR_HEIGHT: GET_HEIGHT(ch) += mod; break; case APPLY_MANA: ch->points.max_mana += mod; break; case APPLY_HIT: /* ch->points.max_hit += mod; */ ch->points.max_hit += mod; break; case APPLY_MOVE: ch->points.max_move += mod; break; case APPLY_GOLD: break; case APPLY_EXP: break; case APPLY_AC: GET_AC(ch) += mod; break; case APPLY_HITROLL: GET_HITROLL(ch) += mod; break; case APPLY_DAMROLL: GET_DAMROLL(ch) += mod; break; /* negatives make saving throws better */ case APPLY_SAVING_PARA: ch->specials.apply_saving_throw[0] += mod; break; case APPLY_SAVING_ROD: ch->specials.apply_saving_throw[1] += mod; break; case APPLY_SAVING_PETRI: ch->specials.apply_saving_throw[2] += mod; break; case APPLY_SAVING_BREATH: ch->specials.apply_saving_throw[3] += mod; break; case APPLY_SAVING_SPELL: ch->specials.apply_saving_throw[4] += mod; break; case APPLY_SAVE_ALL: { for (i=0;i<=4;i++) ch->specials.apply_saving_throw[i] += mod; } break; case APPLY_IMMUNE: break; case APPLY_SUSC: break; case APPLY_M_IMMUNE: break; case APPLY_SPELL: break; case APPLY_HITNDAM: GET_HITROLL(ch) += mod; GET_DAMROLL(ch) += mod; break; case APPLY_WEAPON_SPELL: case APPLY_EAT_SPELL: break; case APPLY_BACKSTAB: if (!ch->skills) return; ch->skills[SKILL_BACKSTAB].learned += mod; break; case APPLY_KICK: if (!ch->skills) return; ch->skills[SKILL_KICK].learned += mod; break; case APPLY_SNEAK: if (!ch->skills) return; ch->skills[SKILL_SNEAK].learned += mod; break; case APPLY_HIDE: if (!ch->skills) return; ch->skills[SKILL_HIDE].learned += mod; break; case APPLY_BASH: if (!ch->skills) return; ch->skills[SKILL_BASH].learned += mod; break; case APPLY_PICK: if (!ch->skills) return; ch->skills[SKILL_PICK_LOCK].learned += mod; break; case APPLY_STEAL: if (!ch->skills) return; ch->skills[SKILL_STEAL].learned += mod; break; case APPLY_TRACK: if (!ch->skills) return; ch->skills[SKILL_HUNT].learned += mod; break; case APPLY_SPELLFAIL: ch->specials.spellfail += mod; break; case APPLY_HASTE: if (mod > 0) { if (WizLock) fprintf(stderr, "current mult = %f\n", ch->mult_att); ch->mult_att = ch->mult_att * 2.0; if (WizLock) fprintf(stderr, "new mult = %f\n", ch->mult_att); } else if (mod < 0) { ch->mult_att = ch->mult_att / 2.0; } break; case APPLY_SLOW: if (mod > 0) ch->mult_att /= 2.0; else if (mod < 0) ch->mult_att *= 2.0; break; case APPLY_ATTACKS: break; case APPLY_FIND_TRAPS: if (!ch->skills) return; ch->skills[SKILL_LOCATE_TRAP].learned += mod; break; case APPLY_RIDE: if (!ch->skills) return; ch->skills[SKILL_RIDE].learned += mod; break; case APPLY_RACE_SLAYER: case APPLY_ALIGN_SLAYER: break; case APPLY_MANA_REGEN: ch->points.mana_gain += mod; break; case APPLY_HIT_REGEN: ch->points.hit_gain += mod; break; case APPLY_MOVE_REGEN: ch->points.move_gain += mod; break; case APPLY_MOVE_BONUS: ch->specials.move_cost += mod; break; default: logE("Unknown apply adjust attempt (handler.c, affect_modify)."); logE(ch->player.name); break; } /* switch */ }
/* * New score command by Haus */ void do_score( CHAR_DATA* ch, const char* argument ) { char buf[MAX_STRING_LENGTH]; AFFECT_DATA *paf; int iLang; /*const char *suf; short day; day = ch->pcdata->day + 1; if( day > 4 && day < 20 ) suf = "th"; else if( day % 10 == 1 ) suf = "st"; else if( day % 10 == 2 ) suf = "nd"; else if( day % 10 == 3 ) suf = "rd"; else suf = "th"; * - Uncomment this if you want Birthdays dispayed on score for players - Kayle 1/22/08 */ set_pager_color( AT_SCORE, ch ); pager_printf( ch, "\r\nScore for %s%s.\r\n", ch->name, IS_NPC(ch) ? "" : ch->pcdata->title ); if( get_trust( ch ) != ch->level ) pager_printf( ch, "You are trusted at level %d.\r\n", get_trust( ch ) ); send_to_pager( "----------------------------------------------------------------------------\r\n", ch ); /*if( time_info.day == ch->pcdata->day && time_info.month == ch->pcdata->month ) send_to_char( "Today is your birthday!\r\n", ch ); else ch_printf( ch, "Your birthday is: Day of %s, %d%s day in the Month of %s, in the year %d.\r\n", day_name[ch->pcdata->day % sysdata.daysperweek], day, suf, month_name[ch->pcdata->month], ch->pcdata->year ); send_to_pager( "----------------------------------------------------------------------------\r\n", ch ); * - Uncomment this if you want players to see their birthday's on score. - Kayle 1/22/08 */ pager_printf( ch, "LEVEL: %-3d Race : %-10.10s Played: %ld hours\r\n", ch->level, capitalize( get_race( ch ) ), ( long int )GET_TIME_PLAYED( ch ) ); pager_printf( ch, "YEARS: %-6d Class: %-11.11s Log In: %s\r", calculate_age( ch ), capitalize( get_class( ch ) ), ctime( &( ch->logon ) ) ); if( ch->level >= 15 || IS_PKILL( ch ) ) { pager_printf( ch, "STR : %2.2d(%2.2d) HitRoll: %-4d Saved: %s\r", get_curr_str( ch ), ch->perm_str, GET_HITROLL( ch ), ch->save_time ? ctime( &( ch->save_time ) ) : "no save this session\n" ); pager_printf( ch, "INT : %2.2d(%2.2d) DamRoll: %-4d Time: %s\r", get_curr_int( ch ), ch->perm_int, GET_DAMROLL( ch ), ctime( ¤t_time ) ); } else { pager_printf( ch, "STR : %2.2d(%2.2d) Saved: %s\r", get_curr_str( ch ), ch->perm_str, ch->save_time ? ctime( &( ch->save_time ) ) : "no\n" ); pager_printf( ch, "INT : %2.2d(%2.2d) Time: %s\r", get_curr_int( ch ), ch->perm_int, ctime( ¤t_time ) ); } if( GET_AC( ch ) >= 101 ) snprintf( buf, MAX_STRING_LENGTH, "%s", "the rags of a beggar" ); else if( GET_AC( ch ) >= 80 ) snprintf( buf, MAX_STRING_LENGTH, "%s", "improper for adventure" ); else if( GET_AC( ch ) >= 55 ) snprintf( buf, MAX_STRING_LENGTH, "%s", "shabby and threadbare" ); else if( GET_AC( ch ) >= 40 ) snprintf( buf, MAX_STRING_LENGTH, "%s", "of poor quality" ); else if( GET_AC( ch ) >= 20 ) snprintf( buf, MAX_STRING_LENGTH, "%s", "scant protection" ); else if( GET_AC( ch ) >= 10 ) snprintf( buf, MAX_STRING_LENGTH, "%s", "that of a knave" ); else if( GET_AC( ch ) >= 0 ) snprintf( buf, MAX_STRING_LENGTH, "%s", "moderately crafted" ); else if( GET_AC( ch ) >= -10 ) snprintf( buf, MAX_STRING_LENGTH, "%s", "well crafted" ); else if( GET_AC( ch ) >= -20 ) snprintf( buf, MAX_STRING_LENGTH, "%s", "the envy of squires" ); else if( GET_AC( ch ) >= -40 ) snprintf( buf, MAX_STRING_LENGTH, "%s", "excellently crafted" ); else if( GET_AC( ch ) >= -60 ) snprintf( buf, MAX_STRING_LENGTH, "%s", "the envy of knights" ); else if( GET_AC( ch ) >= -80 ) snprintf( buf, MAX_STRING_LENGTH, "%s", "the envy of barons" ); else if( GET_AC( ch ) >= -100 ) snprintf( buf, MAX_STRING_LENGTH, "%s", "the envy of dukes" ); else if( GET_AC( ch ) >= -200 ) snprintf( buf, MAX_STRING_LENGTH, "%s", "the envy of emperors" ); else snprintf( buf, MAX_STRING_LENGTH, "%s", "that of an avatar" ); if( ch->level > 24 ) pager_printf( ch, "WIS : %2.2d(%2.2d) Armor: %4.4d, %s\r\n", get_curr_wis( ch ), ch->perm_wis, GET_AC( ch ), buf ); else pager_printf( ch, "WIS : %2.2d(%2.2d) Armor: %s \r\n", get_curr_wis( ch ), ch->perm_wis, buf ); if( ch->alignment > 900 ) snprintf( buf, MAX_STRING_LENGTH, "%s", "devout" ); else if( ch->alignment > 700 ) snprintf( buf, MAX_STRING_LENGTH, "%s", "noble" ); else if( ch->alignment > 350 ) snprintf( buf, MAX_STRING_LENGTH, "%s", "honorable" ); else if( ch->alignment > 100 ) snprintf( buf, MAX_STRING_LENGTH, "%s", "worthy" ); else if( ch->alignment > -100 ) snprintf( buf, MAX_STRING_LENGTH, "%s", "neutral" ); else if( ch->alignment > -350 ) snprintf( buf, MAX_STRING_LENGTH, "%s", "base" ); else if( ch->alignment > -700 ) snprintf( buf, MAX_STRING_LENGTH, "%s", "evil" ); else if( ch->alignment > -900 ) snprintf( buf, MAX_STRING_LENGTH, "%s", "ignoble" ); else snprintf( buf, MAX_STRING_LENGTH, "%s", "fiendish" ); if( ch->level < 10 ) pager_printf( ch, "DEX : %2.2d(%2.2d) Align: %-20.20s Items: %5.5d (max %5.5d)\r\n", get_curr_dex( ch ), ch->perm_dex, buf, ch->carry_number, can_carry_n( ch ) ); else pager_printf( ch, "DEX : %2.2d(%2.2d) Align: %+4.4d, %-14.14s Items: %5.5d (max %5.5d)\r\n", get_curr_dex( ch ), ch->perm_dex, ch->alignment, buf, ch->carry_number, can_carry_n( ch ) ); switch ( ch->position ) { case POS_DEAD: snprintf( buf, MAX_STRING_LENGTH, "%s", "slowly decomposing" ); break; case POS_MORTAL: snprintf( buf, MAX_STRING_LENGTH, "%s", "mortally wounded" ); break; case POS_INCAP: snprintf( buf, MAX_STRING_LENGTH, "%s", "incapacitated" ); break; case POS_STUNNED: snprintf( buf, MAX_STRING_LENGTH, "%s", "stunned" ); break; case POS_SLEEPING: snprintf( buf, MAX_STRING_LENGTH, "%s", "sleeping" ); break; case POS_RESTING: snprintf( buf, MAX_STRING_LENGTH, "%s", "resting" ); break; case POS_STANDING: snprintf( buf, MAX_STRING_LENGTH, "%s", "standing" ); break; case POS_FIGHTING: snprintf( buf, MAX_STRING_LENGTH, "%s", "fighting" ); break; case POS_EVASIVE: snprintf( buf, MAX_STRING_LENGTH, "%s", "fighting (evasive)" ); /* Fighting style support -haus */ break; case POS_DEFENSIVE: snprintf( buf, MAX_STRING_LENGTH, "%s", "fighting (defensive)" ); break; case POS_AGGRESSIVE: snprintf( buf, MAX_STRING_LENGTH, "%s", "fighting (aggressive)" ); break; case POS_BERSERK: snprintf( buf, MAX_STRING_LENGTH, "%s", "fighting (berserk)" ); break; case POS_MOUNTED: snprintf( buf, MAX_STRING_LENGTH, "%s", "mounted" ); break; case POS_SITTING: snprintf( buf, MAX_STRING_LENGTH, "%s", "sitting" ); break; } pager_printf( ch, "CON : %2.2d(%2.2d) Pos'n: %-21.21s Weight: %5.5d (max %7.7d)\r\n", get_curr_con( ch ), ch->perm_con, buf, ch->carry_weight, can_carry_w( ch ) ); /* * Fighting style support -haus */ pager_printf( ch, "CHA : %2.2d(%2.2d) Wimpy: %-5d ", get_curr_cha( ch ), ch->perm_cha, ch->wimpy ); switch ( ch->style ) { case STYLE_EVASIVE: snprintf( buf, MAX_STRING_LENGTH, "%s", "evasive" ); break; case STYLE_DEFENSIVE: snprintf( buf, MAX_STRING_LENGTH, "%s", "defensive" ); break; case STYLE_AGGRESSIVE: snprintf( buf, MAX_STRING_LENGTH, "%s", "aggressive" ); break; case STYLE_BERSERK: snprintf( buf, MAX_STRING_LENGTH, "%s", "berserk" ); break; default: snprintf( buf, MAX_STRING_LENGTH, "%s", "standard" ); break; } pager_printf( ch, "Style: %-10.10s\r\n", buf ); pager_printf( ch, "LCK : %2.2d(%2.2d) \r\n", get_curr_lck( ch ), ch->perm_lck ); pager_printf( ch, "Glory: %4.4d(%4.4d) \r\n", ch->pcdata->quest_curr, ch->pcdata->quest_accum ); pager_printf( ch, "PRACT: %3.3d Hitpoints: %-5d of %5d Pager: (%c) %3d AutoExit(%c)\r\n", ch->practice, ch->hit, ch->max_hit, IS_SET( ch->pcdata->flags, PCFLAG_PAGERON ) ? 'X' : ' ', ch->pcdata->pagerlen, xIS_SET( ch->act, PLR_AUTOEXIT ) ? 'X' : ' ' ); if( IS_VAMPIRE( ch ) ) pager_printf( ch, "XP : %-9d Blood: %-5d of %5d MKills: %-5.5d AutoLoot(%c)\r\n", ch->exp, ch->pcdata->condition[COND_BLOODTHIRST], 10 + ch->level, ch->pcdata->mkills, xIS_SET( ch->act, PLR_AUTOLOOT ) ? 'X' : ' ' ); else if( ch->Class == CLASS_WARRIOR ) pager_printf( ch, "XP : %-9d MKills: %-5.5d AutoLoot(%c)\r\n", ch->exp, ch->pcdata->mkills, xIS_SET( ch->act, PLR_AUTOLOOT ) ? 'X' : ' ' ); else pager_printf( ch, "XP : %-9d Mana: %-5d of %5d MKills: %-5.5d AutoLoot(%c)\r\n", ch->exp, ch->mana, ch->max_mana, ch->pcdata->mkills, xIS_SET( ch->act, PLR_AUTOLOOT ) ? 'X' : ' ' ); pager_printf( ch, "GOLD : %-13s Move: %-5d of %5d Mdeaths: %-5.5d AutoSac (%c)\r\n", num_punct( ch->gold ), ch->move, ch->max_move, ch->pcdata->mdeaths, xIS_SET( ch->act, PLR_AUTOSAC ) ? 'X' : ' ' ); if( !IS_NPC( ch ) && ch->pcdata->condition[COND_DRUNK] > 10 ) send_to_pager( "You are drunk.\r\n", ch ); if( !IS_NPC( ch ) && ch->pcdata->condition[COND_THIRST] == 0 ) send_to_pager( "You are in danger of dehydrating.\r\n", ch ); if( !IS_NPC( ch ) && ch->pcdata->condition[COND_FULL] == 0 ) send_to_pager( "You are starving to death.\r\n", ch ); if( ch->position != POS_SLEEPING ) switch ( ch->mental_state / 10 ) { default: send_to_pager( "You're completely messed up!\r\n", ch ); break; case -10: send_to_pager( "You're barely conscious.\r\n", ch ); break; case -9: send_to_pager( "You can barely keep your eyes open.\r\n", ch ); break; case -8: send_to_pager( "You're extremely drowsy.\r\n", ch ); break; case -7: send_to_pager( "You feel very unmotivated.\r\n", ch ); break; case -6: send_to_pager( "You feel sedated.\r\n", ch ); break; case -5: send_to_pager( "You feel sleepy.\r\n", ch ); break; case -4: send_to_pager( "You feel tired.\r\n", ch ); break; case -3: send_to_pager( "You could use a rest.\r\n", ch ); break; case -2: send_to_pager( "You feel a little under the weather.\r\n", ch ); break; case -1: send_to_pager( "You feel fine.\r\n", ch ); break; case 0: send_to_pager( "You feel great.\r\n", ch ); break; case 1: send_to_pager( "You feel energetic.\r\n", ch ); break; case 2: send_to_pager( "Your mind is racing.\r\n", ch ); break; case 3: send_to_pager( "You can't think straight.\r\n", ch ); break; case 4: send_to_pager( "Your mind is going 100 miles an hour.\r\n", ch ); break; case 5: send_to_pager( "You're high as a kite.\r\n", ch ); break; case 6: send_to_pager( "Your mind and body are slipping apart.\r\n", ch ); break; case 7: send_to_pager( "Reality is slipping away.\r\n", ch ); break; case 8: send_to_pager( "You have no idea what is real, and what is not.\r\n", ch ); break; case 9: send_to_pager( "You feel immortal.\r\n", ch ); break; case 10: send_to_pager( "You are a Supreme Entity.\r\n", ch ); break; } else if( ch->mental_state > 45 ) send_to_pager( "Your sleep is filled with strange and vivid dreams.\r\n", ch ); else if( ch->mental_state > 25 ) send_to_pager( "Your sleep is uneasy.\r\n", ch ); else if( ch->mental_state < -35 ) send_to_pager( "You are deep in a much needed sleep.\r\n", ch ); else if( ch->mental_state < -25 ) send_to_pager( "You are in deep slumber.\r\n", ch ); send_to_pager( "Languages: ", ch ); for( iLang = 0; lang_array[iLang] != LANG_UNKNOWN; iLang++ ) if( knows_language( ch, lang_array[iLang], ch ) || ( IS_NPC( ch ) && ch->speaks == 0 ) ) { if( lang_array[iLang] & ch->speaking || ( IS_NPC( ch ) && !ch->speaking ) ) set_pager_color( AT_RED, ch ); send_to_pager( lang_names[iLang], ch ); send_to_pager( " ", ch ); set_pager_color( AT_SCORE, ch ); } send_to_pager( "\r\n", ch ); if( ch->pcdata->bestowments && ch->pcdata->bestowments[0] != '\0' ) pager_printf( ch, "You are bestowed with the command(s): %s.\r\n", ch->pcdata->bestowments ); if( ch->morph && ch->morph->morph ) { send_to_pager( "----------------------------------------------------------------------------\r\n", ch ); if( IS_IMMORTAL( ch ) ) pager_printf( ch, "Morphed as (%d) %s with a timer of %d.\r\n", ch->morph->morph->vnum, ch->morph->morph->short_desc, ch->morph->timer ); else pager_printf( ch, "You are morphed into a %s.\r\n", ch->morph->morph->short_desc ); send_to_pager( "----------------------------------------------------------------------------\r\n", ch ); } if( CAN_PKILL( ch ) ) { send_to_pager( "----------------------------------------------------------------------------\r\n", ch ); pager_printf( ch, "PKILL DATA: Pkills (%3.3d) Illegal Pkills (%3.3d) Pdeaths (%3.3d)\r\n", ch->pcdata->pkills, ch->pcdata->illegal_pk, ch->pcdata->pdeaths ); } if( ch->pcdata->clan && ch->pcdata->clan->clan_type != CLAN_ORDER && ch->pcdata->clan->clan_type != CLAN_GUILD ) { send_to_pager( "----------------------------------------------------------------------------\r\n", ch ); pager_printf( ch, "CLAN STATS: %-14.14s Clan AvPkills : %-5d Clan NonAvpkills : %-5d\r\n", ch->pcdata->clan->name, ch->pcdata->clan->pkills[6], ( ch->pcdata->clan->pkills[1] + ch->pcdata->clan->pkills[2] + ch->pcdata->clan->pkills[3] + ch->pcdata->clan->pkills[4] + ch->pcdata->clan->pkills[5] ) ); pager_printf( ch, " Clan AvPdeaths: %-5d Clan NonAvpdeaths: %-5d\r\n", ch->pcdata->clan->pdeaths[6], ( ch->pcdata->clan->pdeaths[1] + ch->pcdata->clan->pdeaths[2] + ch->pcdata->clan->pdeaths[3] + ch->pcdata->clan->pdeaths[4] + ch->pcdata->clan->pdeaths[5] ) ); } if( ch->pcdata->deity ) { send_to_pager( "----------------------------------------------------------------------------\r\n", ch ); if( ch->pcdata->favor > 2250 ) snprintf( buf, MAX_STRING_LENGTH, "%s", "loved" ); else if( ch->pcdata->favor > 2000 ) snprintf( buf, MAX_STRING_LENGTH, "%s", "cherished" ); else if( ch->pcdata->favor > 1750 ) snprintf( buf, MAX_STRING_LENGTH, "%s", "honored" ); else if( ch->pcdata->favor > 1500 ) snprintf( buf, MAX_STRING_LENGTH, "%s", "praised" ); else if( ch->pcdata->favor > 1250 ) snprintf( buf, MAX_STRING_LENGTH, "%s", "favored" ); else if( ch->pcdata->favor > 1000 ) snprintf( buf, MAX_STRING_LENGTH, "%s", "respected" ); else if( ch->pcdata->favor > 750 ) snprintf( buf, MAX_STRING_LENGTH, "%s", "liked" ); else if( ch->pcdata->favor > 250 ) snprintf( buf, MAX_STRING_LENGTH, "%s", "tolerated" ); else if( ch->pcdata->favor > -250 ) snprintf( buf, MAX_STRING_LENGTH, "%s", "ignored" ); else if( ch->pcdata->favor > -750 ) snprintf( buf, MAX_STRING_LENGTH, "%s", "shunned" ); else if( ch->pcdata->favor > -1000 ) snprintf( buf, MAX_STRING_LENGTH, "%s", "disliked" ); else if( ch->pcdata->favor > -1250 ) snprintf( buf, MAX_STRING_LENGTH, "%s", "dishonored" ); else if( ch->pcdata->favor > -1500 ) snprintf( buf, MAX_STRING_LENGTH, "%s", "disowned" ); else if( ch->pcdata->favor > -1750 ) snprintf( buf, MAX_STRING_LENGTH, "%s", "abandoned" ); else if( ch->pcdata->favor > -2000 ) snprintf( buf, MAX_STRING_LENGTH, "%s", "despised" ); else if( ch->pcdata->favor > -2250 ) snprintf( buf, MAX_STRING_LENGTH, "%s", "hated" ); else snprintf( buf, MAX_STRING_LENGTH, "%s", "damned" ); pager_printf( ch, "Deity: %-20s Favor: %s\r\n", ch->pcdata->deity->name, buf ); } if( ch->pcdata->clan && ch->pcdata->clan->clan_type == CLAN_ORDER ) { send_to_pager( "----------------------------------------------------------------------------\r\n", ch ); pager_printf( ch, "Order: %-20s Order Mkills: %-6d Order MDeaths: %-6d\r\n", ch->pcdata->clan->name, ch->pcdata->clan->mkills, ch->pcdata->clan->mdeaths ); } if( ch->pcdata->clan && ch->pcdata->clan->clan_type == CLAN_GUILD ) { send_to_pager( "----------------------------------------------------------------------------\r\n", ch ); pager_printf( ch, "Guild: %-20s Guild Mkills: %-6d Guild MDeaths: %-6d\r\n", ch->pcdata->clan->name, ch->pcdata->clan->mkills, ch->pcdata->clan->mdeaths ); } if( IS_IMMORTAL( ch ) ) { send_to_pager( "----------------------------------------------------------------------------\r\n", ch ); pager_printf( ch, "IMMORTAL DATA: Wizinvis [%s] Wizlevel (%d)\r\n", xIS_SET( ch->act, PLR_WIZINVIS ) ? "X" : " ", ch->pcdata->wizinvis ); pager_printf( ch, "Bamfin: %s %s\r\n", ch->name, ( ch->pcdata->bamfin[0] != '\0' ) ? ch->pcdata->bamfin : "appears in a swirling mist." ); pager_printf( ch, "Bamfout: %s %s\r\n", ch->name, ( ch->pcdata->bamfout[0] != '\0' ) ? ch->pcdata->bamfout : "leaves in a swirling mist." ); /* * Area Loaded info - Scryn 8/11 */ if( ch->pcdata->area ) { pager_printf( ch, "Vnums: Room (%-5.5d - %-5.5d) Object (%-5.5d - %-5.5d) Mob (%-5.5d - %-5.5d)\r\n", ch->pcdata->area->low_r_vnum, ch->pcdata->area->hi_r_vnum, ch->pcdata->area->low_o_vnum, ch->pcdata->area->hi_o_vnum, ch->pcdata->area->low_m_vnum, ch->pcdata->area->hi_m_vnum ); pager_printf( ch, "Area Loaded [%s]\r\n", ( IS_SET( ch->pcdata->area->status, AREA_LOADED ) ) ? "yes" : "no" ); } } if( ch->first_affect ) { int i; SKILLTYPE *sktmp; i = 0; send_to_pager( "----------------------------------------------------------------------------\r\n", ch ); send_to_pager( "AFFECT DATA: ", ch ); for( paf = ch->first_affect; paf; paf = paf->next ) { if( ( sktmp = get_skilltype( paf->type ) ) == NULL ) continue; if( ch->level < 20 ) { pager_printf( ch, "[%-34.34s] ", sktmp->name ); if( i == 0 ) i = 2; if( ( ++i % 3 ) == 0 ) send_to_pager( "\r\n", ch ); } if( ch->level >= 20 ) { if( paf->modifier == 0 ) pager_printf( ch, "[%-24.24s;%5d rds] ", sktmp->name, paf->duration ); else if( paf->modifier > 999 ) pager_printf( ch, "[%-15.15s; %7.7s;%5d rds] ", sktmp->name, tiny_affect_loc_name( paf->location ), paf->duration ); else pager_printf( ch, "[%-11.11s;%+-3.3d %7.7s;%5d rds] ", sktmp->name, paf->modifier, tiny_affect_loc_name( paf->location ), paf->duration ); if( i == 0 ) i = 1; if( ( ++i % 2 ) == 0 ) send_to_pager( "\r\n", ch ); } } } send_to_pager( "\r\n", ch ); return; }
void convert_mobs_to_disk(int zone_num) { int i, rmob_num, zone, top; FILE *mob_file; char fname[64]; struct char_data *mob; struct mob_attacks_data *attack; struct mob_equipment_data *equipment; struct mob_action_data *action; MPROG_DATA *mob_prog; zone = zone_table[zone_num].number; top = zone_table[zone_num].top; sprintf(fname, "%s/%i.mob", MOB_PREFIX, zone); if (!(mob_file = fopen(fname, "w"))) { mudlog("SYSERR: OLC: Cannot open mob file!", 'G', COM_BUILDER, TRUE); return; } /*. Seach database for mobs in this zone and save em .*/ for (i = zone * 100; i <= top; i++) { rmob_num = real_mobile(i); if (rmob_num != -1) { if (fprintf(mob_file, "#%d\n", i) < 0) { mudlog("SYSERR: OLC: Cannot write mob file!\r\n", 'G', COM_BUILDER, TRUE); fclose(mob_file); return; } mob = (mob_proto + rmob_num); attack = GET_ATTACKS(mob); equipment = GET_EQUIP(mob); action = GET_ACTION(mob); mob_prog = mob_index[rmob_num].mobprogs; /*. Clean up strings .*/ strcpy(buf1, GET_LDESC(mob)); strip_string(buf1); if (GET_DDESC(mob)) { strcpy(buf2, GET_DDESC(mob)); strip_string(buf2); } else strcpy(buf2, ""); fprintf(mob_file, "%s~\n" "%s~\n" "%s~\n" "%s~\n" "%ld %ld %i X\n" "%d %d %i %dd%d+%d %dd%d+%d\n" "%d %d\n" /*. Gold & Exp are longs in my mud, ignore any warning .*/ "%d %d %d %d %d %d\n", GET_ALIAS(mob), GET_SDESC(mob), buf1, buf2, MOB_FLAGS(mob), AFF_FLAGS(mob), GET_ALIGNMENT(mob), GET_LEVEL(mob), GET_HITROLL(mob), GET_AC(mob) / 10, GET_HIT(mob), GET_MANA(mob), GET_MOVE(mob), GET_NDD(mob), GET_SDD(mob), GET_DAMROLL(mob), GET_GOLD(mob), GET_EXP(mob), GET_POS(mob), GET_DEFAULT_POS(mob), GET_SEX(mob), GET_CLASS(mob), GET_RACE(mob), GET_SIZE(mob)); while (attack) { fprintf(mob_file, "T %d %dd%d+%d %d\n", attack->attacks, attack->nodice, attack->sizedice, attack->damroll, attack->attack_type); attack = attack->next; } while (action) { fprintf(mob_file, "A %d %d %s\n", action->chance, action->minpos, action->action); action = action->next; } while (equipment) { fprintf(mob_file, "E %d %d %d %d\n", equipment->pos, equipment->chance, equipment->vnum, equipment->max); equipment = equipment->next; } /*. Deal with Extra stats in case they are there .*/ if ((GET_STR(mob) != 11) && (GET_STR(mob) < 19)) fprintf(mob_file, "Str: %d\n", (GET_STR(mob) * 5)); else if ((GET_STR(mob) > 18) && (GET_STR(mob) != 50)) fprintf(mob_file, "Str: 100\n"); if ((GET_DEX(mob) != 11) && (GET_DEX(mob) < 19)) { fprintf(mob_file, "Dex: %d\n", (GET_DEX(mob) * 5)); fprintf(mob_file, "Agi: %d\n", (GET_DEX(mob) * 5)); } else if ((GET_DEX(mob) > 18) && (GET_DEX(mob) != 50)) { fprintf(mob_file, "Dex: 100\n"); fprintf(mob_file, "Agi: 100\n"); } if ((GET_INT(mob) != 11) && (GET_INT(mob) < 19)) fprintf(mob_file, "Int: %d\n", (GET_INT(mob) * 5)); else if ((GET_INT(mob) > 18) && (GET_INT(mob) != 50)) fprintf(mob_file, "Int: 100\n"); if ((GET_WIS(mob) != 11) && (GET_WIS(mob) < 19)) fprintf(mob_file, "Wis: %d\n", (GET_WIS(mob) * 5)); else if ((GET_WIS(mob) > 18) && (GET_WIS(mob) != 50)) fprintf(mob_file, "Wis: 100\n"); if ((GET_CON(mob) != 11) && (GET_CON(mob) < 19)) fprintf(mob_file, "Con: %d\n", (GET_CON(mob) * 5)); else if ((GET_CON(mob) > 18) && (GET_CON(mob) != 50)) fprintf(mob_file, "Con: 100\n"); /*. Deal with Mob Progs .*/ while (mob_prog) { switch (mob_prog->type) { case IN_FILE_PROG: fprintf(mob_file, ">in_file_prog"); break; case ACT_PROG: fprintf(mob_file, ">act_prog"); break; case SPEECH_PROG: fprintf(mob_file, ">speech_prog"); break; case RAND_PROG: fprintf(mob_file, ">rand_prog"); break; case FIGHT_PROG: fprintf(mob_file, ">fight_prog"); break; case HITPRCNT_PROG: fprintf(mob_file, ">hitprcnt_prog"); break; case DEATH_PROG: fprintf(mob_file, ">death_prog"); break; case ENTRY_PROG: fprintf(mob_file, ">entry_prog"); break; case GREET_PROG: fprintf(mob_file, ">greet_prog"); break; case ALL_GREET_PROG: fprintf(mob_file, ">all_greet_prog"); break; case GIVE_PROG: fprintf(mob_file, ">give_prog"); break; case BRIBE_PROG: fprintf(mob_file, ">bribe_prog"); break; case SHOUT_PROG: fprintf(mob_file, ">shout_prog"); break; case HOLLER_PROG: fprintf(mob_file, ">holler_prog"); break; case TELL_PROG: fprintf(mob_file, ">tell_prog"); break; case TIME_PROG: fprintf(mob_file, ">time_prog"); break; } strcpy(buf1, mob_prog->arglist); strip_string(buf1); strcpy(buf2, mob_prog->comlist); strip_string(buf2); fprintf(mob_file, " %s~\n%s", buf1, buf2); mob_prog = mob_prog->next; if (!mob_prog) fprintf(mob_file, "~\n|\n"); else fprintf(mob_file, "~\n"); } } } fclose(mob_file); }
void equip_char(struct char_data * ch, struct obj_data * obj, int pos) { int j; int invalid_class(struct char_data *ch, struct obj_data *obj); int invalid_race(struct char_data *ch, struct obj_data *obj); assert(pos >= 0 && pos < NUM_WEARS); if (GET_EQ(ch, pos)) { GET_NAME(ch, chname); sprintf(buf, "SYSERR: Char is already equipped: %s, %s", chname, obj->short_description); FREE_NAME(chname); log(buf); return; } if (obj->carried_by) { log("SYSERR: EQUIP: Obj is carried_by when equip."); return; } if (obj->in_room != NOWHERE) { log("SYSERR: EQUIP: Obj is in_room when equip."); return; } /* Let's change the messages here. Soli, 8/12/99 */ if ((IS_OBJ_STAT(obj, ITEM_ANTI_EVIL) && IS_EVIL(ch)) || (IS_OBJ_STAT(obj, ITEM_ANTI_GOOD) && IS_GOOD(ch)) || (IS_OBJ_STAT(obj, ITEM_ANTI_NEUTRAL) && IS_NEUTRAL(ch))) { act("You are zapped by $p and instantly let go of it.", FALSE, ch, obj, 0, TO_CHAR); act("$n is zapped by $p and instantly lets go of it.", FALSE, ch, obj, 0, TO_ROOM); obj_to_char(obj, ch); /* changed to drop in inventory instead of * ground */ return; } /* I'm moving the other two to a seperate function, checked before we actually wear the eq. Soli, 8/12/99 */ GET_EQ(ch, pos) = obj; obj->worn_by = ch; obj->worn_on = pos; if (GET_OBJ_TYPE(obj) == ITEM_ARMOR) GET_AC(ch) -= apply_ac(ch, pos); if (ch->in_room != NOWHERE) { if (pos == WEAR_LIGHT && GET_OBJ_TYPE(obj) == ITEM_LIGHT) if (GET_OBJ_VAL(obj, 2)) /* if light is ON */ world[ch->in_room].light++; } else { log("SYSERR: ch->in_room = NOWHERE when equipping char."); } for (j = 0; j < MAX_OBJ_AFFECT; j++) affect_modify(ch, obj->affected[j].location, obj->affected[j].modifier, obj->obj_flags.bitvector, TRUE); affect_total(ch); }
/* Extract a ch completely from the world, and leave his stuff behind */ void extract_char(struct char_data *ch, bool pull) { struct obj_data *obj; struct char_data *k, *next_char; struct descriptor_data *t_desc; int l, was_in; extern struct char_data *combat_list; void die_follower(struct char_data *ch); if ( !IS_NPC(ch) && !ch->desc ) { for ( t_desc = descriptor_list; t_desc; t_desc = t_desc->next ) { if ( t_desc->original == ch ) do_return( t_desc->character, "", 0 ); } } if ( ch->in_room == NOWHERE ) { log( "Extract_char: NOWHERE" ); exit( 1 ); } if ( ch->followers || ch->master ) die_follower(ch); while ( ( obj = ch->carrying ) != NULL ) { obj_from_char( obj ); obj_to_room( obj, ch->in_room ); } if ( ch->specials.fighting ) stop_fighting( ch ); for ( k = combat_list; k ; k = next_char ) { next_char = k->next_fighting; if ( k->specials.fighting == ch ) stop_fighting( k ); } /* Must remove from room before removing the equipment! */ was_in = ch->in_room; char_from_room( ch ); if ( !pull ) char_to_room(ch, real_room(3001)); /* clear equipment_list */ for ( l = 0; l < MAX_WEAR; l++ ) { if ( ch->equipment[l] ) obj_to_room(unequip_char(ch,l), was_in); } GET_AC(ch) = 100; if ( ch->desc && ch->desc->original ) do_return( ch, "", 0 ); if ( IS_NPC(ch) && ch->nr > -1 ) mob_index[ch->nr].number--; if ( pull ) { if ( ch == character_list ) character_list = ch->next; else { for ( k = character_list; k && k->next != ch; k = k->next ) ; if ( k ) k->next = ch->next; else { log( "Extract_char: bad char list" ); abort(); } } free_char( ch ); } }
void affect_modify(struct char_data *ch, byte loc, byte mod, long bitv, bool add) { int maxabil; if (add) { SET_BIT(ch->specials.affected_by, bitv); } else { REMOVE_BIT(ch->specials.affected_by, bitv); mod = -mod; } maxabil = (IS_NPC(ch) ? 25:18); switch(loc) { case APPLY_NONE: break; case APPLY_STR: GET_STR(ch) += mod; break; case APPLY_DEX: GET_DEX(ch) += mod; break; case APPLY_INT: GET_INT(ch) += mod; break; case APPLY_WIS: GET_WIS(ch) += mod; break; case APPLY_CON: GET_CON(ch) += mod; break; case APPLY_SEX: /* ??? GET_SEX(ch) += mod; */ break; case APPLY_CLASS: /* ??? GET_CLASS(ch) += mod; */ break; case APPLY_LEVEL: /* ??? GET_LEVEL(ch) += mod; */ break; case APPLY_AGE: ch->player.time.birth -= ((long)SECS_PER_MUD_YEAR*(long)mod); break; case APPLY_CHAR_WEIGHT: GET_WEIGHT(ch) += mod; break; case APPLY_CHAR_HEIGHT: GET_HEIGHT(ch) += mod; break; case APPLY_MANA: ch->points.max_mana += mod; break; case APPLY_HIT: ch->points.max_hit += mod; break; case APPLY_MOVE: /* Will change nothing on players ch->points.max_move += mod; */ break; case APPLY_GOLD: break; case APPLY_EXP: break; case APPLY_AC: GET_AC(ch) += mod; break; case APPLY_HITROLL: GET_HITROLL(ch) += mod; break; case APPLY_DAMROLL: GET_DAMROLL(ch) += mod; break; case APPLY_SAVING_PARA: ch->specials.apply_saving_throw[0] += mod; break; case APPLY_SAVING_ROD: ch->specials.apply_saving_throw[1] += mod; break; case APPLY_SAVING_PETRI: ch->specials.apply_saving_throw[2] += mod; break; case APPLY_SAVING_BREATH: ch->specials.apply_saving_throw[3] += mod; break; case APPLY_SAVING_SPELL: ch->specials.apply_saving_throw[4] += mod; break; default: log("Unknown apply adjust attempt (handler.c, affect_modify)."); break; } /* switch */ }
void affect_modify(struct char_data * ch, byte loc, sbyte mod, long bitv, bool add) { if (add) { SET_BIT(AFF_FLAGS(ch), bitv); } else { REMOVE_BIT(AFF_FLAGS(ch), bitv); mod = -mod; } switch (loc) { case APPLY_NONE: break; case APPLY_STR: GET_STR(ch) += mod; break; case APPLY_DEX: GET_DEX(ch) += mod; break; case APPLY_INT: GET_INT(ch) += mod; break; case APPLY_WIS: GET_WIS(ch) += mod; break; case APPLY_CON: GET_CON(ch) += mod; break; case APPLY_CHA: GET_CHA(ch) += mod; break; case APPLY_CLASS: /* ??? GET_CLASS(ch) += mod; */ break; case APPLY_LEVEL: /* ??? GET_LEVEL(ch) += mod; */ break; case APPLY_AGE: ch->player.time.birth -= (mod * SECS_PER_MUD_YEAR); break; case APPLY_CHAR_WEIGHT: GET_WEIGHT(ch) += mod; break; case APPLY_CHAR_HEIGHT: GET_HEIGHT(ch) += mod; break; case APPLY_HIT: GET_MAX_HIT(ch) += mod; break; case APPLY_MOVE: GET_MAX_MOVE(ch) += mod; break; case APPLY_GOLD: break; case APPLY_EXP: break; case APPLY_AC: GET_AC(ch) += mod; break; case APPLY_HITROLL: GET_HITROLL(ch) += mod; break; case APPLY_DAMROLL: GET_DAMROLL(ch) += mod; break; case APPLY_SAVING_PARA: GET_SAVE(ch, SAVING_PARA) += mod; break; case APPLY_SAVING_ROD: GET_SAVE(ch, SAVING_ROD) += mod; break; case APPLY_SAVING_PETRI: GET_SAVE(ch, SAVING_PETRI) += mod; break; case APPLY_SAVING_BREATH: GET_SAVE(ch, SAVING_BREATH) += mod; break; case APPLY_SAVING_SPELL: GET_SAVE(ch, SAVING_SPELL) += mod; break; case APPLY_LIGHT: break; case APPLY_UNDEFINED: case APPLY_UNDEFINED_2: break; default: { log("SYSERR: Unknown apply adjust %p attempt (%s, affect_modify).", log, __FILE__); } break; } /* switch */ }
/* Extract a ch completely from the world, and leave his stuff behind */ void extract_char_smarter(struct char_data *ch, int save_room) { struct obj_data *i; struct char_data *k, *next_char; struct descriptor_data *t_desc; int l, was_in, j; extern long mob_count; extern struct char_data *combat_list; void do_save(struct char_data *ch, char *argument, int cmd); void do_return(struct char_data *ch, char *argument, int cmd); void die_follower(struct char_data *ch); if(IS_SET(ch->specials.act, ACT_FIGURINE) && ch->link) extract_obj(ch->link); if(!IS_NPC(ch) && !ch->desc) { for(t_desc = descriptor_list; t_desc; t_desc = t_desc->next) if(t_desc->original==ch) do_return(t_desc->character, "", 0); } if (ch->in_room == NOWHERE) { logE("NOWHERE extracting char. (handler.c, extract_char)"); /* ** problem from linkdeath */ char_to_room(ch, 4); /* 4 == all purpose store */ } if (ch->followers || ch->master) die_follower(ch); if(ch->desc) { /* Forget snooping */ if ((ch->desc->snoop.snooping) && (ch->desc->snoop.snooping->desc)) ch->desc->snoop.snooping->desc->snoop.snoop_by = 0; if (ch->desc->snoop.snoop_by) { send_to_char("Your victim is no longer among us.\n\r", ch->desc->snoop.snoop_by); if (ch->desc->snoop.snoop_by->desc) ch->desc->snoop.snoop_by->desc->snoop.snooping = 0; } ch->desc->snoop.snooping = ch->desc->snoop.snoop_by = 0; } if (ch->carrying) { /* transfer ch's objects to room */ if (!IS_IMMORTAL(ch)) { while(ch->carrying) { i=ch->carrying; obj_from_char(i); obj_to_room(i, ch->in_room); check_falling_obj(i, ch->in_room); } } else { send_to_char("Here, you dropped some stuff, let me help you get rid of that.\n\r",ch); /* equipment too */ for (j=0; j<MAX_WEAR; j++) { if (ch->equipment[j]) obj_to_char(unequip_char(ch, j), ch); } while (ch->carrying) { i = ch->carrying; obj_from_char(i); extract_obj(i); } } } if (ch->specials.fighting) stop_fighting(ch); for (k = combat_list; k ; k = next_char) { next_char = k->next_fighting; if (k->specials.fighting == ch) stop_fighting(k); } if (MOUNTED(ch)) { Dismount(ch, MOUNTED(ch), POSITION_STANDING); } if (RIDDEN(ch)) { Dismount(RIDDEN(ch), ch, POSITION_STANDING); } /* Must remove from room before removing the equipment! */ was_in = ch->in_room; char_from_room(ch); /* clear equipment_list */ for (l = 0; l < MAX_WEAR; l++) if (ch->equipment[l]) obj_to_room(unequip_char(ch,l), was_in); if (IS_NPC(ch)) { for (k=character_list; k; k=k->next) { if (k->specials.hunting) if (k->specials.hunting == ch) { k->specials.hunting = 0; } if (Hates(k, ch)) { RemHated(k, ch); } if (Fears(k, ch)) { RemFeared(k, ch); } if (k->orig == ch) { k->orig = 0; } } } else { for (k=character_list; k; k=k->next) { if (k->specials.hunting) if (k->specials.hunting == ch) { k->specials.hunting = 0; } if (Hates(k, ch)) { ZeroHatred(k, ch); } if (Fears(k, ch)) { ZeroFeared(k, ch); } if (k->orig == ch) { k->orig = 0; } } } /* pull the char from the list */ if (ch == character_list) character_list = ch->next; else { for(k = character_list; (k) && (k->next != ch); k = k->next); if(k) k->next = ch->next; else { logE("Trying to remove ?? from character_list.(handler.c,extract_char)"); exit(0); } } if (ch->specials.gname) free(ch->specials.gname); GET_AC(ch) = 100; if (ch->desc) { if (ch->desc->original) do_return(ch, "", 0); if (!strcmp(GET_NAME(ch), "Odin's heroic minion")) { free(GET_NAME(ch)); GET_NAME(ch) = strdup("111111"); } save_char(ch, save_room); } t_desc = ch->desc; if(ch->term) { ScreenOff(ch); ch->term = 0; } if (IS_NPC(ch)) { if (ch->nr > -1) /* if mobile */ mob_index[ch->nr].number--; FreeHates(ch); FreeFears(ch); mob_count--; free_char(ch); } if (t_desc) { t_desc->connected = CON_SLCT; SEND_TO_Q(MENU, t_desc); } }
void equip_char(struct char_data *ch, struct obj_data *obj, int pos) { int j; assert(pos>=0 && pos<MAX_WEAR); assert(!(ch->equipment[pos])); if (obj->carried_by) { logE("EQUIP: Obj is carried_by when equip."); assert(0); } if (obj->in_room!=NOWHERE) { logE("EQUIP: Obj is in_room when equip."); assert(0); return; } /* if the item is limited, check its ego. use some funky function to determine if pc's ego is higher than objs' ego.. if it is, proceed.. otherwise, deny. */ j = ItemEgoClash(ch, obj, 0); if (j < -5) { act("$p almost seems to say 'You're much too puny to use me, twerp!'",0, ch, obj, 0, TO_CHAR); act("$p falls to the floor",0,ch, obj, 0, TO_CHAR); act("$p removes itself, and falls to the floor",0,ch, obj, 0, TO_ROOM); obj_to_room(obj, ch->in_room); do_save(ch,"",0); return; } else if (j < 0) { act("$p almost seems to say 'You're pretty puny. I don't want to be seen with you!\n", 0, ch, obj, 0, TO_CHAR); act("$p falls to the floor",0,ch, obj, 0, TO_CHAR); act("$p removes itself, and falls to the floor",0,ch, obj, 0, TO_ROOM); obj_to_room(obj, ch->in_room); do_save(ch,"",0); return; } if (ItemAlignClash(ch, obj)) { if (ch->in_room != NOWHERE) { act("You are zapped by $p and instantly drop it.", FALSE, ch, obj, 0, TO_CHAR); act("$n is zapped by $p and instantly drop it.", FALSE, ch, obj, 0, TO_ROOM); obj_to_room(obj, ch->in_room); do_save(ch,"",0); return; } else { logE("ch->in_room = NOWHERE when equipping char."); assert(0); } } if (IS_AFFECTED(ch, AFF_SNEAK) && IsRestricted(GetItemClassRestrictions(obj), CLASS_THIEF)) affect_from_char(ch, SKILL_SNEAK); ch->equipment[pos] = obj; obj->equipped_by = ch; obj->eq_pos = pos; if (GET_ITEM_TYPE(obj) == ITEM_ARMOR) GET_AC(ch) -= apply_ac(ch, pos); for(j=0; j<MAX_OBJ_AFFECT; j++) affect_modify(ch, obj->affected[j].location, (int)obj->affected[j].modifier, obj->obj_flags.bitvector, TRUE); if (GET_ITEM_TYPE(obj) == ITEM_WEAPON) { /* some nifty manuevering for strength */ if (IS_NPC(ch) && !IS_SET(ch->specials.act, ACT_POLYSELF)) GiveMinStrToWield(obj, ch); } affect_total(ch); }
/* * Display main menu. */ void medit_disp_menu(struct descriptor_data *d) { struct char_data *mob; mob = OLC_MOB(d); get_char_colors(d->character); clear_screen(d); sprintf(buf, "-- Mob Number: [%s%d%s]\r\n" "%s1%s) Sex: %s%-7.7s%s %s2%s) Alias: %s%s\r\n" "%s3%s) S-Desc: %s%s\r\n" "%s4%s) L-Desc:-\r\n%s%s" "%s5%s) D-Desc:-\r\n%s%s" "%s6%s) Level: [%s%4d%s], %s7%s) Alignment: [%s%4d%s]\r\n" "%s8%s) HR//SKY: [%s%4d%s], %s9%s) DR//FD: [%s%4d%s]\r\n" "%sA%s) NumDamDice: [%s%4d%s], %sB%s) SizeDamDice: [%s%4d%s]\r\n" "%sC%s) Num HP Dice: [%s%4d%s], %sD%s) Size HP Dice: [%s%4d%s], %sE%s) HP Bonus: [%s%5d%s]\r\n" "%sF%s) Armor Class: [%s%4d%s], %sG%s) Exp: [%s%9d%s], %sH%s) Gold: [%s%8d%s]\r\n", cyn, OLC_NUM(d), nrm, grn, nrm, yel, genders[(int)GET_SEX(mob)], nrm, grn, nrm, yel, GET_ALIAS(mob), grn, nrm, yel, GET_SDESC(mob), grn, nrm, yel, GET_LDESC(mob), grn, nrm, yel, GET_DDESC(mob), grn, nrm, cyn, GET_LEVEL(mob), nrm, grn, nrm, cyn, GET_ALIGNMENT(mob), nrm, grn, nrm, cyn, GET_HITROLL(mob), nrm, grn, nrm, cyn, GET_DAMROLL(mob), nrm, grn, nrm, cyn, GET_NDD(mob), nrm, grn, nrm, cyn, GET_SDD(mob), nrm, grn, nrm, cyn, GET_HIT(mob), nrm, grn, nrm, cyn, GET_MANA(mob), nrm, grn, nrm, cyn, GET_MOVE(mob), nrm, grn, nrm, cyn, GET_AC(mob), nrm, grn, nrm, cyn, GET_EXP(mob), nrm, grn, nrm, cyn, convert_all_to_copper(mob), nrm ); SEND_TO_Q(buf, d); sprintbit(MOB_FLAGS(mob), action_bits, buf1); sprintbit(AFF_FLAGS(mob), affected_bits, buf2); sprintf(buf, "%sI%s) Position : %s%s\r\n" "%sJ%s) Default : %s%s\r\n" "%sK%s) Attack : %s%s\r\n" "%sN%s) Class : %s%s\r\n" "%sR%s) Race : %s%s\r\n" "%sS%s) Size : %s%d\r\n" "%sW%s) Weight : %s%d\r\n" "%sL%s) NPC Flags : %s%s\r\n" "%sM%s) AFF Flags : %s%s\r\n" #if CONFIG_OASIS_MPROG "%sP%s) Mob Progs : %s%s\r\n" #endif "%sQ%s) Quit\r\n" "Enter choice : ", grn, nrm, yel, position_types[(int)GET_POS(mob)], grn, nrm, yel, position_types[(int)GET_DEFAULT_POS(mob)], grn, nrm, yel, attack_hit_text[GET_ATTACK(mob)].singular, grn, nrm, cyn, npc_class_types[(int)GET_CLASS(mob)], grn, nrm, cyn, npc_race_types[(int)GET_RACE(mob)], grn, nrm, cyn, GET_MOB_SIZE(mob), grn, nrm, cyn, GET_MOB_WEIGHT(mob), grn, nrm, cyn, buf1, grn, nrm, cyn, buf2, #if CONFIG_OASIS_MPROG grn, nrm, cyn, (OLC_MPROGL(d) ? "Set." : "Not Set."), #endif grn, nrm ); SEND_TO_Q(buf, d); OLC_MODE(d) = MEDIT_MAIN_MENU; }
/* Display main menu. */ static void medit_disp_stats_menu(struct descriptor_data *d) { struct char_data *mob; char buf[MAX_STRING_LENGTH]; mob = OLC_MOB(d); get_char_colors(d->character); clear_screen(d); /* Color codes have to be used here, for count_color_codes to work */ sprintf(buf, "(range \ty%d\tn to \ty%d\tn)", GET_HIT(mob) + GET_MOVE(mob), (GET_HIT(mob) * GET_MANA(mob)) + GET_MOVE(mob)); /* Top section - standard stats */ write_to_output(d, "-- Mob Number: %s[%s%d%s]%s\r\n" "(%s1%s) Level: %s[%s%4d%s]%s\r\n" "(%s2%s) %sAuto Set Stats (based on level)%s\r\n\r\n" "Hit Points (xdy+z): Bare Hand Damage (xdy+z): \r\n" "(%s3%s) HP NumDice: %s[%s%5d%s]%s (%s6%s) BHD NumDice: %s[%s%5d%s]%s\r\n" "(%s4%s) HP SizeDice: %s[%s%5d%s]%s (%s7%s) BHD SizeDice: %s[%s%5d%s]%s\r\n" "(%s5%s) HP Addition: %s[%s%5d%s]%s (%s8%s) DamRoll: %s[%s%5d%s]%s\r\n" "%-*s(range %s%d%s to %s%d%s)\r\n\r\n" "(%sA%s) Armor Class: %s[%s%4d%s]%s (%sD%s) Hitroll: %s[%s%5d%s]%s\r\n" "(%sB%s) Exp Points: %s[%s%10d%s]%s (%sE%s) Alignment: %s[%s%5d%s]%s\r\n" "(%sC%s) Gold: %s[%s%10d%s]%s\r\n\r\n", cyn, yel, OLC_NUM(d), cyn, nrm, cyn, nrm, cyn, yel, GET_LEVEL(mob), cyn, nrm, cyn, nrm, cyn, nrm, cyn, nrm, cyn, yel, GET_HIT(mob), cyn, nrm, cyn, nrm, cyn, yel, GET_NDD(mob), cyn, nrm, cyn, nrm, cyn, yel, GET_MANA(mob), cyn, nrm, cyn, nrm, cyn, yel, GET_SDD(mob), cyn, nrm, cyn, nrm, cyn, yel, GET_MOVE(mob), cyn, nrm, cyn, nrm, cyn, yel, GET_DAMROLL(mob), cyn, nrm, count_color_chars(buf)+28, buf, yel, GET_NDD(mob) + GET_DAMROLL(mob), nrm, yel, (GET_NDD(mob) * GET_SDD(mob)) + GET_DAMROLL(mob), nrm, cyn, nrm, cyn, yel, GET_AC(mob), cyn, nrm, cyn, nrm, cyn, yel, GET_HITROLL(mob), cyn, nrm, cyn, nrm, cyn, yel, GET_EXP(mob), cyn, nrm, cyn, nrm, cyn, yel, GET_ALIGNMENT(mob), cyn, nrm, cyn, nrm, cyn, yel, GET_GOLD(mob), cyn, nrm ); if (CONFIG_MEDIT_ADVANCED) { /* Bottom section - non-standard stats, togglable in cedit */ write_to_output(d, "(%sF%s) Str: %s[%s%2d/%3d%s]%s Saving Throws\r\n" "(%sG%s) Int: %s[%s%3d%s]%s (%sL%s) Paralysis %s[%s%3d%s]%s\r\n" "(%sH%s) Wis: %s[%s%3d%s]%s (%sM%s) Rods/Staves %s[%s%3d%s]%s\r\n" "(%sI%s) Dex: %s[%s%3d%s]%s (%sN%s) Petrification %s[%s%3d%s]%s\r\n" "(%sJ%s) Con: %s[%s%3d%s]%s (%sO%s) Breath %s[%s%3d%s]%s\r\n" "(%sK%s) Cha: %s[%s%3d%s]%s (%sP%s) Spells %s[%s%3d%s]%s\r\n\r\n", cyn, nrm, cyn, yel, GET_STR(mob), GET_ADD(mob), cyn, nrm, cyn, nrm, cyn, yel, GET_INT(mob), cyn, nrm, cyn, nrm, cyn, yel, GET_SAVE(mob, SAVING_PARA), cyn, nrm, cyn, nrm, cyn, yel, GET_WIS(mob), cyn, nrm, cyn, nrm, cyn, yel, GET_SAVE(mob, SAVING_ROD), cyn, nrm, cyn, nrm, cyn, yel, GET_DEX(mob), cyn, nrm, cyn, nrm, cyn, yel, GET_SAVE(mob, SAVING_PETRI), cyn, nrm, cyn, nrm, cyn, yel, GET_CON(mob), cyn, nrm, cyn, nrm, cyn, yel, GET_SAVE(mob, SAVING_BREATH), cyn, nrm, cyn, nrm, cyn, yel, GET_CHA(mob), cyn, nrm, cyn, nrm, cyn, yel, GET_SAVE(mob, SAVING_SPELL), cyn, nrm ); } /* Quit to previous menu option */ write_to_output(d, "(%sQ%s) Quit to main menu\r\nEnter choice : ", cyn, nrm); OLC_MODE(d) = MEDIT_STATS_MENU; }
void medit_parse(struct descriptor_data *d, char *arg) { int i = -1; char *oldtext = NULL; if (OLC_MODE(d) > MEDIT_NUMERICAL_RESPONSE) { i = atoi(arg); if (!*arg || (!isdigit(arg[0]) && ((*arg == '-') && !isdigit(arg[1])))) { SEND_TO_Q("Field must be numerical, try again : ", d); return; } } else { /* String response. */ if (!genolc_checkstring(d, arg)) return; } switch (OLC_MODE(d)) { /*-------------------------------------------------------------------*/ case MEDIT_CONFIRM_SAVESTRING: /* * Ensure mob has MOB_ISNPC set or things will go pear shaped. */ SET_BIT(MOB_FLAGS(OLC_MOB(d)), MOB_ISNPC); switch (*arg) { case 'y': case 'Y': /* * Save the mob in memory and to disk. */ SEND_TO_Q("Saving mobile to memory.\r\n", d); medit_save_internally(d); sprintf(buf, "OLC: %s edits mob %d", GET_NAME(d->character), OLC_NUM(d)); mudlog(buf, CMP, MAX(LVL_BUILDER, GET_INVIS_LEV(d->character)), TRUE); /* FALL THROUGH */ case 'n': case 'N': cleanup_olc(d, CLEANUP_ALL); return; default: SEND_TO_Q("Invalid choice!\r\n", d); SEND_TO_Q("Do you wish to save the mobile? : ", d); return; } break; /*-------------------------------------------------------------------*/ case MEDIT_MAIN_MENU: i = 0; switch (*arg) { case 'q': case 'Q': if (OLC_VAL(d)) { /* Anything been changed? */ SEND_TO_Q("Do you wish to save the changes to the mobile? (y//n) : ", d); OLC_MODE(d) = MEDIT_CONFIRM_SAVESTRING; } else cleanup_olc(d, CLEANUP_ALL); return; case '1': OLC_MODE(d) = MEDIT_SEX; medit_disp_sex(d); return; case '2': OLC_MODE(d) = MEDIT_ALIAS; i--; break; case '3': OLC_MODE(d) = MEDIT_S_DESC; i--; break; case '4': OLC_MODE(d) = MEDIT_L_DESC; i--; break; case '5': OLC_MODE(d) = MEDIT_D_DESC; send_editor_help(d); SEND_TO_Q("Enter mob description:\r\n\r\n", d); if (OLC_MOB(d)->player.description) { SEND_TO_Q(OLC_MOB(d)->player.description, d); oldtext = str_dup(OLC_MOB(d)->player.description); } string_write(d, &OLC_MOB(d)->player.description, MAX_MOB_DESC, 0, oldtext); OLC_VAL(d) = 1; return; case '6': OLC_MODE(d) = MEDIT_LEVEL; i++; break; case '7': OLC_MODE(d) = MEDIT_ALIGNMENT; i++; break; case '8': OLC_MODE(d) = MEDIT_HITROLL; i++; break; case '9': OLC_MODE(d) = MEDIT_DAMROLL; i++; break; case 'a': case 'A': OLC_MODE(d) = MEDIT_NDD; i++; break; case 'b': case 'B': OLC_MODE(d) = MEDIT_SDD; i++; break; case 'c': case 'C': OLC_MODE(d) = MEDIT_NUM_HP_DICE; i++; break; case 'd': case 'D': OLC_MODE(d) = MEDIT_SIZE_HP_DICE; i++; break; case 'e': case 'E': OLC_MODE(d) = MEDIT_ADD_HP; i++; break; case 'f': case 'F': OLC_MODE(d) = MEDIT_AC; i++; break; case 'g': case 'G': OLC_MODE(d) = MEDIT_EXP; i++; break; case 'h': case 'H': OLC_MODE(d) = MEDIT_GOLD; i++; break; case 'i': case 'I': OLC_MODE(d) = MEDIT_POS; medit_disp_positions(d); return; case 'j': case 'J': OLC_MODE(d) = MEDIT_DEFAULT_POS; medit_disp_positions(d); return; case 'k': case 'K': OLC_MODE(d) = MEDIT_ATTACK; medit_disp_attack_types(d); return; case 'l': case 'L': OLC_MODE(d) = MEDIT_NPC_FLAGS; medit_disp_mob_flags(d); return; case 'm': case 'M': OLC_MODE(d) = MEDIT_AFF_FLAGS; medit_disp_aff_flags(d); return; case 'n': case 'N': OLC_MODE(d) = MEDIT_CLASS; medit_disp_class_flags(d); return; case 'r': case 'R': OLC_MODE(d) = MEDIT_RACE; medit_disp_race_flags(d); return; case 's': case 'S': OLC_MODE(d) = MEDIT_MSIZE; medit_disp_size_flags(d); return; case 'w': case 'W': OLC_MODE(d) = MEDIT_WEIGHT; send_to_char("Please enter the mobiles weight in pounds: ", d->character); return; #if CONFIG_OASIS_MPROG case 'p': case 'P': OLC_MODE(d) = MEDIT_MPROG; medit_disp_mprog(d); return; #endif default: medit_disp_menu(d); return; } if (i == 0) break; else if (i == 1) SEND_TO_Q("\r\nEnter new value : ", d); else if (i == -1) SEND_TO_Q("\r\nEnter new text :\r\n] ", d); else SEND_TO_Q("Oops...\r\n", d); return; /*-------------------------------------------------------------------*/ case MEDIT_ALIAS: if (GET_ALIAS(OLC_MOB(d))) free(GET_ALIAS(OLC_MOB(d))); GET_ALIAS(OLC_MOB(d)) = str_udup(arg); break; /*-------------------------------------------------------------------*/ case MEDIT_S_DESC: if (GET_SDESC(OLC_MOB(d))) free(GET_SDESC(OLC_MOB(d))); GET_SDESC(OLC_MOB(d)) = str_udup(arg); break; /*-------------------------------------------------------------------*/ case MEDIT_L_DESC: if (GET_LDESC(OLC_MOB(d))) free(GET_LDESC(OLC_MOB(d))); if (arg && *arg) { strcpy(buf, arg); strcat(buf, "\r\n"); GET_LDESC(OLC_MOB(d)) = str_dup(buf); } else GET_LDESC(OLC_MOB(d)) = str_dup("undefined"); break; /*-------------------------------------------------------------------*/ case MEDIT_D_DESC: /* * We should never get here. */ cleanup_olc(d, CLEANUP_ALL); mudlog("SYSERR: OLC: medit_parse(): Reached D_DESC case!", BRF, LVL_BUILDER, TRUE); SEND_TO_Q("Oops...\r\n", d); break; /*-------------------------------------------------------------------*/ #if CONFIG_OASIS_MPROG case MEDIT_MPROG_COMLIST: /* * We should never get here, but if we do, bail out. */ cleanup_olc(d, CLEANUP_ALL); mudlog("SYSERR: OLC: medit_parse(): Reached MPROG_COMLIST case!", BRF, LVL_BUILDER, TRUE); break; #endif /*-------------------------------------------------------------------*/ case MEDIT_NPC_FLAGS: if ((i = atoi(arg)) <= 0) break; else if (i <= NUM_MOB_FLAGS) TOGGLE_BIT(MOB_FLAGS(OLC_MOB(d)), 1 << (i - 1)); medit_disp_mob_flags(d); return; /*-------------------------------------------------------------------*/ case MEDIT_AFF_FLAGS: if ((i = atoi(arg)) <= 0) break; else if (i <= NUM_AFF_FLAGS) TOGGLE_BIT(AFF_FLAGS(OLC_MOB(d)), 1 << (i - 1)); medit_disp_aff_flags(d); return; /*-------------------------------------------------------------------*/ #if CONFIG_OASIS_MPROG case MEDIT_MPROG: if ((i = atoi(arg)) == 0) medit_disp_menu(d); else if (i == OLC_MTOTAL(d)) { struct mob_prog_data *temp; CREATE(temp, struct mob_prog_data, 1); temp->next = OLC_MPROGL(d); temp->type = -1; temp->arglist = NULL; temp->comlist = NULL; OLC_MPROG(d) = temp; OLC_MPROGL(d) = temp; OLC_MODE(d) = MEDIT_CHANGE_MPROG; medit_change_mprog (d); } else if (i < OLC_MTOTAL(d)) { struct mob_prog_data *temp; int x = 1; for (temp = OLC_MPROGL(d); temp && x < i; temp = temp->next) x++; OLC_MPROG(d) = temp; OLC_MODE(d) = MEDIT_CHANGE_MPROG; medit_change_mprog (d); } else if (i == (OLC_MTOTAL(d) + 1)) { SEND_TO_Q("Which mob prog do you want to purge? ", d); OLC_MODE(d) = MEDIT_PURGE_MPROG; } else medit_disp_menu(d); return; case MEDIT_PURGE_MPROG: if ((i = atoi(arg)) > 0 && i < OLC_MTOTAL(d)) { struct mob_prog_data *temp; int x = 1; for (temp = OLC_MPROGL(d); temp && x < i; temp = temp->next) x++; OLC_MPROG(d) = temp; REMOVE_FROM_LIST(OLC_MPROG(d), OLC_MPROGL(d), next); free(OLC_MPROG(d)->arglist); free(OLC_MPROG(d)->comlist); free(OLC_MPROG(d)); OLC_MPROG(d) = NULL; OLC_VAL(d) = 1; } medit_disp_mprog(d); return; case MEDIT_CHANGE_MPROG: if ((i = atoi(arg)) == 1) medit_disp_mprog_types(d); else if (i == 2) { SEND_TO_Q("Enter new arg list: ", d); OLC_MODE(d) = MEDIT_MPROG_ARGS; } else if (i == 3) { SEND_TO_Q("Enter new mob prog commands:\r\n", d); /* * Pass control to modify.c for typing. */ OLC_MODE(d) = MEDIT_MPROG_COMLIST; if (OLC_MPROG(d)->comlist) { SEND_TO_Q(OLC_MPROG(d)->comlist, d); oldtext = str_dup(OLC_MPROG(d)->comlist); } string_write(d, &OLC_MPROG(d)->comlist, MAX_STRING_LENGTH, 0, oldtext); OLC_VAL(d) = 1; } else medit_disp_mprog(d); return; #endif /*-------------------------------------------------------------------*/ /* * Numerical responses. */ #if CONFIG_OASIS_MPROG case MEDIT_MPROG_TYPE: /* * This calculation may be off by one too many powers of 2? * Someone who actually uses MobProgs will have to check. */ OLC_MPROG(d)->type = (1 << LIMIT(atoi(arg), 0, NUM_PROGS - 1)); OLC_VAL(d) = 1; medit_change_mprog(d); return; case MEDIT_MPROG_ARGS: OLC_MPROG(d)->arglist = str_dup(arg); OLC_VAL(d) = 1; medit_change_mprog(d); return; #endif case MEDIT_SEX: GET_SEX(OLC_MOB(d)) = LIMIT(i, 0, NUM_GENDERS - 1); break; case MEDIT_HITROLL: GET_HITROLL(OLC_MOB(d)) = LIMIT(i, 0, 50); break; case MEDIT_DAMROLL: GET_DAMROLL(OLC_MOB(d)) = LIMIT(i, 0, 50); break; case MEDIT_NDD: GET_NDD(OLC_MOB(d)) = LIMIT(i, 0, 30); break; case MEDIT_SDD: GET_SDD(OLC_MOB(d)) = LIMIT(i, 0, 127); break; case MEDIT_NUM_HP_DICE: GET_HIT(OLC_MOB(d)) = LIMIT(i, 0, 30); break; case MEDIT_SIZE_HP_DICE: GET_MANA(OLC_MOB(d)) = LIMIT(i, 0, 1000); break; case MEDIT_ADD_HP: GET_MOVE(OLC_MOB(d)) = LIMIT(i, 0, 30000); break; case MEDIT_AC: GET_AC(OLC_MOB(d)) = LIMIT(i, 10, 200); break; case MEDIT_EXP: GET_EXP(OLC_MOB(d)) = MAX(i, 0); break; case MEDIT_GOLD: add_money_to_char(OLC_MOB(d), MAX(i, 0), COPPER_COINS); break; case MEDIT_POS: GET_POS(OLC_MOB(d)) = LIMIT(i, 0, NUM_POSITIONS - 1); break; case MEDIT_DEFAULT_POS: GET_DEFAULT_POS(OLC_MOB(d)) = LIMIT(i, 0, NUM_POSITIONS - 1); break; case MEDIT_ATTACK: GET_ATTACK(OLC_MOB(d)) = LIMIT(i, 0, NUM_ATTACK_TYPES - 1); break; case MEDIT_LEVEL: GET_LEVEL(OLC_MOB(d)) = i; break; case MEDIT_ALIGNMENT: GET_ALIGNMENT(OLC_MOB(d)) = LIMIT(i, -1000, 1000); break; case MEDIT_CLASS: GET_CLASS(OLC_MOB(d)) = MAX(0, MIN(NUM_NPC_CLASS, atoi(arg))); break; case MEDIT_RACE: GET_RACE(OLC_MOB(d)) = MAX(0, MIN(NUM_NPC_RACE, atoi(arg))); // INT, WIS, STR, DEX, CON, CHA GET_INT(OLC_MOB(d)) = mob_stats[(int)GET_RACE(OLC_MOB(d))][0]; GET_WIS(OLC_MOB(d)) = mob_stats[(int)GET_RACE(OLC_MOB(d))][1]; GET_STR(OLC_MOB(d)) = mob_stats[(int)GET_RACE(OLC_MOB(d))][2]; GET_DEX(OLC_MOB(d)) = mob_stats[(int)GET_RACE(OLC_MOB(d))][3]; GET_CON(OLC_MOB(d)) = mob_stats[(int)GET_RACE(OLC_MOB(d))][4]; GET_CHA(OLC_MOB(d)) = mob_stats[(int)GET_RACE(OLC_MOB(d))][5]; GET_HIT(OLC_MOB(d)) = mob_hp[i][0]; GET_MANA(OLC_MOB(d)) = mob_hp[i][2]; GET_MOVE(OLC_MOB(d)) = mob_hp[i][3]; break; case MEDIT_WEIGHT: GET_MOB_WEIGHT(OLC_MOB(d)) = LIMIT(i, 1, 1000); break; case MEDIT_MSIZE: GET_MOB_SIZE(OLC_MOB(d)) = atoi(arg); break; /*-------------------------------------------------------------------*/ default: /* * We should never get here. */ cleanup_olc(d, CLEANUP_ALL); mudlog("SYSERR: OLC: medit_parse(): Reached default case!", BRF, LVL_BUILDER, TRUE); SEND_TO_Q("Oops...\r\n", d); break; }
void aff_apply_modify(struct char_data *ch, byte loc, sbyte mod, char *msg) { switch (loc) { case APPLY_NONE: break; case APPLY_STR: GET_STR(ch) += mod; break; case APPLY_DEX: GET_DEX(ch) += mod; break; case APPLY_INT: GET_INT(ch) += mod; break; case APPLY_WIS: GET_WIS(ch) += mod; break; case APPLY_CON: GET_CON(ch) += mod; break; case APPLY_CHA: GET_CHA(ch) += mod; break; case APPLY_AGE: ch->player.time.birth -= (mod * SECS_PER_MUD_YEAR); break; case APPLY_CHAR_WEIGHT: GET_WEIGHT(ch) += mod; break; case APPLY_CHAR_HEIGHT: GET_HEIGHT(ch) += mod; break; case APPLY_MANA: GET_MAX_MANA(ch) += mod; break; case APPLY_HIT: GET_MAX_HIT(ch) += mod; break; case APPLY_MOVE: GET_MAX_MOVE(ch) += mod; break; case APPLY_AC: GET_AC(ch) += mod; break; case APPLY_HITROLL: GET_HITROLL(ch) += mod; break; case APPLY_DAMROLL: GET_DAMROLL(ch) += mod; break; case APPLY_SAVING_PARA: GET_SAVE(ch, SAVING_PARA) += mod; break; case APPLY_SAVING_ROD: GET_SAVE(ch, SAVING_ROD) += mod; break; case APPLY_SAVING_PETRI: GET_SAVE(ch, SAVING_PETRI) += mod; break; case APPLY_SAVING_BREATH: GET_SAVE(ch, SAVING_BREATH) += mod; break; case APPLY_SAVING_SPELL: GET_SAVE(ch, SAVING_SPELL) += mod; break; default: log("SYSERR: Unknown apply adjust %d attempt (%s, affect_modify).", loc, __FILE__); break; } /* switch */ }
/* * Write the char to the file. * * @param ch the character to be written * @param fp the file to write to */ void fwrite_char( struct char_data *ch, FILE *fp ) { extern struct race_data * races; struct affected_type *paf; int sn, i; fprintf( fp, "#%s\n", IS_NPC( ch ) ? "MOB" : "PLAYER" ); fprintf( fp, "Name %s~\n", GET_NAME(ch) ); fprintf( fp, "ShtDsc %s~\n", GET_SHORT_DESC(ch) ? GET_SHORT_DESC(ch) : "" ); fprintf( fp, "LngDsc %s~\n", GET_LONG_DESC(ch) ? GET_LONG_DESC(ch) : "" ); fprintf( fp, "Dscr %s~\n", GET_DESCRIPTION(ch) ? GET_DESCRIPTION(ch) : "" ); // fprintf( fp, "Prmpt %s~\n", ch->pcdata->prompt ); fprintf( fp, "Sx %d\n", GET_SEX(ch) ); fprintf( fp, "Race %s~\n", races[ (int)GET_RACE(ch) ].name ); fprintf( fp, "Lvl %d\n", GET_LEVEL(ch) ); fprintf( fp, "Trst %d\n", GET_TRUST(ch) ); /* fprintf( fp, "Playd %ld\n", GET_PLAYED(ch) + (int)( time( 0 ) - GET_LOGON(ch) ) ); */ // fprintf( fp, "Note %ld\n", (unsigned long)ch->last_note ); fprintf( fp, "Room %ld\n", ( ch->in_room == NOWHERE && ch->was_in_room ) ? ch->was_in_room : ch->in_room ); fprintf( fp, "HpMnMv %d %d %d %d %d %d\n", GET_HIT(ch), GET_MAX_HIT(ch), GET_MANA(ch), GET_MAX_MANA(ch), GET_MOVE(ch), GET_MAX_MOVE(ch) ); fprintf( fp, "Gold %ld\n", GET_GOLD(ch) ); fprintf( fp, "Exp %ld\n", GET_EXP(ch) ); fprintf( fp, "Act %lld\n", PLR_FLAGS(ch) ); fprintf( fp, "Act2 %lld\n", PLR2_FLAGS(ch) ); fprintf( fp, "Pref %lld\n", PRF_FLAGS(ch) ); fprintf( fp, "Pref2 %lld\n", PRF2_FLAGS(ch) ); fprintf( fp, "AffdBy %lld\n", AFF_FLAGS(ch) ); fprintf( fp, "AffdBy2 %lld\n", AFF2_FLAGS(ch) ); /* Bug fix from Alander */ fprintf( fp, "Pos %d\n", GET_POS(ch) == POS_FIGHTING ? POS_STANDING : GET_POS(ch) ); fprintf( fp, "Prac %d\n", GET_PRACTICES(ch) ); fprintf( fp, "PAlign %d\n", GET_PERMALIGN(ch) ); fprintf( fp, "CAlign %d\n", GET_ALIGNMENT(ch) ); fprintf( fp, "SavThr " ); for ( i = 0; i < NUM_SAVES; i++ ) fprintf( fp, "%d%s", GET_SAVE(ch, i), (i != NUM_SAVES-1 ? ", " : "\n") ); fprintf( fp, "Hitroll %d\n", GET_HITROLL(ch) ); fprintf( fp, "Damroll %d\n", GET_DAMROLL(ch) ); fprintf( fp, "Armr " ); for ( i = 0; i < ARMOR_LIMIT; i++ ) fprintf( fp, "%d%s", GET_AC(ch, i), (i != ARMOR_LIMIT-1 ? ", " : "\n") ); fprintf( fp, "Wimp %d\n", GET_WIMP_LEV(ch) ); if ( IS_NPC( ch ) ) { fprintf( fp, "Vnum %ld\n", GET_MOB_VNUM(ch) ); } else { fprintf( fp, "Paswd %s~\n", GET_PASSWD(ch) ); fprintf( fp, "Poofin %s~\n", POOFIN(ch) ? POOFIN(ch) : "" ); fprintf( fp, "Poofout %s~\n", POOFOUT(ch) ? POOFOUT(ch) : "" ); fprintf( fp, "Ttle %s~\n", GET_TITLE(ch) ? GET_TITLE(ch) : "" ); fprintf( fp, "AtrPrm %d/%d %d %d %d %d %d %d\n", ch->real_abils.str, ch->real_abils.str_add, ch->real_abils.intel, ch->real_abils.wis, ch->real_abils.dex, ch->real_abils.con, ch->real_abils.cha, ch->real_abils.will ); fprintf( fp, "AtrMd %d/%d %d %d %d %d %d %d\n", ch->aff_abils.str, ch->aff_abils.str_add, ch->aff_abils.intel, ch->aff_abils.wis, ch->aff_abils.dex, ch->aff_abils.con, ch->aff_abils.cha, ch->aff_abils.will ); fprintf( fp, "Conditions " ); for ( i = 0; i < MAX_COND; i++ ) fprintf( fp, "%d%s", GET_COND(ch, i), (i != MAX_COND-1 ? ", " : "\n") ); fprintf( fp, "Addictions " ); for ( i = 0; i < MAX_COND; i++ ) fprintf( fp, "%d%s", GET_ADDICT(ch, i), (i != MAX_COND-1 ? ", " : "\n") ); for ( sn = 0; sn < MAX_SKILLS; sn++ ) { if ( skill_name( sn ) && strcmp( skill_name( sn ), "!UNUSED!" ) && GET_SKILL(ch, sn) > 0 ) { fprintf( fp, "Skill %d '%s'\n", GET_SKILL(ch, sn), skill_name( sn ) ); } } } for ( paf = ch->affected; paf; paf = paf->next ) { fprintf( fp, "Afft %18s~ %3d %3d %3d %lld\n", skill_name( paf->type ), paf->duration, paf->modifier, paf->location, paf->bitvector ); } for ( paf = ch->affected2; paf; paf = paf->next ) { fprintf( fp, "Afft2 %18s~ %3d %3d %3d %lld\n", skill_name( paf->type ), paf->duration, paf->modifier, paf->location, paf->bitvector ); } fprintf( fp, "End\n\n" ); return; }
void medit_parse(struct descriptor_data *d, char *arg) { int i = -1, j; char *oldtext = NULL; if (OLC_MODE(d) > MEDIT_NUMERICAL_RESPONSE) { i = atoi(arg); if (!*arg || (!isdigit(arg[0]) && ((*arg == '-') && !isdigit(arg[1])))) { write_to_output(d, "Try again : "); return; } } else { /* String response. */ if (!genolc_checkstring(d, arg)) return; } switch (OLC_MODE(d)) { case MEDIT_CONFIRM_SAVESTRING: /* Ensure mob has MOB_ISNPC set. */ SET_BIT_AR(MOB_FLAGS(OLC_MOB(d)), MOB_ISNPC); switch (*arg) { case 'y': case 'Y': /* Save the mob in memory and to disk. */ medit_save_internally(d); mudlog(CMP, MAX(LVL_BUILDER, GET_INVIS_LEV(d->character)), TRUE, "OLC: %s edits mob %d", GET_NAME(d->character), OLC_NUM(d)); if (CONFIG_OLC_SAVE) { medit_save_to_disk(zone_table[real_zone_by_thing(OLC_NUM(d))].number); write_to_output(d, "Mobile saved to disk.\r\n"); } else write_to_output(d, "Mobile saved to memory.\r\n"); cleanup_olc(d, CLEANUP_ALL); return; case 'n': case 'N': /* If not saving, we must free the script_proto list. We do so by * assigning it to the edited mob and letting free_mobile in * cleanup_olc handle it. */ OLC_MOB(d)->proto_script = OLC_SCRIPT(d); cleanup_olc(d, CLEANUP_ALL); return; default: write_to_output(d, "Invalid choice!\r\n"); write_to_output(d, "Do you wish to save your changes? : "); return; } break; case MEDIT_MAIN_MENU: i = 0; switch (*arg) { case 'q': case 'Q': if (OLC_VAL(d)) { /* Anything been changed? */ write_to_output(d, "Do you wish to save your changes? : "); OLC_MODE(d) = MEDIT_CONFIRM_SAVESTRING; } else cleanup_olc(d, CLEANUP_ALL); return; case '1': OLC_MODE(d) = MEDIT_SEX; medit_disp_sex(d); return; case '2': OLC_MODE(d) = MEDIT_KEYWORD; i--; break; case '3': OLC_MODE(d) = MEDIT_S_DESC; i--; break; case '4': OLC_MODE(d) = MEDIT_L_DESC; i--; break; case '5': OLC_MODE(d) = MEDIT_D_DESC; send_editor_help(d); write_to_output(d, "Enter mob description:\r\n\r\n"); if (OLC_MOB(d)->player.description) { write_to_output(d, "%s", OLC_MOB(d)->player.description); oldtext = strdup(OLC_MOB(d)->player.description); } string_write(d, &OLC_MOB(d)->player.description, MAX_MOB_DESC, 0, oldtext); OLC_VAL(d) = 1; return; case '6': OLC_MODE(d) = MEDIT_POS; medit_disp_positions(d); return; case '7': OLC_MODE(d) = MEDIT_DEFAULT_POS; medit_disp_positions(d); return; case '8': OLC_MODE(d) = MEDIT_ATTACK; medit_disp_attack_types(d); return; case '9': OLC_MODE(d) = MEDIT_STATS_MENU; medit_disp_stats_menu(d); return; case 'a': case 'A': OLC_MODE(d) = MEDIT_NPC_FLAGS; medit_disp_mob_flags(d); return; case 'b': case 'B': OLC_MODE(d) = MEDIT_AFF_FLAGS; medit_disp_aff_flags(d); return; case 'w': case 'W': write_to_output(d, "Copy what mob? "); OLC_MODE(d) = MEDIT_COPY; return; case 'x': case 'X': write_to_output(d, "Are you sure you want to delete this mobile? "); OLC_MODE(d) = MEDIT_DELETE; return; case 's': case 'S': OLC_SCRIPT_EDIT_MODE(d) = SCRIPT_MAIN_MENU; dg_script_menu(d); return; default: medit_disp_menu(d); return; } if (i == 0) break; else if (i == 1) write_to_output(d, "\r\nEnter new value : "); else if (i == -1) write_to_output(d, "\r\nEnter new text :\r\n] "); else write_to_output(d, "Oops...\r\n"); return; case MEDIT_STATS_MENU: i=0; switch(*arg) { case 'q': case 'Q': medit_disp_menu(d); return; case '1': /* Edit level */ OLC_MODE(d) = MEDIT_LEVEL; i++; break; case '2': /* Autoroll stats */ medit_autoroll_stats(d); medit_disp_stats_menu(d); OLC_VAL(d) = TRUE; return; case '3': OLC_MODE(d) = MEDIT_NUM_HP_DICE; i++; break; case '4': OLC_MODE(d) = MEDIT_SIZE_HP_DICE; i++; break; case '5': OLC_MODE(d) = MEDIT_ADD_HP; i++; break; case '6': OLC_MODE(d) = MEDIT_NDD; i++; break; case '7': OLC_MODE(d) = MEDIT_SDD; i++; break; case '8': OLC_MODE(d) = MEDIT_DAMROLL; i++; break; case 'a': case 'A': OLC_MODE(d) = MEDIT_AC; i++; break; case 'b': case 'B': OLC_MODE(d) = MEDIT_EXP; i++; break; case 'c': case 'C': OLC_MODE(d) = MEDIT_GOLD; i++; break; case 'd': case 'D': OLC_MODE(d) = MEDIT_HITROLL; i++; break; case 'e': case 'E': OLC_MODE(d) = MEDIT_ALIGNMENT; i++; break; case 'f': case 'F': if (!CONFIG_MEDIT_ADVANCED) { write_to_output(d, "Invalid Choice!\r\nEnter Choice : "); return; } OLC_MODE(d) = MEDIT_STR; i++; break; case 'g': case 'G': if (!CONFIG_MEDIT_ADVANCED) { write_to_output(d, "Invalid Choice!\r\nEnter Choice : "); return; } OLC_MODE(d) = MEDIT_INT; i++; break; case 'h': case 'H': if (!CONFIG_MEDIT_ADVANCED) { write_to_output(d, "Invalid Choice!\r\nEnter Choice : "); return; } OLC_MODE(d) = MEDIT_WIS; i++; break; case 'i': case 'I': if (!CONFIG_MEDIT_ADVANCED) { write_to_output(d, "Invalid Choice!\r\nEnter Choice : "); return; } OLC_MODE(d) = MEDIT_DEX; i++; break; case 'j': case 'J': if (!CONFIG_MEDIT_ADVANCED) { write_to_output(d, "Invalid Choice!\r\nEnter Choice : "); return; } OLC_MODE(d) = MEDIT_CON; i++; break; case 'k': case 'K': if (!CONFIG_MEDIT_ADVANCED) { write_to_output(d, "Invalid Choice!\r\nEnter Choice : "); return; } OLC_MODE(d) = MEDIT_CHA; i++; break; case 'l': case 'L': if (!CONFIG_MEDIT_ADVANCED) { write_to_output(d, "Invalid Choice!\r\nEnter Choice : "); return; } OLC_MODE(d) = MEDIT_PARA; i++; break; case 'm': case 'M': if (!CONFIG_MEDIT_ADVANCED) { write_to_output(d, "Invalid Choice!\r\nEnter Choice : "); return; } OLC_MODE(d) = MEDIT_ROD; i++; break; case 'n': case 'N': if (!CONFIG_MEDIT_ADVANCED) { write_to_output(d, "Invalid Choice!\r\nEnter Choice : "); return; } OLC_MODE(d) = MEDIT_PETRI; i++; break; case 'o': case 'O': if (!CONFIG_MEDIT_ADVANCED) { write_to_output(d, "Invalid Choice!\r\nEnter Choice : "); return; } OLC_MODE(d) = MEDIT_BREATH; i++; break; case 'p': case 'P': if (!CONFIG_MEDIT_ADVANCED) { write_to_output(d, "Invalid Choice!\r\nEnter Choice : "); return; } OLC_MODE(d) = MEDIT_SPELL; i++; break; default: medit_disp_stats_menu(d); return; } if (i == 0) break; else if (i == 1) write_to_output(d, "\r\nEnter new value : "); else if (i == -1) write_to_output(d, "\r\nEnter new text :\r\n] "); else write_to_output(d, "Oops...\r\n"); return; case OLC_SCRIPT_EDIT: if (dg_script_edit_parse(d, arg)) return; break; case MEDIT_KEYWORD: smash_tilde(arg); if (GET_ALIAS(OLC_MOB(d))) free(GET_ALIAS(OLC_MOB(d))); GET_ALIAS(OLC_MOB(d)) = str_udup(arg); break; case MEDIT_S_DESC: smash_tilde(arg); if (GET_SDESC(OLC_MOB(d))) free(GET_SDESC(OLC_MOB(d))); GET_SDESC(OLC_MOB(d)) = str_udup(arg); break; case MEDIT_L_DESC: smash_tilde(arg); if (GET_LDESC(OLC_MOB(d))) free(GET_LDESC(OLC_MOB(d))); if (arg && *arg) { char buf[MAX_INPUT_LENGTH]; snprintf(buf, sizeof(buf), "%s\r\n", arg); GET_LDESC(OLC_MOB(d)) = strdup(buf); } else GET_LDESC(OLC_MOB(d)) = strdup("undefined"); break; case MEDIT_D_DESC: /* * We should never get here. */ cleanup_olc(d, CLEANUP_ALL); mudlog(BRF, LVL_BUILDER, TRUE, "SYSERR: OLC: medit_parse(): Reached D_DESC case!"); write_to_output(d, "Oops...\r\n"); break; case MEDIT_NPC_FLAGS: if ((i = atoi(arg)) <= 0) break; else if ( (j = medit_get_mob_flag_by_number(i)) == -1) { write_to_output(d, "Invalid choice!\r\n"); write_to_output(d, "Enter mob flags (0 to quit) :"); return; } else if (j <= NUM_MOB_FLAGS) { TOGGLE_BIT_AR(MOB_FLAGS(OLC_MOB(d)), (j)); } medit_disp_mob_flags(d); return; case MEDIT_AFF_FLAGS: if ((i = atoi(arg)) <= 0) break; else if (i <= NUM_AFF_FLAGS) TOGGLE_BIT_AR(AFF_FLAGS(OLC_MOB(d)), i); /* Remove unwanted bits right away. */ REMOVE_BIT_AR(AFF_FLAGS(OLC_MOB(d)), AFF_CHARM); REMOVE_BIT_AR(AFF_FLAGS(OLC_MOB(d)), AFF_POISON); REMOVE_BIT_AR(AFF_FLAGS(OLC_MOB(d)), AFF_GROUP); REMOVE_BIT_AR(AFF_FLAGS(OLC_MOB(d)), AFF_SLEEP); medit_disp_aff_flags(d); return; /* Numerical responses. */ case MEDIT_SEX: GET_SEX(OLC_MOB(d)) = LIMIT(i - 1, 0, NUM_GENDERS - 1); break; case MEDIT_HITROLL: GET_HITROLL(OLC_MOB(d)) = LIMIT(i, 0, 50); OLC_VAL(d) = TRUE; medit_disp_stats_menu(d); return; case MEDIT_DAMROLL: GET_DAMROLL(OLC_MOB(d)) = LIMIT(i, 0, 50); OLC_VAL(d) = TRUE; medit_disp_stats_menu(d); return; case MEDIT_NDD: GET_NDD(OLC_MOB(d)) = LIMIT(i, 0, 30); OLC_VAL(d) = TRUE; medit_disp_stats_menu(d); return; case MEDIT_SDD: GET_SDD(OLC_MOB(d)) = LIMIT(i, 0, 127); OLC_VAL(d) = TRUE; medit_disp_stats_menu(d); return; case MEDIT_NUM_HP_DICE: GET_HIT(OLC_MOB(d)) = LIMIT(i, 0, 30); OLC_VAL(d) = TRUE; medit_disp_stats_menu(d); return; case MEDIT_SIZE_HP_DICE: GET_MANA(OLC_MOB(d)) = LIMIT(i, 0, 1000); OLC_VAL(d) = TRUE; medit_disp_stats_menu(d); return; case MEDIT_ADD_HP: GET_MOVE(OLC_MOB(d)) = LIMIT(i, 0, 30000); OLC_VAL(d) = TRUE; medit_disp_stats_menu(d); return; case MEDIT_AC: GET_AC(OLC_MOB(d)) = LIMIT(i, -200, 200); OLC_VAL(d) = TRUE; medit_disp_stats_menu(d); return; case MEDIT_EXP: GET_EXP(OLC_MOB(d)) = LIMIT(i, 0, MAX_MOB_EXP); OLC_VAL(d) = TRUE; medit_disp_stats_menu(d); return; case MEDIT_GOLD: GET_GOLD(OLC_MOB(d)) = LIMIT(i, 0, MAX_MOB_GOLD); OLC_VAL(d) = TRUE; medit_disp_stats_menu(d); return; case MEDIT_STR: GET_STR(OLC_MOB(d)) = LIMIT(i, 11, 25); OLC_VAL(d) = TRUE; medit_disp_stats_menu(d); return; case MEDIT_INT: GET_INT(OLC_MOB(d)) = LIMIT(i, 11, 25); OLC_VAL(d) = TRUE; medit_disp_stats_menu(d); return; case MEDIT_WIS: GET_WIS(OLC_MOB(d)) = LIMIT(i, 11, 25); OLC_VAL(d) = TRUE; medit_disp_stats_menu(d); return; case MEDIT_DEX: GET_DEX(OLC_MOB(d)) = LIMIT(i, 11, 25); OLC_VAL(d) = TRUE; medit_disp_stats_menu(d); return; case MEDIT_CON: GET_CON(OLC_MOB(d)) = LIMIT(i, 11, 25); OLC_VAL(d) = TRUE; medit_disp_stats_menu(d); return; case MEDIT_CHA: GET_CHA(OLC_MOB(d)) = LIMIT(i, 11, 25); OLC_VAL(d) = TRUE; medit_disp_stats_menu(d); return; case MEDIT_PARA: GET_SAVE(OLC_MOB(d), SAVING_PARA) = LIMIT(i, 0, 100); OLC_VAL(d) = TRUE; medit_disp_stats_menu(d); return; case MEDIT_ROD: GET_SAVE(OLC_MOB(d), SAVING_ROD) = LIMIT(i, 0, 100); OLC_VAL(d) = TRUE; medit_disp_stats_menu(d); return; case MEDIT_PETRI: GET_SAVE(OLC_MOB(d), SAVING_PETRI) = LIMIT(i, 0, 100); OLC_VAL(d) = TRUE; medit_disp_stats_menu(d); return; case MEDIT_BREATH: GET_SAVE(OLC_MOB(d), SAVING_BREATH) = LIMIT(i, 0, 100); OLC_VAL(d) = TRUE; medit_disp_stats_menu(d); return; case MEDIT_SPELL: GET_SAVE(OLC_MOB(d), SAVING_SPELL) = LIMIT(i, 0, 100); OLC_VAL(d) = TRUE; medit_disp_stats_menu(d); return; case MEDIT_POS: GET_POS(OLC_MOB(d)) = LIMIT(i - 1, 0, NUM_POSITIONS - 1); break; case MEDIT_DEFAULT_POS: GET_DEFAULT_POS(OLC_MOB(d)) = LIMIT(i - 1, 0, NUM_POSITIONS - 1); break; case MEDIT_ATTACK: GET_ATTACK(OLC_MOB(d)) = LIMIT(i, 0, NUM_ATTACK_TYPES - 1); break; case MEDIT_LEVEL: GET_LEVEL(OLC_MOB(d)) = LIMIT(i, 1, LVL_IMPL); OLC_VAL(d) = TRUE; medit_disp_stats_menu(d); return; case MEDIT_ALIGNMENT: GET_ALIGNMENT(OLC_MOB(d)) = LIMIT(i, -1000, 1000); OLC_VAL(d) = TRUE; medit_disp_stats_menu(d); return; case MEDIT_COPY: if ((i = real_mobile(atoi(arg))) != NOWHERE) { medit_setup_existing(d, i); } else write_to_output(d, "That mob does not exist.\r\n"); break; case MEDIT_DELETE: if (*arg == 'y' || *arg == 'Y') { if (delete_mobile(GET_MOB_RNUM(OLC_MOB(d))) != NOBODY) write_to_output(d, "Mobile deleted.\r\n"); else write_to_output(d, "Couldn't delete the mobile!\r\n"); cleanup_olc(d, CLEANUP_ALL); return; } else if (*arg == 'n' || *arg == 'N') { medit_disp_menu(d); OLC_MODE(d) = MEDIT_MAIN_MENU; return; } else write_to_output(d, "Please answer 'Y' or 'N': "); break; default: /* We should never get here. */ cleanup_olc(d, CLEANUP_ALL); mudlog(BRF, LVL_BUILDER, TRUE, "SYSERR: OLC: medit_parse(): Reached default case!"); write_to_output(d, "Oops...\r\n"); break; } /* END OF CASE If we get here, we have probably changed something, and now want to return to main menu. Use OLC_VAL as a 'has changed' flag */ OLC_VAL(d) = TRUE; medit_disp_menu(d); }
int save_mobiles(zone_rnum rznum) { zone_vnum vznum; FILE *mobfd; room_vnum i; mob_rnum rmob; int written; char mobfname[64], usedfname[64]; #if CIRCLE_UNSIGNED_INDEX if (rznum == NOWHERE || rznum > top_of_zone_table) { #else if (rznum < 0 || rznum > top_of_zone_table) { #endif log("SYSERR: GenOLC: save_mobiles: Invalid real zone number %d. (0-%d)", rznum, top_of_zone_table); return FALSE; } vznum = zone_table[rznum].number; snprintf(mobfname, sizeof(mobfname), "%s%d.new", MOB_PREFIX, vznum); if ((mobfd = fopen(mobfname, "w")) == NULL) { mudlog(BRF, LVL_GOD, TRUE, "SYSERR: GenOLC: Cannot open mob file for writing."); return FALSE; } for (i = genolc_zone_bottom(rznum); i <= zone_table[rznum].top; i++) { if ((rmob = real_mobile(i)) == NOBODY) continue; check_mobile_strings(&mob_proto[rmob]); if (write_mobile_record(i, &mob_proto[rmob], mobfd) < 0) log("SYSERR: GenOLC: Error writing mobile #%d.", i); } fputs("$\n", mobfd); written = ftell(mobfd); fclose(mobfd); snprintf(usedfname, sizeof(usedfname), "%s%d.mob", MOB_PREFIX, vznum); remove(usedfname); rename(mobfname, usedfname); if (in_save_list(vznum, SL_MOB)) remove_from_save_list(vznum, SL_MOB); log("GenOLC: '%s' saved, %d bytes written.", usedfname, written); return written; } int write_mobile_espec(mob_vnum mvnum, struct char_data *mob, FILE *fd) { if (GET_ATTACK(mob) != 0) fprintf(fd, "BareHandAttack: %d\n", GET_ATTACK(mob)); if (GET_STR(mob) != 11) fprintf(fd, "Str: %d\n", GET_STR(mob)); if (GET_ADD(mob) != 0) fprintf(fd, "StrAdd: %d\n", GET_ADD(mob)); if (GET_DEX(mob) != 11) fprintf(fd, "Dex: %d\n", GET_DEX(mob)); if (GET_INT(mob) != 11) fprintf(fd, "Int: %d\n", GET_INT(mob)); if (GET_WIS(mob) != 11) fprintf(fd, "Wis: %d\n", GET_WIS(mob)); if (GET_CON(mob) != 11) fprintf(fd, "Con: %d\n", GET_CON(mob)); if (GET_CHA(mob) != 11) fprintf(fd, "Cha: %d\n", GET_CHA(mob)); if (GET_SAVE(mob, SAVING_PARA) != 0) fprintf(fd, "SavingPara: %d\n", GET_SAVE(mob, SAVING_PARA)); if (GET_SAVE(mob, SAVING_ROD) != 0) fprintf(fd, "SavingRod: %d\n", GET_SAVE(mob, SAVING_ROD)); if (GET_SAVE(mob, SAVING_PETRI) != 0) fprintf(fd, "SavingPetri: %d\n", GET_SAVE(mob, SAVING_PETRI)); if (GET_SAVE(mob, SAVING_BREATH) != 0) fprintf(fd, "SavingBreath: %d\n", GET_SAVE(mob, SAVING_BREATH)); if (GET_SAVE(mob, SAVING_SPELL) != 0) fprintf(fd, "SavingSpell: %d\n", GET_SAVE(mob, SAVING_SPELL)); fputs("E\n", fd); return TRUE; } int write_mobile_record(mob_vnum mvnum, struct char_data *mob, FILE *fd) { char ldesc[MAX_STRING_LENGTH]; char ddesc[MAX_STRING_LENGTH]; char buf[MAX_STRING_LENGTH]; ldesc[MAX_STRING_LENGTH - 1] = '\0'; ddesc[MAX_STRING_LENGTH - 1] = '\0'; strip_cr(strncpy(ldesc, GET_LDESC(mob), MAX_STRING_LENGTH - 1)); strip_cr(strncpy(ddesc, GET_DDESC(mob), MAX_STRING_LENGTH - 1)); int n = snprintf(buf, MAX_STRING_LENGTH, "#%d\n" "%s%c\n" "%s%c\n" "%s%c\n" "%s%c\n", mvnum, GET_ALIAS(mob), STRING_TERMINATOR, GET_SDESC(mob), STRING_TERMINATOR, ldesc, STRING_TERMINATOR, ddesc, STRING_TERMINATOR ); if(n < MAX_STRING_LENGTH) { fprintf(fd, "%s", convert_from_tabs(buf)); fprintf(fd, "%d %d %d %d %d %d %d %d %d E\n" "%d %d %d %dd%d+%d %dd%d+%d\n", MOB_FLAGS(mob)[0], MOB_FLAGS(mob)[1], MOB_FLAGS(mob)[2], MOB_FLAGS(mob)[3], AFF_FLAGS(mob)[0], AFF_FLAGS(mob)[1], AFF_FLAGS(mob)[2], AFF_FLAGS(mob)[3], GET_ALIGNMENT(mob), GET_LEVEL(mob), 20 - GET_HITROLL(mob), GET_AC(mob) / 10, GET_HIT(mob), GET_MANA(mob), GET_MOVE(mob), GET_NDD(mob), GET_SDD(mob), GET_DAMROLL(mob)); fprintf(fd, "%d %d\n" "%d %d %d\n", GET_GOLD(mob), GET_EXP(mob), GET_POS(mob), GET_DEFAULT_POS(mob), GET_SEX(mob) ); if (write_mobile_espec(mvnum, mob, fd) < 0) log("SYSERR: GenOLC: Error writing E-specs for mobile #%d.", mvnum); script_save_to_disk(fd, mob, MOB_TRIGGER); #if CONFIG_GENOLC_MOBPROG if (write_mobile_mobprog(mvnum, mob, fd) < 0) log("SYSERR: GenOLC: Error writing MobProgs for mobile #%d.", mvnum); #endif } else { mudlog(BRF,LVL_BUILDER,TRUE, "SYSERR: Could not save mobile #%d due to size (%d > maximum of %d)", mvnum, n, MAX_STRING_LENGTH); } return TRUE; }