void restore_creature_affects(struct creature *ch, struct aff_stash *aff_stash) { struct affected_type *cur_aff; int pos; for (pos = 0; pos < NUM_WEARS; pos++) { if (aff_stash->saved_eq[pos]) equip_char(ch, aff_stash->saved_eq[pos], pos, EQUIP_WORN); if (aff_stash->saved_impl[pos]) equip_char(ch, aff_stash->saved_impl[pos], pos, EQUIP_IMPLANT); if (aff_stash->saved_tattoo[pos]) equip_char(ch, aff_stash->saved_tattoo[pos], pos, EQUIP_TATTOO); } for (cur_aff = aff_stash->saved_affs; cur_aff; cur_aff = cur_aff->next) affect_modify(ch, cur_aff->location, cur_aff->modifier, cur_aff->bitvector, cur_aff->aff_index, true); ch->affected = aff_stash->saved_affs; affect_total(ch); }
int load_char_objs(Character *ch) { char buf[400]; sql_stmt *stmt; int total = 0; int len = sprintf(buf, "select * from char_objects where carriedById=%" PRId64, ch->id); if (sql_query(buf, len, &stmt) != SQL_OK) { log_data("could not prepare statement"); return 0; } while (sql_step(stmt) != SQL_DONE) { Object *obj = new_object(); obj->carriedBy = ch; load_obj_columns(obj, stmt); LINK(obj->area->objects, obj, next_in_area); LINK(first_object, obj, next); if (!obj->inObj) { LINK(ch->carrying, obj, next_content); if (obj->wearLoc != WEAR_NONE) { equip_char(ch, obj, obj->wearLoc); } } else { LINK(obj->inObj->contains, obj, next_content); } total++; } if (sql_finalize(stmt) != SQL_OK) { log_data("could not finalize statement"); } return total; }
/* * return values: * 0 - successful load, keep char in rent room. * 1 - load failure or load of crash items -- put char in temple. * 2 - rented equipment lost (no $) */ int Crash_load(struct char_data * ch) { FILE *fl; char fname[MAX_STRING_LENGTH]; struct obj_file_elem object; struct rent_info rent; int cost, orig_rent_code, num_objs = 0, j; float num_of_days; struct obj_data *obj, *obj2, *cont_row[MAX_BAG_ROWS]; int location; /* Empty all of the container lists (you never know ...) */ for (j = 0; j < MAX_BAG_ROWS; j++) cont_row[j] = NULL; if (!get_filename(GET_NAME(ch), fname, CRASH_FILE)) return 1; if (!(fl = fopen(fname, "r+b"))) { if (errno != ENOENT) { /* if it fails, NOT because of no file */ sprintf(buf1, "SYSERR: READING OBJECT FILE %s (5)", fname); perror(buf1); send_to_char("\r\n********************* NOTICE *********************\r\n" "There was a problem loading your objects from disk.\r\n" "Contact a God for assistance.\r\n", ch); } sprintf(buf, "%s entering game with NO equipment.", GET_NAME(ch)); mudlog(buf, NRM, MAX((int)LVL_IMMORT, (int)GET_INVIS_LEV(ch)), TRUE); return 1; } if (!feof(fl)) fread(&rent, sizeof(struct rent_info), 1, fl); else { plog("SYSERR: Crash_load: %s's rent file was empty!", GET_NAME(ch)); return 1; } if (rent.rentcode == RENT_RENTED || rent.rentcode == RENT_TIMEDOUT) { num_of_days = (float) (time(0) - rent.time) / SECS_PER_REAL_DAY; cost = (int) (rent.net_cost_per_diem * num_of_days); if (cost > GET_GOLD(ch) + GET_BANK_GOLD(ch)) { fclose(fl); sprintf(buf, "%s entering game, rented equipment lost (no $).", GET_NAME(ch)); mudlog(buf, BRF, MAX((int)LVL_IMMORT, (int)GET_INVIS_LEV(ch)), TRUE); Crash_crashsave(ch); return 2; } else { GET_BANK_GOLD(ch) -= MAX((long)cost - GET_GOLD(ch), 0L); GET_GOLD(ch) = MAX((long)GET_GOLD(ch) - cost, 0L); save_char(ch, NOWHERE); } } switch (orig_rent_code = rent.rentcode) { case RENT_RENTED: sprintf(buf, "%s un-renting and entering game.", GET_NAME(ch)); mudlog(buf, NRM, MAX((int)LVL_IMMORT, (int)GET_INVIS_LEV(ch)), TRUE); break; case RENT_CRASH: sprintf(buf, "%s retrieving crash-saved items and entering game.", GET_NAME(ch)); mudlog(buf, NRM, MAX((int)LVL_IMMORT, (int)GET_INVIS_LEV(ch)), TRUE); break; case RENT_CRYO: sprintf(buf, "%s un-cryo'ing and entering game.", GET_NAME(ch)); mudlog(buf, NRM, MAX((int)LVL_IMMORT, (int)GET_INVIS_LEV(ch)), TRUE); break; case RENT_FORCED: case RENT_TIMEDOUT: sprintf(buf, "%s retrieving force-saved items and entering game.", GET_NAME(ch)); mudlog(buf, NRM, MAX((int)LVL_IMMORT, (int)GET_INVIS_LEV(ch)), TRUE); break; default: sprintf(buf, "WARNING: %s entering game with undefined rent code.", GET_NAME(ch)); mudlog(buf, BRF, MAX((int)LVL_IMMORT, (int)GET_INVIS_LEV(ch)), TRUE); break; } while (!feof(fl)) { fread(&object, sizeof(struct obj_file_elem), 1, fl); if (ferror(fl)) { perror("Reading crash file: Crash_load."); fclose(fl); return 1; } if (feof(fl)) break; ++num_objs; if ( (obj = Obj_from_store(object, &location)) == NULL ) continue; auto_equip( ch, obj, location ); /* * What to do with a new loaded item: * * If there's a list with location less than 1 below this, then its * container has disappeared from the file so we put the list back into * the character's inventory. (Equipped items are 0 here.) * * If there's a list of contents with location of 1 below this, then we * check if it is a container: * - Yes: Get it from the character, fill it, and give it back so we * have the correct weight. * - No: The container is missing so we put everything back into the * character's inventory. * * For items with negative location, we check if there is already a list * of contents with the same location. If so, we put it there and if not, * we start a new list. * * Since location for contents is < 0, the list indices are switched to * non-negative. * * This looks ugly, but it works. */ if (location > 0) { /* Equipped */ for (j = MAX_BAG_ROWS - 1; j > 0; j--) { if (cont_row[j]) { /* No container, back to inventory. */ for (; cont_row[j]; cont_row[j] = obj2) { obj2 = cont_row[j]->next_content; obj_to_char(cont_row[j], ch); } cont_row[j] = NULL; } } if (cont_row[0]) { /* Content list existing. */ if (GET_OBJ_TYPE(obj) == ITEM_CONTAINER) { /* Remove object, fill it, equip again. */ obj = unequip_char(ch, location - 1); obj->contains = NULL; /* Should be NULL anyway, but just in case. */ for (; cont_row[0]; cont_row[0] = obj2) { obj2 = cont_row[0]->next_content; obj_to_obj(cont_row[0], obj); } equip_char(ch, obj, location - 1); } else { /* Object isn't container, empty the list. */ for (; cont_row[0]; cont_row[0] = obj2) { obj2 = cont_row[0]->next_content; obj_to_char(cont_row[0], ch); } cont_row[0] = NULL; } } } else { /* location <= 0 */ for (j = MAX_BAG_ROWS - 1; j > -location; j--) { if (cont_row[j]) { /* No container, back to inventory. */ for (; cont_row[j]; cont_row[j] = obj2) { obj2 = cont_row[j]->next_content; obj_to_char(cont_row[j], ch); } cont_row[j] = NULL; } } if (j == -location && cont_row[j]) { /* Content list exists. */ if (GET_OBJ_TYPE(obj) == ITEM_CONTAINER) { /* Take the item, fill it, and give it back. */ obj_from_char(obj); obj->contains = NULL; for (; cont_row[j]; cont_row[j] = obj2) { obj2 = cont_row[j]->next_content; obj_to_obj(cont_row[j], obj); } obj_to_char(obj, ch); /* Add to inventory first. */ } else { /* Object isn't container, empty content list. */ for (; cont_row[j]; cont_row[j] = obj2) { obj2 = cont_row[j]->next_content; obj_to_char(cont_row[j], ch); } cont_row[j] = NULL; } } if (location < 0 && location >= -MAX_BAG_ROWS) { /* * Let the object be part of the content list but put it at the * list's end. Thus having the items in the same order as before * the character rented. */ obj_from_char(obj); if ((obj2 = cont_row[-location - 1]) != NULL) { while (obj2->next_content) obj2 = obj2->next_content; obj2->next_content = obj; } else cont_row[-location - 1] = obj; } } } /* Little hoarding check. -gg 3/1/98 */ sprintf(fname, "%s (level %d) has %d object%s (max %d).", GET_NAME(ch), GET_LEVEL(ch), num_objs, num_objs != 1 ? "s" : "", max_obj_save); mudlog(fname, NRM, MAX(GET_INVIS_LEV(ch), LVL_GOD), TRUE); /* turn this into a crash file by re-writing the control block */ rent.rentcode = RENT_CRASH; rent.time = time(0); rewind(fl); Crash_write_rentcode(ch, fl, &rent); fclose(fl); if ((orig_rent_code == RENT_RENTED) || (orig_rent_code == RENT_CRYO)) return (0); else return (1); }
void auto_equip(struct char_data *ch, struct obj_data *obj, int location) { int j; if (location > 0) { /* was worn */ switch (j = (location - 1)) { case WEAR_FINGER_R: case WEAR_FINGER_L: if (!CAN_WEAR(obj,ITEM_WEAR_FINGER)) location = LOC_INVENTORY; break; case WEAR_NECK_1: case WEAR_NECK_2: if (!CAN_WEAR(obj,ITEM_WEAR_NECK)) location = LOC_INVENTORY; break; case WEAR_BODY: if (!CAN_WEAR(obj,ITEM_WEAR_BODY)) location = LOC_INVENTORY; break; case WEAR_HEAD: if (!CAN_WEAR(obj,ITEM_WEAR_HEAD)) location = LOC_INVENTORY; break; case WEAR_LEGS: if (!CAN_WEAR(obj,ITEM_WEAR_LEGS)) location = LOC_INVENTORY; break; case WEAR_FOOT_R: case WEAR_FOOT_L: if (!CAN_WEAR(obj,ITEM_WEAR_FEET)) location = LOC_INVENTORY; break; case WEAR_HAND_R: case WEAR_HAND_L: if (!CAN_WEAR(obj,ITEM_WEAR_HANDS)) location = LOC_INVENTORY; break; case WEAR_ARM_R: case WEAR_ARM_L: if (!CAN_WEAR(obj,ITEM_WEAR_ARMS)) location = LOC_INVENTORY; break; case WEAR_BACK: if (!CAN_WEAR(obj,ITEM_WEAR_BACK)) location = LOC_INVENTORY; break; case WEAR_WAIST: if (!CAN_WEAR(obj,ITEM_WEAR_WAIST)) location = LOC_INVENTORY; break; case WEAR_WRIST_R: case WEAR_WRIST_L: if (!CAN_WEAR(obj,ITEM_WEAR_WRIST)) location = LOC_INVENTORY; break; case WEAR_WIELD: case WEAR_HOLD: if (!CAN_WEAR(obj, ITEM_WEAR_HOLD) && !CAN_WEAR(obj, ITEM_WEAR_TAKE)) location = LOC_INVENTORY; break; default: location = LOC_INVENTORY; } if (location > 0) { if (!GET_EQ(ch,j)) { /* check ch's alignment to prevent $M from being zapped through auto-equip */ 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))) location = LOC_INVENTORY; else equip_char(ch, obj, j); } else { /* oops - saved player with double equipment[j]? */ char aeq[128]; sprintf(aeq, "SYSERR: autoeq: '%s' already equipped in position %d.", GET_NAME(ch), location); mudlog(aeq, BRF, LVL_IMMORT, TRUE); location = LOC_INVENTORY; } } } if ( location <= 0 ) obj_to_char(obj, ch); }
void wear(struct char_data *ch, struct obj_data *obj_object, int keyword) { char buffer[MAX_STRING_LENGTH]; switch(keyword) { case 0: { /* LIGHT SOURCE */ if (ch->equipment[WEAR_LIGHT]) send_to_char("You are already holding a light source.\n\r", ch); else { send_to_char("Ok.\n\r", ch); perform_wear(ch,obj_object,keyword); obj_from_char(obj_object); equip_char(ch,obj_object, WEAR_LIGHT); if (obj_object->obj_flags.value[2]) world[ch->in_room].light++; } } break; case 1: { if (CAN_WEAR(obj_object,ITEM_WEAR_FINGER)) { if ((ch->equipment[WEAR_FINGER_L]) && (ch->equipment[WEAR_FINGER_R])) { send_to_char( "You are already wearing something on your fingers.\n\r", ch); } else { perform_wear(ch,obj_object,keyword); if (ch->equipment[WEAR_FINGER_L]) { sprintf(buffer, "You put the %s on your right finger.\n\r", fname(obj_object->name)); send_to_char(buffer, ch); obj_from_char(obj_object); equip_char(ch, obj_object, WEAR_FINGER_R); } else { sprintf(buffer, "You put the %s on your left finger.\n\r", fname(obj_object->name)); send_to_char(buffer, ch); obj_from_char(obj_object); equip_char(ch, obj_object, WEAR_FINGER_L); } } } else { send_to_char("You can't wear that on your finger.\n\r", ch); } } break; case 2: { if (CAN_WEAR(obj_object,ITEM_WEAR_NECK)) { if ((ch->equipment[WEAR_NECK_1]) && (ch->equipment[WEAR_NECK_2])) { send_to_char("You can't wear any more around your neck.\n\r", ch); } else { send_to_char("OK.\n\r", ch); perform_wear(ch,obj_object,keyword); if (ch->equipment[WEAR_NECK_1]) { obj_from_char(obj_object); equip_char(ch, obj_object, WEAR_NECK_2); } else { obj_from_char(obj_object); equip_char(ch, obj_object, WEAR_NECK_1); } } } else { send_to_char("You can't wear that around your neck.\n\r", ch); } } break; case 3: { if (CAN_WEAR(obj_object,ITEM_WEAR_BODY)) { if (ch->equipment[WEAR_BODY]) { send_to_char("You already wear something on your body.\n\r", ch); } else { send_to_char("OK.\n\r", ch); perform_wear(ch,obj_object,keyword); obj_from_char(obj_object); equip_char(ch, obj_object, WEAR_BODY); } } else { send_to_char("You can't wear that on your body.\n\r", ch); } } break; case 4: { if (CAN_WEAR(obj_object,ITEM_WEAR_HEAD)) { if (ch->equipment[WEAR_HEAD]) { send_to_char("You already wear something on your head.\n\r", ch); } else { send_to_char("OK.\n\r", ch); perform_wear(ch,obj_object,keyword); obj_from_char(obj_object); equip_char(ch, obj_object, WEAR_HEAD); } } else { send_to_char("You can't wear that on your head.\n\r", ch); } } break; case 5: { if (CAN_WEAR(obj_object,ITEM_WEAR_LEGS)) { if (ch->equipment[WEAR_LEGS]) { send_to_char("You already wear something on your legs.\n\r", ch); } else { send_to_char("OK.\n\r", ch); perform_wear(ch,obj_object,keyword); obj_from_char(obj_object); equip_char(ch, obj_object, WEAR_LEGS); } } else { send_to_char("You can't wear that on your legs.\n\r", ch); } } break; case 6: { if (CAN_WEAR(obj_object,ITEM_WEAR_FEET)) { if (ch->equipment[WEAR_FEET]) { send_to_char("You already wear something on your feet.\n\r", ch); } else { send_to_char("OK.\n\r", ch); perform_wear(ch,obj_object,keyword); obj_from_char(obj_object); equip_char(ch, obj_object, WEAR_FEET); } } else { send_to_char("You can't wear that on your feet.\n\r", ch); } } break; case 7: { if (CAN_WEAR(obj_object,ITEM_WEAR_HANDS)) { if (ch->equipment[WEAR_HANDS]) { send_to_char("You already wear something on your hands.\n\r", ch); } else { send_to_char("OK.\n\r", ch); perform_wear(ch,obj_object,keyword); obj_from_char(obj_object); equip_char(ch, obj_object, WEAR_HANDS); } } else { send_to_char("You can't wear that on your hands.\n\r", ch); } } break; case 8: { if (CAN_WEAR(obj_object,ITEM_WEAR_ARMS)) { if (ch->equipment[WEAR_ARMS]) { send_to_char("You already wear something on your arms.\n\r", ch); } else { send_to_char("OK.\n\r", ch); perform_wear(ch,obj_object,keyword); obj_from_char(obj_object); equip_char(ch, obj_object, WEAR_ARMS); } } else { send_to_char("You can't wear that on your arms.\n\r", ch); } } break; case 9: { if (CAN_WEAR(obj_object,ITEM_WEAR_ABOUT)) { if (ch->equipment[WEAR_ABOUT]) { send_to_char("You already wear something about your body.\n\r", ch); } else { send_to_char("OK.\n\r", ch); perform_wear(ch,obj_object,keyword); obj_from_char(obj_object); equip_char(ch, obj_object, WEAR_ABOUT); } } else { send_to_char("You can't wear that about your body.\n\r", ch); } } break; case 10: { if (CAN_WEAR(obj_object,ITEM_WEAR_WAISTE)) { if (ch->equipment[WEAR_WAISTE]) { send_to_char("You already wear something about your waiste.\n\r", ch); } else { send_to_char("OK.\n\r", ch); perform_wear(ch,obj_object,keyword); obj_from_char(obj_object); equip_char(ch, obj_object, WEAR_WAISTE); } } else { send_to_char("You can't wear that about your waist.\n\r", ch); } } break; case 11: { if (CAN_WEAR(obj_object,ITEM_WEAR_WRIST)) { if ((ch->equipment[WEAR_WRIST_L]) && (ch->equipment[WEAR_WRIST_R])) { send_to_char( "You already wear something around both your wrists.\n\r", ch); } else { perform_wear(ch,obj_object,keyword); obj_from_char(obj_object); if (ch->equipment[WEAR_WRIST_L]) { sprintf(buffer, "You wear the %s around your right wrist.\n\r", fname(obj_object->name)); send_to_char(buffer, ch); equip_char(ch, obj_object, WEAR_WRIST_R); } else { sprintf(buffer, "You wear the %s around your left wrist.\n\r", fname(obj_object->name)); send_to_char(buffer, ch); equip_char(ch, obj_object, WEAR_WRIST_L); } } } else { send_to_char("You can't wear that around your wrist.\n\r", ch); } } break; case 12: if (CAN_WEAR(obj_object,ITEM_WIELD)) { if (ch->equipment[WIELD]) { send_to_char("You are already wielding something.\n\r", ch); } else { /* Cleric execption has been removed, and is temporarily placed */ /* at the end of this file */ if (GET_OBJ_WEIGHT(obj_object) > str_app[STRENGTH_APPLY_INDEX(ch)].wield_w) { send_to_char("It is too heavy for you to use.\n\r",ch); } else { send_to_char("OK.\n\r", ch); perform_wear(ch,obj_object,keyword); obj_from_char(obj_object); equip_char(ch, obj_object, WIELD); } } } else { send_to_char("You can't wield that.\n\r", ch); } break; case 13: if (CAN_WEAR(obj_object,ITEM_HOLD)) { if (ch->equipment[HOLD]) { send_to_char("You are already holding something.\n\r", ch); } else { /* Cleric execption has been removed, and is temporarily placed */ /* at the end of this file */ send_to_char("OK.\n\r", ch); perform_wear(ch,obj_object,keyword); obj_from_char(obj_object); equip_char(ch, obj_object, HOLD); } } else { send_to_char("You can't hold this.\n\r", ch); } break; case 14: { if (CAN_WEAR(obj_object,ITEM_WEAR_SHIELD)) { if ((ch->equipment[WEAR_SHIELD])) { send_to_char( "You are already using a shield\n\r", ch); } else { perform_wear(ch,obj_object,keyword); sprintf(buffer, "You start using the %s.\n\r", fname(obj_object->name)); send_to_char(buffer, ch); obj_from_char(obj_object); equip_char(ch, obj_object, WEAR_SHIELD); } } else { send_to_char("You can't use that as a shield.\n\r", ch); } } break; case -1: { sprintf(buffer,"Wear %s where?.\n\r", fname(obj_object->name)); send_to_char(buffer, ch); } break; case -2: { sprintf(buffer,"You can't wear the %s.\n\r", fname(obj_object->name)); send_to_char(buffer, ch); } break; default: { log("Unknown type called in wear."); } break; } }
void do_bind( CHAR_DATA * ch, char *argument ) { OBJ_DATA *obj; OBJ_DATA *tobj; int schance; CHAR_DATA *victim; bool checkbinders = FALSE; if( argument[0] == '\0' ) { send_to_char( "Syntax: Bind <victim>\n\r", ch ); return; } if( ( victim = get_char_room( ch, argument ) ) == NULL ) { send_to_char( "They are not here.\n\r", ch ); return; } if( victim == ch ) { send_to_char( "You can not bind yourself!\n\r", ch ); return; } if( IS_NPC( victim ) ) { send_to_char( "You can only bind players.\n\r", ch ); return; } if( IS_SET( victim->pcdata->act2, ACT_BOUND ) ) { send_to_char( "They've already been bound!\n\r", ch ); return; } for( obj = ch->last_carrying; obj; obj = obj->prev_content ) if( obj->item_type == ITEM_BINDERS ) { checkbinders = TRUE; break; } if( checkbinders == FALSE ) { send_to_char( "You don't have any binders to bind them with.\n\r", ch ); return; } if( victim->position != POS_STUNNED && victim->position != POS_SLEEPING ) { send_to_char( "They need to be stunned or asleep.\n\r", ch ); return; } schance = ( int )( ch->pcdata->learned[gsn_bind] ); if( number_percent( ) < schance ) { separate_obj( obj ); obj_from_char( obj ); obj_to_char( obj, victim ); act( AT_WHITE, "You quickly bind $N's wrists.", ch, NULL, victim, TO_CHAR ); act( AT_WHITE, "$n quickly binds your wrists.", ch, NULL, victim, TO_VICT ); act( AT_WHITE, "$n quickly binds $N's wrists.", ch, NULL, victim, TO_NOTVICT ); tobj = get_eq_char( ch, WEAR_BOTH_WRISTS ); if( tobj ) unequip_char( ch, tobj ); equip_char( victim, obj, WEAR_BOTH_WRISTS ); SET_BIT( victim->pcdata->act2, ACT_BOUND ); learn_from_success( ch, gsn_bind ); } else { send_to_char( "You peer at the binders, curious upon how to use them.\n\r", ch ); learn_from_failure( ch, gsn_bind ); } return; }
/* * Reset one room. */ void reset_room( ROOM_INDEX_DATA * room ) { RESET_DATA *pReset, *tReset, *gReset; OBJ_DATA *nestmap[MAX_NEST]; CHAR_DATA *mob; OBJ_DATA *obj, *lastobj, *to_obj; ROOM_INDEX_DATA *pRoomIndex = NULL; MOB_INDEX_DATA *pMobIndex = NULL; OBJ_INDEX_DATA *pObjIndex = NULL, *pObjToIndex; EXIT_DATA *pexit; const char *filename = room->area->filename; int level = 0, n, num = 0, lastnest, onreset = 0; mob = NULL; obj = NULL; lastobj = NULL; if ( !room->first_reset ) return; level = 0; for ( pReset = room->first_reset; pReset; pReset = pReset->next ) { ++onreset; switch ( pReset->command ) { default: bug( "%s: %s: bad command %c.", __FUNCTION__, filename, pReset->command ); break; case 'M': if ( !( pMobIndex = get_mob_index( pReset->arg1 ) ) ) { bug( "%s: %s: 'M': bad mob vnum %d.", __FUNCTION__, filename, pReset->arg1 ); continue; } if ( !( pRoomIndex = get_room_index( pReset->arg3 ) ) ) { bug( "%s: %s: 'M': bad room vnum %d.", __FUNCTION__, filename, pReset->arg3 ); continue; } if ( !pReset->sreset ) { mob = NULL; break; } mob = create_mobile( pMobIndex ); { ROOM_INDEX_DATA *pRoomPrev = get_room_index( pReset->arg3 - 1 ); if ( pRoomPrev && xIS_SET( pRoomPrev->room_flags, ROOM_PET_SHOP ) ) xSET_BIT( mob->act, ACT_PET ); } if ( room_is_dark( pRoomIndex ) ) xSET_BIT( mob->affected_by, AFF_INFRARED ); mob->resetvnum = pRoomIndex->vnum; mob->resetnum = onreset; pReset->sreset = false; char_to_room( mob, pRoomIndex ); level = URANGE( 0, mob->level - 2, LEVEL_AVATAR ); if ( pReset->first_reset ) { for ( tReset = pReset->first_reset; tReset; tReset = tReset->next_reset ) { ++onreset; switch ( tReset->command ) { case 'G': case 'E': if ( !( pObjIndex = get_obj_index( tReset->arg1 ) ) ) { bug( "%s: %s: 'E' or 'G': bad obj vnum %d.", __FUNCTION__, filename, tReset->arg1 ); continue; } if ( !mob ) { lastobj = NULL; break; } if ( mob->pIndexData->pShop ) { int olevel = generate_itemlevel( room->area, pObjIndex ); obj = create_object( pObjIndex, olevel ); xSET_BIT( obj->extra_flags, ITEM_INVENTORY ); } else obj = create_object( pObjIndex, number_fuzzy( level ) ); obj->level = URANGE( 0, obj->level, LEVEL_AVATAR ); obj = obj_to_char( obj, mob ); if ( tReset->command == 'E' ) { if ( obj->carried_by != mob ) { bug( "'E' reset: can't give object %d to mob %d.", obj->pIndexData->vnum, mob->pIndexData->vnum ); break; } equip_char( mob, obj, tReset->arg3 ); } for ( n = 0; n < MAX_NEST; n++ ) nestmap[n] = NULL; nestmap[0] = obj; lastobj = nestmap[0]; lastnest = 0; if ( tReset->first_reset ) { for ( gReset = tReset->first_reset; gReset; gReset = gReset->next_reset ) { int iNest; to_obj = lastobj; ++onreset; switch ( gReset->command ) { case 'H': if ( !lastobj ) break; xSET_BIT( lastobj->extra_flags, ITEM_HIDDEN ); break; case 'P': if ( !( pObjIndex = get_obj_index( gReset->arg1 ) ) ) { bug( "%s: %s: 'P': bad obj vnum %d.", __FUNCTION__, filename, gReset->arg1 ); continue; } iNest = gReset->extra; if ( !( pObjToIndex = get_obj_index( gReset->arg3 ) ) ) { bug( "%s: %s: 'P': bad objto vnum %d.", __FUNCTION__, filename, gReset->arg3 ); continue; } if ( iNest >= MAX_NEST ) { bug( "%s: %s: 'P': Exceeded nesting limit of %d", __FUNCTION__, filename, MAX_NEST ); obj = NULL; break; } if ( count_obj_list( pObjIndex, to_obj->first_content ) > 0 ) { obj = NULL; break; } if ( iNest < lastnest ) to_obj = nestmap[iNest]; else if ( iNest == lastnest ) to_obj = nestmap[lastnest]; else to_obj = lastobj; obj = create_object( pObjIndex, number_fuzzy( UMAX( generate_itemlevel( room->area, pObjIndex ), to_obj->level ) ) ); if ( num > 1 ) pObjIndex->count += ( num - 1 ); obj->count = gReset->arg2; obj->level = UMIN( obj->level, LEVEL_AVATAR ); obj->count = gReset->arg2; obj_to_obj( obj, to_obj ); if ( iNest > lastnest ) { nestmap[iNest] = to_obj; lastnest = iNest; } lastobj = obj; /* * Hackish fix for nested puts */ if ( gReset->arg3 == OBJ_VNUM_MONEY_ONE ) gReset->arg3 = to_obj->pIndexData->vnum; break; } } } break; } } } break; case 'O': if ( !( pObjIndex = get_obj_index( pReset->arg1 ) ) ) { bug( "%s: %s: 'O': bad obj vnum %d.", __FUNCTION__, filename, pReset->arg1 ); continue; } if ( !( pRoomIndex = get_room_index( pReset->arg3 ) ) ) { bug( "%s: %s: 'O': bad room vnum %d.", __FUNCTION__, filename, pReset->arg3 ); continue; } if ( count_obj_list( pObjIndex, pRoomIndex->first_content ) < 1 ) { obj = create_object( pObjIndex, number_fuzzy( generate_itemlevel( room->area, pObjIndex ) ) ); if ( num > 1 ) pObjIndex->count += ( num - 1 ); obj->count = pReset->arg2; obj->level = UMIN( obj->level, LEVEL_AVATAR ); obj->cost = 0; obj_to_room( obj, pRoomIndex ); } else { int x; if ( !( obj = get_obj_room( pObjIndex, pRoomIndex ) ) ) { obj = NULL; lastobj = NULL; break; } obj->extra_flags = pObjIndex->extra_flags; for ( x = 0; x < 6; ++x ) obj->value[x] = pObjIndex->value[x]; } for ( n = 0; n < MAX_NEST; n++ ) nestmap[n] = NULL; nestmap[0] = obj; lastobj = nestmap[0]; lastnest = 0; if ( pReset->first_reset ) { for ( tReset = pReset->first_reset; tReset; tReset = tReset->next_reset ) { int iNest; to_obj = lastobj; ++onreset; switch ( tReset->command ) { case 'H': if ( !lastobj ) break; xSET_BIT( lastobj->extra_flags, ITEM_HIDDEN ); break; case 'T': if ( !IS_SET( tReset->extra, TRAP_OBJ ) ) { bug( "%s: Room reset found on object reset list", __FUNCTION__ ); break; } else { /* * We need to preserve obj for future 'T' checks */ OBJ_DATA *pobj; if ( tReset->arg3 > 0 ) { if ( !( pObjToIndex = get_obj_index( tReset->arg3 ) ) ) { bug( "%s: %s: 'T': bad objto vnum %d.", __FUNCTION__, filename, tReset->arg3 ); continue; } if ( room->area->nplayer > 0 || !( to_obj = get_obj_type( pObjToIndex ) ) || ( to_obj->carried_by && !IS_NPC( to_obj->carried_by ) ) || is_trapped( to_obj ) ) break; } else { if ( !lastobj || !obj ) break; to_obj = obj; } pobj = make_trap( tReset->arg2, tReset->arg1, number_fuzzy( to_obj->level ), tReset->extra ); obj_to_obj( pobj, to_obj ); } break; case 'P': if ( !( pObjIndex = get_obj_index( tReset->arg1 ) ) ) { bug( "%s: %s: 'P': bad obj vnum %d.", __FUNCTION__, filename, tReset->arg1 ); continue; } iNest = tReset->extra; if ( !( pObjToIndex = get_obj_index( tReset->arg3 ) ) ) { bug( "%s: %s: 'P': bad objto vnum %d.", __FUNCTION__, filename, tReset->arg3 ); continue; } if ( iNest >= MAX_NEST ) { bug( "%s: %s: 'P': Exceeded nesting limit of %d. Room %d.", __FUNCTION__, filename, MAX_NEST, room->vnum ); obj = NULL; break; } if ( count_obj_list( pObjIndex, to_obj->first_content ) > 0 ) { obj = NULL; break; } if ( iNest < lastnest ) to_obj = nestmap[iNest]; else if ( iNest == lastnest ) to_obj = nestmap[lastnest]; else to_obj = lastobj; obj = create_object( pObjIndex, number_fuzzy( UMAX( generate_itemlevel( room->area, pObjIndex ), to_obj->level ) ) ); if ( num > 1 ) pObjIndex->count += ( num - 1 ); obj->count = tReset->arg2; obj->level = UMIN( obj->level, LEVEL_AVATAR ); obj->count = tReset->arg2; obj_to_obj( obj, to_obj ); if ( iNest > lastnest ) { nestmap[iNest] = to_obj; lastnest = iNest; } lastobj = obj; /* * Hackish fix for nested puts */ if ( tReset->arg3 == OBJ_VNUM_MONEY_ONE ) tReset->arg3 = to_obj->pIndexData->vnum; break; } } } break; case 'T': if ( IS_SET( pReset->extra, TRAP_OBJ ) ) { bug( "%s: Object trap found in room %d reset list", __FUNCTION__, room->vnum ); break; } else { if ( !( pRoomIndex = get_room_index( pReset->arg3 ) ) ) { bug( "%s: %s: 'T': bad room %d.", __FUNCTION__, filename, pReset->arg3 ); continue; } if ( room->area->nplayer > 0 || count_obj_list( get_obj_index( OBJ_VNUM_TRAP ), pRoomIndex->first_content ) > 0 ) break; to_obj = make_trap( pReset->arg1, pReset->arg1, 10, pReset->extra ); obj_to_room( to_obj, pRoomIndex ); } break; case 'D': if ( !( pRoomIndex = get_room_index( pReset->arg1 ) ) ) { bug( "%s: %s: 'D': bad room vnum %d.", __FUNCTION__, filename, pReset->arg1 ); continue; } if ( !( pexit = get_exit( pRoomIndex, pReset->arg2 ) ) ) break; switch ( pReset->arg3 ) { case 0: REMOVE_BIT( pexit->exit_info, EX_CLOSED ); REMOVE_BIT( pexit->exit_info, EX_LOCKED ); break; case 1: SET_BIT( pexit->exit_info, EX_CLOSED ); REMOVE_BIT( pexit->exit_info, EX_LOCKED ); if ( IS_SET( pexit->exit_info, EX_xSEARCHABLE ) ) SET_BIT( pexit->exit_info, EX_SECRET ); break; case 2: SET_BIT( pexit->exit_info, EX_CLOSED ); SET_BIT( pexit->exit_info, EX_LOCKED ); if ( IS_SET( pexit->exit_info, EX_xSEARCHABLE ) ) SET_BIT( pexit->exit_info, EX_SECRET ); break; } break; case 'R': if ( !( pRoomIndex = get_room_index( pReset->arg1 ) ) ) { bug( "%s: %s: 'R': bad room vnum %d.", __FUNCTION__, filename, pReset->arg1 ); continue; } randomize_exits( pRoomIndex, pReset->arg2 - 1 ); break; } } }
/* * Reset one area. */ void reset_area( AREA_DATA *pArea ) { RESET_DATA *pReset; CHAR_DATA *mob; bool last; int level; mob = NULL; last = TRUE; level = 0; for ( pReset = pArea->reset_first; pReset != NULL; pReset = pReset->next ) { ROOM_INDEX_DATA *pRoomIndex; MOB_INDEX_DATA *pMobIndex; OBJ_INDEX_DATA *pObjIndex; OBJ_INDEX_DATA *pObjToIndex; EXIT_DATA *pexit; OBJ_DATA *obj; OBJ_DATA *obj_to; switch ( pReset->command ) { default: bug( "Reset_area: bad command %c.", pReset->command ); break; case 'M': if ( ( pMobIndex = get_mob_index( pReset->arg1 ) ) == NULL ) { bug( "Reset_area: 'M': bad vnum %d.", pReset->arg1 ); continue; } if ( ( pRoomIndex = get_room_index( pReset->arg3 ) ) == NULL ) { bug( "Reset_area: 'R': bad vnum %d.", pReset->arg3 ); continue; } level = URANGE( 0, pMobIndex->level - 2, LEVEL_HERO ); if ( pMobIndex->count >= pReset->arg2 ) { last = FALSE; break; } mob = create_mobile( pMobIndex ); /* * Check for pet shop. */ { ROOM_INDEX_DATA *pRoomIndexPrev; pRoomIndexPrev = get_room_index( pRoomIndex->vnum - 1 ); if ( pRoomIndexPrev != NULL && IS_SET(pRoomIndexPrev->room_flags, ROOM_PET_SHOP) ) SET_BIT(mob->act, ACT_PET); } if ( room_is_dark( pRoomIndex ) ) SET_BIT(mob->affected_by, AFF_INFRARED); char_to_room( mob, pRoomIndex ); level = URANGE( 0, mob->level - 2, LEVEL_HERO ); last = TRUE; break; case 'O': if ( ( pObjIndex = get_obj_index( pReset->arg1 ) ) == NULL ) { bug( "Reset_area: 'O': bad vnum %d.", pReset->arg1 ); continue; } if ( ( pRoomIndex = get_room_index( pReset->arg3 ) ) == NULL ) { bug( "Reset_area: 'R': bad vnum %d.", pReset->arg3 ); continue; } if ( pArea->nplayer > 0 || count_obj_list( pObjIndex, pRoomIndex->contents ) > 0 ) { last = FALSE; break; } obj = create_object( pObjIndex, number_fuzzy( level ) ); obj->cost = 0; obj_to_room( obj, pRoomIndex ); last = TRUE; break; case 'P': if ( ( pObjIndex = get_obj_index( pReset->arg1 ) ) == NULL ) { bug( "Reset_area: 'P': bad vnum %d.", pReset->arg1 ); continue; } if ( ( pObjToIndex = get_obj_index( pReset->arg3 ) ) == NULL ) { bug( "Reset_area: 'P': bad vnum %d.", pReset->arg3 ); continue; } if ( pArea->nplayer > 0 || ( obj_to = get_obj_type( pObjToIndex ) ) == NULL || obj_to->in_room == NULL || count_obj_list( pObjIndex, obj_to->contains ) > 0 ) { last = FALSE; break; } obj = create_object( pObjIndex, number_fuzzy( obj_to->level ) ); obj_to_obj( obj, obj_to ); last = TRUE; break; case 'G': case 'E': if ( ( pObjIndex = get_obj_index( pReset->arg1 ) ) == NULL ) { bug( "Reset_area: 'E' or 'G': bad vnum %d.", pReset->arg1 ); continue; } if ( !last ) break; if ( mob == NULL ) { bug( "Reset_area: 'E' or 'G': null mob for vnum %d.", pReset->arg1 ); last = FALSE; break; } if ( mob->pIndexData->pShop != NULL ) { int olevel; switch ( pObjIndex->item_type ) { default: olevel = 0; break; case ITEM_PILL: olevel = number_range( 0, 10 ); break; case ITEM_POTION: olevel = number_range( 0, 10 ); break; case ITEM_SCROLL: olevel = number_range( 5, 15 ); break; case ITEM_WAND: olevel = number_range( 10, 20 ); break; case ITEM_STAFF: olevel = number_range( 15, 25 ); break; case ITEM_ARMOR: olevel = number_range( 5, 15 ); break; case ITEM_WEAPON: olevel = number_range( 5, 15 ); break; } obj = create_object( pObjIndex, olevel ); SET_BIT( obj->extra_flags, ITEM_INVENTORY ); } else { obj = create_object( pObjIndex, number_fuzzy( level ) ); } obj_to_char( obj, mob ); if ( pReset->command == 'E' ) equip_char( mob, obj, pReset->arg3 ); last = TRUE; break; case 'D': if ( ( pRoomIndex = get_room_index( pReset->arg1 ) ) == NULL ) { bug( "Reset_area: 'D': bad vnum %d.", pReset->arg1 ); continue; } if ( ( pexit = pRoomIndex->exit[pReset->arg2] ) == NULL ) break; switch ( pReset->arg3 ) { case 0: REMOVE_BIT( pexit->exit_info, EX_CLOSED ); REMOVE_BIT( pexit->exit_info, EX_LOCKED ); break; case 1: SET_BIT( pexit->exit_info, EX_CLOSED ); REMOVE_BIT( pexit->exit_info, EX_LOCKED ); break; case 2: SET_BIT( pexit->exit_info, EX_CLOSED ); SET_BIT( pexit->exit_info, EX_LOCKED ); break; } last = TRUE; break; case 'R': if ( ( pRoomIndex = get_room_index( pReset->arg1 ) ) == NULL ) { bug( "Reset_area: 'R': bad vnum %d.", pReset->arg1 ); continue; } { int d0; int d1; for ( d0 = 0; d0 < pReset->arg2 - 1; d0++ ) { d1 = number_range( d0, pReset->arg2-1 ); pexit = pRoomIndex->exit[d0]; pRoomIndex->exit[d0] = pRoomIndex->exit[d1]; pRoomIndex->exit[d1] = pexit; } } break; } } return; }
void create_guest_avatar (DESCRIPTOR_DATA * d, char *argument) { CHAR_DATA *ch = NULL; char buf[MAX_STRING_LENGTH]; char buf2[MAX_STRING_LENGTH]; char account_name[MAX_STRING_LENGTH]; char tname_buf[MAX_STRING_LENGTH]; int roll, i = 1; extern int finished_booting; extern int guest_conns; if (!d) return; *buf = '\0'; *buf2 = '\0'; *account_name = '\0'; *tname_buf = '\0'; if (d->character) extract_char (d->character); sprintf (tname_buf, "%s-Guest", d->acct->name.c_str ()); d->character = new_char (1); //clear_char (d->character); d->character->deleted = 0; d->original = NULL; ch = d->character; ch->color = d->acct->color; d->character->pc->create_state = STATE_APPROVED; d->prompt_mode = 1; d->character->desc = d; d->character->pc->owner = d; d->character->pc->load_count = 1; roll = number (1, 11); if (roll == 1) ch->race = 0; else if (roll == 2) ch->race = 21; else if (roll == 3) ch->race = 16; else if (roll == 4) ch->race = 23; else if (roll == 5) ch->race = 120; else if (roll == 6) ch->race = 119; else if (roll == 7) ch->race = 89; else if (roll == 8) ch->race = 3; else if (roll == 9) ch->race = 28; else if (roll == 10) ch->race = 69; else if (roll == 11) ch->race = 64; else ch->race = 0; d->character->race = ch->race; d->character->flags |= FLAG_GUEST; /* Bestow the random traits to the new guest avatar */ randomize_mobile (ch); ch->pc->account_name = duplicateString (d->acct->name.c_str ()); if (is_guide (d->acct->name.c_str ())) ch->pc->is_guide = true; ch->fight_mode = 2; ch->clans = duplicateString (""); /* Address naming issues with our user's new account handle */ ch->tname = duplicateString (tname_buf); if (ch->pc->is_guide) sprintf (buf2, "%s Guide %s", ch->name, ch->tname); else sprintf (buf2, "%s %s", ch->name, ch->tname); if (ch->name) free_mem (ch->name); ch->name = duplicateString (buf2); ch->hit = 100; ch->max_hit = 100; ch->move = 100; ch->max_move = 100; if (d->character->race >= 0 && d->character->race <= 120) { for (i = 0; i <= MAX_SKILLS; i++) { d->character->skills[i] = 0; d->character->pc->skills[i] = 0; } //Get the native tongue of each race and cap it - Vader int native_tongue = get_native_tongue(ch); if (native_tongue) { ch->skills[native_tongue] = calc_lookup (ch, REG_CAP, native_tongue); ch->pc->skills[native_tongue] = calc_lookup (ch, REG_CAP, native_tongue); } ch->speaks = native_tongue; } guest_conns++; if (ch->description) free_mem (ch->description); if (ch->pc->is_guide) ch->description = duplicateString ("One of our friendly player #BGuides#0 is here, awaiting questions.\n"); else ch->description = duplicateString ("Another Guest is here, passing through. Be sure to welcome them!\n"); ch->plr_flags |= NEWBIE_HINTS; if (is_admin (ch->pc->account_name)) { ch->flags |= FLAG_ISADMIN; ch->flags |= FLAG_WIZNET; } else ch->flags &= ~FLAG_ISADMIN; if (ch->race != 89 && ch->race != 69 && ch->race != 64) equip_newbie (ch); else if (ch->race == 64) equip_char (ch, load_object (5261), WEAR_BODY); ch->hunger = -1; ch->thirst = -1; // If we're recreating, we're either recovering from a reboot or returning a dead // guest to the lounge, in which case we can skip a lot of this. pc_to_game (ch); char_to_room (ch, OOC_LOUNGE); if (str_cmp (argument, "recreate")) { act ("$n is incarnated in a soft glimmer of light.", true, d->character, 0, 0, TO_ROOM | _ACT_FORMAT); sprintf (buf, "%s [%s] has entered the lounge.", ch->tname, ch->desc->strClientHostname); send_to_gods (buf); d->connected = CON_PLYNG; guest_conns++; sprintf (buf, "%s has logged in from %s as %s.", char_short (d->character), d->strClientHostname, d->character->tname); *buf = toupper (*buf); system_log (buf, false); mysql_safe_query ("UPDATE newsletter_stats SET guest_logins=guest_logins+1"); do_look (ch, "", 0); } else { if (finished_booting) // Dead Guest being returned to the lounge. act ("$n appears in a sudden glimmer of light, looking slightly dazed.", true, ch, 0, 0, TO_ROOM | _ACT_FORMAT); act ("You feel your form briefly waver before it solidifies into yet another new guise, returned safely to the pleasant confines of Club Endore.", false, ch, 0, 0, TO_CHAR | _ACT_FORMAT); } }
void mobile_activity(void) { register struct char_data *ch, *next_ch, *vict; struct char_data *min_vict = NULL; struct obj_data *obj, *next_obj, *best_obj, *cont; int door, found, max, where; int casual, max_abil=0, curr_abil, gold; memory_rec *names; room_rnum target_room; extern int no_specials; ACMD(do_get); for (ch = character_list; ch; ch = next_ch) { next_ch = ch->next; if (!IS_MOB(ch)) continue; //lance ripristina il master! if (IS_NPC(ch) && MOB_FLAGGED(ch, MOB_SAVE)) chkmaster(ch); // Examine call for special procedure if (MOB_FLAGGED(ch, MOB_SPEC) && !no_specials) { if (mob_index[GET_MOB_RNUM(ch)].func == NULL) { sprintf(buf, "SYSERR: %s (#%d): Attempting to call non-existing mob func", GET_NAME(ch), GET_MOB_VNUM(ch)); log(buf); REMOVE_BIT(MOB_FLAGS(ch), MOB_SPEC); } else { //(mob_index[GET_MOB_RNUM(ch)].func) (ch, ch, 0, ""); if ((mob_index[GET_MOB_RNUM(ch)].func) (ch, ch, 0, "")) continue; /* go to next char*/ } } // If the mob has no specproc, do the default actions if (FIGHTING(ch) || !AWAKE(ch)) continue; // Nuovo Scavenger (picking up objects) by Rusty if (MOB_FLAGGED(ch, MOB_SCAVENGER)) if (world[ch->in_room].contents && (number(0, 10) > 5)) { max = -1000; best_obj = NULL; for (obj = world[ch->in_room].contents; obj; obj = obj->next_content) if (CAN_GET_OBJ(ch, obj) && objlevel(obj) > max) { best_obj = obj; max = objlevel(obj); } if (best_obj != NULL) { obj_from_room(best_obj); obj_to_char(best_obj, ch); act("$n prende $p.", FALSE, ch, best_obj, 0, TO_ROOM); // Orione, tolta la procedura che fa indossare l'eq raccolto ai mob scavenger // Scavenger Plus:Mob wear the best object /* where=find_eq_pos(ch, best_obj, 0); if (CAN_WEAR(best_obj, ITEM_WEAR_WIELD)) where=WEAR_WIELD; if ( (where>0) && GET_EQ(ch,where)) { // se ce l'ha gia! if ((objlevel((ch)->equipment[where]))< objlevel(best_obj)) { obj_to_char((obj=unequip_char(ch, where)), ch); act("$n smette di usare $p.", FALSE, ch, obj, 0, TO_ROOM); } else { where = NUM_WEARS; // cioe' oggetto non indossabile } if (GET_LEVEL(ch)>=objlevel(best_obj)) { if (where>=0 && where <NUM_WEARS) { obj_from_char(best_obj); equip_char(ch,best_obj,where); wear_message(ch,best_obj,where); } } } */ } } //End ifif // Mob BodyGuard !? if (MOB_FLAGGED(ch, MOB_BGUARD) && (ch->master)) { if ( (FIGHTING(ch->master) && (npc_rescue(ch, ch->master) == FALSE)) || (ch->master && WHOKILLED(ch->master)) ) { act("$N Si schiera Prontamente al tuo fianco!", FALSE,ch->master, 0, ch, TO_CHAR); act("$n Si schiera prontamente al fianco di $N", FALSE, ch, 0, ch->master, TO_ROOM); if (WHOKILLED(ch->master)) hit(ch, WHOKILLED(ch->master), TYPE_UNDEFINED);/*in ogni caso assiste*/ else hit(ch, FIGHTING(ch->master), TYPE_UNDEFINED);/*in ogni caso assiste*/ } if (FIGHTING(ch)) { npc_rescue(ch, ch->master); if (WHOKILLED(ch->master)) hit(ch, WHOKILLED(ch->master), TYPE_UNDEFINED); /*in ogni caso assiste*/ continue; } } //MOB_THIEF if ( MOB_FLAGGED(ch, MOB_CRIMINAL) && (GET_POS(ch) == POS_RESTING) && IS_AFFECTED(ch, AFF_HIDE) && GET_HIT(ch) >= 2*GET_MAX_HIT(ch)/3) { appear(ch); GET_POS(ch)=POS_STANDING; } if ( MOB_FLAGGED(ch, MOB_CRIMINAL) && ( GET_POS(ch) == POS_STANDING) && ( (casual = number(0, 11)) < 6 ) ) { // 50% Rubare // cerca le vittime 1) Devono aver almeno 1 coin // 2) Deve aver una buona prob di farcela for (found=FALSE, min_vict = NULL, vict = world[ch->in_room].people; vict; vict = vict->next_in_room) { if (CAN_SEE(ch, vict) && (vict != ch)) { if ((min_vict == NULL) || (max_abil < 100)) { //se ha il 100% tanto vale fermarsi //Calcolo dell abilita:presa esattamente da D n'D curr_abil = MIN(90, (10*(GET_LEVEL(ch)) - 5*GET_LEVEL(vict))); curr_abil -= dex_app[GET_DEX(vict)].reaction; if (GET_POS(vict) < POS_STANDING) curr_abil += 200; // Se la vittima e' addormentata-stunned - incap o morta ovviamente // deruberai questa sicuramente if ( (curr_abil >= 40) && (GET_GOLD(vict) != 0) && (curr_abil > max_abil) ) { min_vict = vict; max_abil = curr_abil; found=TRUE; } } } } // Se ha trovato la vittima if (found == TRUE) { if ((casual = number(1, 100)) > max_abil) { if (!IS_NPC(min_vict)) act(" $n cerca di prendere dei soldi dal tuo Borsello", FALSE, ch, 0, min_vict, TO_CHAR); else { act("Oops...", FALSE, ch, 0, min_vict, TO_ROOM); act("$n cerca di rubare soldi a $N..Ma viene Scoperto! ", FALSE, ch, 0, min_vict, TO_ROOM); } //Beccato ... fa 2 tentativi di fuga if (((door = number(1, 7)) < NUM_OF_DIRS) && CAN_GO(ch, door) && !ROOM_FLAGGED(EXIT(ch, door)->to_room, ROOM_NOMOB | ROOM_DEATH) ) perform_move(ch,door,1,CAN_SHOW_ROOM); if ((door -= 1) < NUM_OF_DIRS && CAN_GO(ch, door) && !ROOM_FLAGGED(EXIT(ch, door)->to_room, ROOM_NOMOB | ROOM_DEATH) ) perform_move(ch,door,1,CAN_SHOW_ROOM); if ((door += 2) < NUM_OF_DIRS && CAN_GO(ch, door) && !ROOM_FLAGGED(EXIT(ch, door)->to_room, ROOM_NOMOB | ROOM_DEATH) ) perform_move(ch,door,1,CAN_SHOW_ROOM); if (IS_NPC(min_vict)) { act("$n Urla: $N e' uno sporco LADRO!!!!", FALSE, min_vict, 0, ch, TO_ROOM); hit(min_vict, ch, TYPE_UNDEFINED); } } // Il Bastardo ce la fa! else { if (GET_POS(min_vict) < 5) { GET_GOLD(ch) += GET_GOLD(min_vict); GET_GOLD(min_vict) = 0; //la ripulisce completamente } else { gold = number((GET_GOLD(min_vict) / 10), (GET_GOLD(min_vict) / 2)); //gold = MIN(5000, gold); if (gold > 0) { GET_GOLD(ch) += gold; GET_GOLD(min_vict) -= gold; if (GET_GOLD(min_vict) < 0) GET_GOLD(min_vict) = 0; } } // Dopo il furto si allontana if (((door = number(1, 6)) < NUM_OF_DIRS) && CAN_GO(ch, door) && !ROOM_FLAGGED(EXIT(ch, door)->to_room, ROOM_NOMOB | ROOM_DEATH) ) perform_move(ch,door,1,CAN_SHOW_ROOM); if ((door -=1) < NUM_OF_DIRS && CAN_GO(ch, door) && !ROOM_FLAGGED(EXIT(ch, door)->to_room, ROOM_NOMOB | ROOM_DEATH) ) perform_move(ch,door,1,CAN_SHOW_ROOM); if ((door +=2) < NUM_OF_DIRS && CAN_GO(ch, door) && !ROOM_FLAGGED(EXIT(ch, door)->to_room, ROOM_NOMOB | ROOM_DEATH) ) perform_move(ch,door,1,CAN_SHOW_ROOM); } } else { // Nessuna vittima appetibile:se ne va! if (((door = number(0, 6)) < NUM_OF_DIRS) && CAN_GO(ch, door) && !ROOM_FLAGGED(EXIT(ch, door)->to_room, ROOM_NOMOB | ROOM_DEATH) ) perform_move(ch, door, 1, CAN_SHOW_ROOM); } } // Mob Sciacalli indossano EQ if (MOB_FLAGGED(ch, MOB_NECRO) && !FIGHTING(ch) && AWAKE(ch)) if (world[ch->in_room].contents) { max = -1000; best_obj=NULL; for (cont = world[ch->in_room].contents;cont;cont = cont->next_content) if (GET_OBJ_TYPE(cont) == ITEM_CONTAINER) { for (obj = cont->contains; obj; obj = next_obj) { next_obj = obj->next_content; if (obj != NULL) { if (CAN_SEE_OBJ(ch, obj) && ( (max = objlevel(obj)) <= GET_LEVEL(ch)) ) { perform_get_from_container(ch, obj, cont, FIND_OBJ_INV); if (obj != NULL) { where = find_eq_pos(ch, obj, 0); if (CAN_WEAR(obj, ITEM_WEAR_HOLD)) where = WEAR_HOLD; if (GET_OBJ_TYPE(obj)==ITEM_LIGHT) where = WEAR_LIGHT; if (CAN_WEAR(obj, ITEM_WEAR_WIELD)) where = WEAR_WIELD; if (where < 0) { sprintf(buf,"SYSERR:pos < 0 ,in cont %s obj %d %s In room %d", cont->name, GET_OBJ_RNUM(obj), obj->name, IN_ROOM(ch)); log(buf); where = NUM_WEARS; } if (GET_EQ(ch, where) && where < NUM_WEARS) { if ((objlevel((ch)->equipment[where])) < objlevel(obj)) { obj_to_char((best_obj = unequip_char(ch, where)), ch); act("$n smette di usare $p.",FALSE, ch, best_obj, 0, TO_ROOM); } else where = NUM_WEARS; } if (where >= 0 && where < NUM_WEARS) { wear_message(ch, obj, where); obj_from_char(obj); equip_char(ch, obj, where); } } } } } } //End forif } //End ifif // Mob Movement if (HUNTING(ch)) hunt_victim(ch); else { if (MOB_FLAGGED(ch , MOB_SEARCHER)) {} else { if (ch->in_room != NOWHERE) { if (!IS_IN_WILD(ch)) { if ( !MOB_FLAGGED(ch, MOB_SENTINEL) && (GET_POS(ch) == POS_STANDING) && ( (door = number(0, 8)) < NUM_OF_DIRS) && CAN_GO(ch, door) && !ROOM_FLAGGED(EXIT(ch, door)->to_room, ROOM_NOMOB | ROOM_DEATH) && ( !MOB_FLAGGED(ch, MOB_STAY_ZONE) || (world[EXIT(ch, door)->to_room].zone == world[ch->in_room].zone))) { perform_move(ch, door, 1, CAN_SHOW_ROOM); } } else { // E' in wilderness if (MOB_FLAGGED(ch, MOB_WILDHUNT)) door = wild_mobhunter(ch); else door = number(0, 8); if (door >= 0 && door < NUM_OF_DIRS) target_room = wild_target_room(ch, door); else target_room = -1; if ( !MOB_FLAGGED(ch, MOB_SENTINEL) && (GET_POS(ch) == POS_STANDING) && (target_room != -1) && ( !MOB_FLAGGED(ch, MOB_STAY_ZONE) || (world[target_room].wild_rnum == world[ch->in_room].wild_rnum))) { perform_move(ch, door, 1, CAN_SHOW_ROOM); } } } } } // Aggressive Mobs if (MOB_FLAGGED(ch, MOB_AGGRESSIVE | MOB_AGGR_TO_ALIGN)) { found = FALSE; for (vict = world[ch->in_room].people; vict && !found; vict = vict->next_in_room) { if (IS_NPC(vict) || !CAN_SEE(ch, vict) || PRF_FLAGGED(vict, PRF_NOHASSLE)) continue; if (number(0, 3) < 2) continue; // Simple simulate Random a Joke from Phantom ;P if (GET_ABIL (vict, ABIL_TRATTATIVA) >= EXPERT_LIV) continue; // I pg con trattativa ad esperto fanno pace con gli aggressivi (by Spini) if (controllo_volo(ch, vict)) continue; if (affected_by_spell (vict, SPELLSKILL, DISEASE_PESTE)) continue; if (MOB_FLAGGED(ch, MOB_AGGR_NO_PROP) && (MASTER_ID(ch)==GET_IDNUM(vict))) continue; if (MOB_FLAGGED(ch, MOB_AGGR_NO_CLAN) && (CLAN_ID(ch)==GET_CLAN(vict))) continue; if (MOB_FLAGGED(ch, MOB_AGGR_NO_AL_CLAN) && (GET_CLAN_DIPLO(GET_CLAN(ch),GET_CLAN(vict)) == ALLIANCE)) continue; if (MOB_FLAGGED(ch, MOB_AGGR_NO_EN_CLAN) && (GET_CLAN_DIPLO(GET_CLAN(ch),GET_CLAN(vict)) == WAR)) continue; if (MOB_FLAGGED(ch, MOB_AGGR_NO_PC_CLAN) && (GET_CLAN_DIPLO(GET_CLAN(ch),GET_CLAN(vict)) == PEACE)) continue; if (MOB_FLAGGED(ch, MOB_AGGR_VAS_CLAN) && (GET_CLAN_DIPLO(GET_CLAN(ch),GET_CLAN(vict)) == VASSALLO)) continue; if ( !MOB_FLAGGED(ch, MOB_AGGR_TO_ALIGN) || (MOB_FLAGGED(ch, MOB_AGGR_EVIL) && IS_EVIL(vict)) || (MOB_FLAGGED(ch, MOB_AGGR_NEUTRAL) && IS_NEUTRAL(vict)) || (MOB_FLAGGED(ch, MOB_AGGR_GOOD) && IS_GOOD(vict)) ) { if (GET_MOB_SPEC(ch)== thief) npc_backstab(ch,vict); else hit(ch, vict, TYPE_UNDEFINED); found = TRUE; } } } // Mob Memory if (MOB_FLAGGED(ch, MOB_MEMORY) && MEMORY(ch)) { found = FALSE; for (vict = world[ch->in_room].people; vict && !found; vict = vict->next_in_room) { if (!CAN_SEE(ch, vict) || PRF_FLAGGED(vict, PRF_NOHASSLE)) continue; for (names = MEMORY(ch); names && !found; names = names->next) if (names->id == GET_IDNUM(vict)) { found = TRUE; act("$n esclama, 'Hey!! Tu sei il tipo che mi ha attaccato!!!'", FALSE, ch, 0, 0, TO_ROOM); hit(ch, vict, TYPE_UNDEFINED); } //End forif } } // Helper Mobs Paladino del bene if ( MOB_FLAGGED(ch, MOB_HELPER) && !MOB_FLAGGED(ch, MOB_CRIMINALHELPER) ) { found = FALSE; for (vict = world[ch->in_room].people; vict && !found; vict = vict->next_in_room) if ( ch != vict && IS_NPC(vict) && FIGHTING(vict) && !IS_NPC(FIGHTING(vict)) && ch != FIGHTING(vict) ) { if ( MOB_FLAGGED(vict, MOB_CRIMINAL) || ( (ch->master) && (FIGHTING(vict) == ch->master) ) ) { hit(ch, vict, TYPE_UNDEFINED); found = TRUE; } else { act("$n arriva in aiuto di $N!", FALSE, ch, 0, vict, TO_ROOM); hit(ch, FIGHTING(vict), TYPE_UNDEFINED); found = TRUE; } } //End forif } // Helper Mobs Servo del male if ( MOB_FLAGGED(ch, MOB_CRIMINALHELPER) && !MOB_FLAGGED(ch, MOB_HELPER) ) { found = FALSE; for (vict = world[ch->in_room].people; vict && !found; vict = vict->next_in_room) if ( ch != vict && IS_NPC(vict) && FIGHTING(vict) && !IS_NPC(FIGHTING(vict)) && ch != FIGHTING(vict) ) { if ( MOB_FLAGGED(vict, MOB_CRIMINAL) || ( (ch->master) && (vict == ch->master) ) ) { act("$n arriva in aiuto di $N!", FALSE, ch, 0, vict, TO_ROOM); hit(ch, FIGHTING(vict), TYPE_UNDEFINED); found = TRUE; } } //End forif } // Add new mobile actions here } // end for() }
void auto_equip(struct char_data *ch, struct obj_data *obj, int location) { int j; /* Lots of checks... */ if (location > 0) { /* Was wearing it. */ switch (j = (location - 1)) { case WEAR_LIGHT: break; case WEAR_FINGER_R: case WEAR_FINGER_L: if (!CAN_WEAR(obj, ITEM_WEAR_FINGER)) /* not fitting :( */ location = LOC_INVENTORY; break; case WEAR_NECK_1: case WEAR_NECK_2: if (!CAN_WEAR(obj, ITEM_WEAR_NECK)) location = LOC_INVENTORY; break; case WEAR_BODY: if (!CAN_WEAR(obj, ITEM_WEAR_BODY)) location = LOC_INVENTORY; break; case WEAR_HEAD: if (!CAN_WEAR(obj, ITEM_WEAR_HEAD)) location = LOC_INVENTORY; break; case WEAR_LEGS: if (!CAN_WEAR(obj, ITEM_WEAR_LEGS)) location = LOC_INVENTORY; break; case WEAR_FEET: if (!CAN_WEAR(obj, ITEM_WEAR_FEET)) location = LOC_INVENTORY; break; case WEAR_HANDS: if (!CAN_WEAR(obj, ITEM_WEAR_HANDS)) location = LOC_INVENTORY; break; case WEAR_ARMS: if (!CAN_WEAR(obj, ITEM_WEAR_ARMS)) location = LOC_INVENTORY; break; case WEAR_SHIELD: if (!CAN_WEAR(obj, ITEM_WEAR_SHIELD)) location = LOC_INVENTORY; break; case WEAR_ABOUT: if (!CAN_WEAR(obj, ITEM_WEAR_ABOUT)) location = LOC_INVENTORY; break; case WEAR_WAIST: if (!CAN_WEAR(obj, ITEM_WEAR_WAIST)) location = LOC_INVENTORY; break; case WEAR_WRIST_R: case WEAR_WRIST_L: if (!CAN_WEAR(obj, ITEM_WEAR_WRIST)) location = LOC_INVENTORY; break; case WEAR_WIELD: if (!CAN_WEAR(obj, ITEM_WEAR_WIELD)) location = LOC_INVENTORY; break; case WEAR_HOLD: if (CAN_WEAR(obj, ITEM_WEAR_HOLD)) break; if (IS_WARRIOR(ch) && CAN_WEAR(obj, ITEM_WEAR_WIELD) && GET_OBJ_TYPE(obj) == ITEM_WEAPON) break; location = LOC_INVENTORY; break; default: location = LOC_INVENTORY; } if (location > 0) { /* Wearable. */ if (!GET_EQ(ch,j)) { /* * Check the characters's alignment to prevent them from being * zapped through the auto-equipping. */ if (invalid_align(ch, obj) || invalid_class(ch, obj)) location = LOC_INVENTORY; else equip_char(ch, obj, j); } else { /* Oops, saved a player with double equipment? */ mudlog(BRF, LVL_IMMORT, TRUE, "SYSERR: autoeq: '%s' already equipped in position %d.", GET_NAME(ch), location); location = LOC_INVENTORY; } } } if (location <= 0) /* Inventory */ obj_to_char(obj, ch); }
int handle_obj(struct obj_data *temp, struct char_data *ch, int locate, struct obj_data **cont_row) { int j; struct obj_data *obj1; if (!temp) /* this should never happen, but.... */ return (0); auto_equip(ch, temp, locate); /* what to do with a new loaded item: if there's a list with <locate> less than 1 below this: (equipped items are assumed to have <locate>==0 here) then its container has disappeared from the file *gasp* -> put all the list back to ch's inventory if there's a list of contents with <locate> 1 below this: check if it's a container - if so: get it from ch, fill it, and give it back to ch (this way the container has its correct weight before modifying ch) - if not: the container is missing -> put all the list to ch's inventory for items with negative <locate>: if there's already a list of contents with the same <locate> put obj to it if not, start a new list Confused? Well maybe you can think of some better text to be put here ... since <locate> for contents is < 0 the list indices are switched to non-negative */ if (locate > 0) { /* item equipped */ for (j = MAX_BAG_ROWS-1;j > 0;j--) if (cont_row[j]) { /* no container -> back to ch's inventory */ for (;cont_row[j];cont_row[j] = obj1) { obj1 = cont_row[j]->next_content; obj_to_char(cont_row[j], ch); } cont_row[j] = NULL; } if (cont_row[0]) { /* content list existing */ if (GET_OBJ_TYPE(temp) == ITEM_CONTAINER) { /* rem item ; fill ; equip again */ temp = unequip_char(ch, locate-1); temp->contains = NULL; /* should be empty - but who knows */ for (;cont_row[0];cont_row[0] = obj1) { obj1 = cont_row[0]->next_content; obj_to_obj(cont_row[0], temp); } equip_char(ch, temp, locate-1); } else { /* object isn't container -> empty content list */ for (;cont_row[0];cont_row[0] = obj1) { obj1 = cont_row[0]->next_content; obj_to_char(cont_row[0], ch); } cont_row[0] = NULL; } } } else { /* locate <= 0 */ for (j = MAX_BAG_ROWS-1;j > -locate;j--) if (cont_row[j]) { /* no container -> back to ch's inventory */ for (;cont_row[j];cont_row[j] = obj1) { obj1 = cont_row[j]->next_content; obj_to_char(cont_row[j], ch); } cont_row[j] = NULL; } if (j == -locate && cont_row[j]) { /* content list existing */ if (GET_OBJ_TYPE(temp) == ITEM_CONTAINER) { /* take item ; fill ; give to char again */ obj_from_char(temp); temp->contains = NULL; for (;cont_row[j];cont_row[j] = obj1) { obj1 = cont_row[j]->next_content; obj_to_obj(cont_row[j], temp); } obj_to_char(temp, ch); /* add to inv first ... */ } else { /* object isn't container -> empty content list */ for (;cont_row[j];cont_row[j] = obj1) { obj1 = cont_row[j]->next_content; obj_to_char(cont_row[j], ch); } cont_row[j] = NULL; } } if (locate < 0 && locate >= -MAX_BAG_ROWS) { /* let obj be part of content list but put it at the list's end thus having the items in the same order as before renting */ obj_from_char(temp); if ((obj1 = cont_row[-locate-1])) { while (obj1->next_content) obj1 = obj1->next_content; obj1->next_content = temp; } else cont_row[-locate-1] = temp; } } /* locate less than zero */ return (1); }
void do_note( CHAR_DATA * ch, char *arg_passed, bool IS_MAIL ) { char buf[MAX_STRING_LENGTH]; char arg[MAX_INPUT_LENGTH]; NOTE_DATA *pnote = NULL; BOARD_DATA *board = NULL; int vnum = 0; int anum = 0; int first_list = 0; OBJ_DATA *paper = NULL, *tmpobj = NULL; EXTRA_DESCR_DATA *ed = NULL; char notebuf[MAX_STRING_LENGTH]; char short_desc_buf[MAX_STRING_LENGTH]; char long_desc_buf[MAX_STRING_LENGTH]; char keyword_buf[MAX_STRING_LENGTH]; bool mfound = FALSE; bool wasfound = FALSE; if( IS_NPC( ch ) ) return; if( !ch->desc ) { bug( "do_note: no descriptor", 0 ); return; } switch ( ch->substate ) { default: break; case SUB_WRITING_NOTE: if( ( paper = get_eq_char( ch, WEAR_HOLD ) ) == NULL || paper->item_type != ITEM_PAPER ) { bug( "do_note: player not holding paper", 0 ); stop_editing( ch ); return; } ed = ( EXTRA_DESCR_DATA * ) ch->dest_buf; STRFREE( ed->description ); ed->description = copy_buffer( ch ); stop_editing( ch ); return; } set_char_color( AT_NOTE, ch ); arg_passed = one_argument( arg_passed, arg ); smash_tilde( arg_passed ); if( !str_cmp( arg, "list" ) ) { board = find_board( ch ); if( !board ) { send_to_char( "There is no board here to look at.\r\n", ch ); return; } if( !can_read( ch, board ) ) { send_to_char ( "You cannot make any sense of the cryptic scrawl on this board...\r\n", ch ); return; } first_list = atoi( arg_passed ); if( first_list ) { if( IS_MAIL ) { send_to_char ( "You cannot use a list number (at this time) with mail.\r\n", ch ); return; } if( first_list < 1 ) { send_to_char( "You can't read a message before 1!\r\n", ch ); return; } } if( !IS_MAIL ) { vnum = 0; set_pager_color( AT_NOTE, ch ); for( pnote = board->first_note; pnote; pnote = pnote->next ) { vnum++; if( ( first_list && vnum >= first_list ) || !first_list ) pager_printf( ch, "%2d%c %-12s%c %-12s %s\r\n", vnum, is_note_to( ch, pnote ) ? ')' : '}', pnote->sender, ( pnote->voting != VOTE_NONE ) ? ( pnote->voting == VOTE_OPEN ? 'V' : 'C' ) : ':', pnote->to_list, pnote->subject ); } act( AT_ACTION, "$n glances over the messages.", ch, NULL, NULL, TO_ROOM ); return; } else { vnum = 0; if( IS_MAIL ) /* SB Mail check for Brit */ { for( pnote = board->first_note; pnote; pnote = pnote->next ) if( is_note_to( ch, pnote ) ) mfound = TRUE; if( !mfound && !IS_IMMORTAL( ch ) ) { ch_printf( ch, "You have no mail.\r\n" ); return; } } for( pnote = board->first_note; pnote; pnote = pnote->next ) if( is_note_to( ch, pnote ) || IS_IMMORTAL( ch ) ) ch_printf( ch, "%2d%c %s: %s\r\n", ++vnum, is_note_to( ch, pnote ) ? '-' : '}', pnote->sender, pnote->subject ); return; } } if( !str_cmp( arg, "read" ) ) { bool fAll = FALSE; board = find_board( ch ); if( !board ) { send_to_char( "There is no board here to look at.\r\n", ch ); return; } if( !can_read( ch, board ) ) { send_to_char ( "You cannot make any sense of the cryptic scrawl on this board...\r\n", ch ); return; } if( !str_cmp( arg_passed, "all" ) ) { fAll = TRUE; anum = 0; } else if( is_number( arg_passed ) ) { fAll = FALSE; anum = atoi( arg_passed ); } else { send_to_char( "Note read which number?\r\n", ch ); return; } set_pager_color( AT_NOTE, ch ); if( !IS_MAIL ) { vnum = 0; for( pnote = board->first_note; pnote; pnote = pnote->next ) { vnum++; if( vnum == anum || fAll ) { wasfound = TRUE; pager_printf( ch, "[%3d] %s: %s\r\n%s\r\nTo: %s\r\n%s", vnum, pnote->sender, pnote->subject, pnote->date, pnote->to_list, pnote->text ); if( pnote->yesvotes[0] != '\0' || pnote->novotes[0] != '\0' || pnote->abstentions[0] != '\0' ) { send_to_pager ( "------------------------------------------------------------\r\n", ch ); pager_printf( ch, "Votes:\r\nYes: %s\r\nNo: %s\r\nAbstain: %s\r\n", pnote->yesvotes, pnote->novotes, pnote->abstentions ); } act( AT_ACTION, "$n reads a message.", ch, NULL, NULL, TO_ROOM ); } } if( !wasfound ) ch_printf( ch, "No such message: %d\r\n", anum ); return; } else { vnum = 0; for( pnote = board->first_note; pnote; pnote = pnote->next ) { if( is_note_to( ch, pnote ) || IS_IMMORTAL( ch ) ) { vnum++; if( vnum == anum || fAll ) { wasfound = TRUE; pager_printf( ch, "[%3d] %s: %s\r\n%s\r\nTo: %s\r\n%s", vnum, pnote->sender, pnote->subject, pnote->date, pnote->to_list, pnote->text ); } } } if( !wasfound ) ch_printf( ch, "No such message: %d\r\n", anum ); return; } } /* Voting added by Narn, June '96 */ if( !str_cmp( arg, "vote" ) ) { char arg2[MAX_INPUT_LENGTH]; arg_passed = one_argument( arg_passed, arg2 ); board = find_board( ch ); if( !board ) { send_to_char( "There is no bulletin board here.\r\n", ch ); return; } if( !can_read( ch, board ) ) { send_to_char( "You cannot vote on this board.\r\n", ch ); return; } if( is_number( arg2 ) ) anum = atoi( arg2 ); else { send_to_char( "Note vote which number?\r\n", ch ); return; } vnum = 1; for( pnote = board->first_note; pnote && vnum < anum; pnote = pnote->next ) vnum++; if( !pnote ) { send_to_char( "No such note.\r\n", ch ); return; } /* Options: open close yes no abstain */ /* If you're the author of the note and can read the board you can open and close voting, if you can read it and voting is open you can vote. */ if( !str_cmp( arg_passed, "open" ) ) { if( str_cmp( ch->name, pnote->sender ) ) { send_to_char( "You are not the author of this message.\r\n", ch ); return; } pnote->voting = VOTE_OPEN; act( AT_ACTION, "$n opens voting on a note.", ch, NULL, NULL, TO_ROOM ); send_to_char( "Voting opened.\r\n", ch ); write_board( board ); return; } if( !str_cmp( arg_passed, "close" ) ) { if( str_cmp( ch->name, pnote->sender ) ) { send_to_char( "You are not the author of this message.\r\n", ch ); return; } pnote->voting = VOTE_CLOSED; act( AT_ACTION, "$n closes voting on a note.", ch, NULL, NULL, TO_ROOM ); send_to_char( "Voting closed.\r\n", ch ); write_board( board ); return; } /* Make sure the note is open for voting before going on. */ if( pnote->voting != VOTE_OPEN ) { send_to_char( "Voting is not open on this note.\r\n", ch ); return; } /* Can only vote once on a note. */ sprintf( buf, "%s %s %s", pnote->yesvotes, pnote->novotes, pnote->abstentions ); if( is_name( ch->name, buf ) ) { send_to_char( "You have already voted on this note.\r\n", ch ); return; } if( !str_cmp( arg_passed, "yes" ) ) { sprintf( buf, "%s %s", pnote->yesvotes, ch->name ); DISPOSE( pnote->yesvotes ); pnote->yesvotes = str_dup( buf ); act( AT_ACTION, "$n votes on a note.", ch, NULL, NULL, TO_ROOM ); send_to_char( "Ok.\r\n", ch ); write_board( board ); return; } if( !str_cmp( arg_passed, "no" ) ) { sprintf( buf, "%s %s", pnote->novotes, ch->name ); DISPOSE( pnote->novotes ); pnote->novotes = str_dup( buf ); act( AT_ACTION, "$n votes on a note.", ch, NULL, NULL, TO_ROOM ); send_to_char( "Ok.\r\n", ch ); write_board( board ); return; } if( !str_cmp( arg_passed, "abstain" ) ) { sprintf( buf, "%s %s", pnote->abstentions, ch->name ); DISPOSE( pnote->abstentions ); pnote->abstentions = str_dup( buf ); act( AT_ACTION, "$n votes on a note.", ch, NULL, NULL, TO_ROOM ); send_to_char( "Ok.\r\n", ch ); write_board( board ); return; } do_note( ch, STRLIT_EMPTY, FALSE ); } if( !str_cmp( arg, "write" ) ) { if( ch->substate == SUB_RESTRICTED ) { send_to_char ( "You cannot write a note from within another command.\r\n", ch ); return; } if( ( paper = get_eq_char( ch, WEAR_HOLD ) ) == NULL || paper->item_type != ITEM_PAPER ) { paper = create_object( get_obj_index( OBJ_VNUM_NOTE ) ); if( ( tmpobj = get_eq_char( ch, WEAR_HOLD ) ) != NULL ) unequip_char( ch, tmpobj ); paper = obj_to_char( paper, ch ); equip_char( ch, paper, WEAR_HOLD ); act( AT_MAGIC, "$n grabs a message disk to record a note.", ch, NULL, NULL, TO_ROOM ); act( AT_MAGIC, "You get a message disk to record your note.", ch, NULL, NULL, TO_CHAR ); } if( paper->value[0] < 2 ) { paper->value[0] = 1; ed = SetOExtra( paper, "_text_" ); ch->substate = SUB_WRITING_NOTE; ch->dest_buf = ed; start_editing( ch, ed->description ); return; } else { send_to_char( "You cannot modify this message.\r\n", ch ); return; } } if( !str_cmp( arg, "subject" ) ) { if( !arg_passed || arg_passed[0] == '\0' ) { send_to_char( "What do you wish the subject to be?\r\n", ch ); return; } if( ( paper = get_eq_char( ch, WEAR_HOLD ) ) == NULL || paper->item_type != ITEM_PAPER ) { paper = create_object( get_obj_index( OBJ_VNUM_NOTE ) ); if( ( tmpobj = get_eq_char( ch, WEAR_HOLD ) ) != NULL ) unequip_char( ch, tmpobj ); paper = obj_to_char( paper, ch ); equip_char( ch, paper, WEAR_HOLD ); act( AT_MAGIC, "$n grabs a message disk.", ch, NULL, NULL, TO_ROOM ); act( AT_MAGIC, "You get a message disk to record your note.", ch, NULL, NULL, TO_CHAR ); } if( paper->value[1] > 1 ) { send_to_char( "You cannot modify this message.\r\n", ch ); return; } else { paper->value[1] = 1; ed = SetOExtra( paper, "_subject_" ); STRFREE( ed->description ); ed->description = STRALLOC( arg_passed ); send_to_char( "Ok.\r\n", ch ); return; } } if( !str_cmp( arg, "to" ) ) { struct stat fst; char fname[1024]; if( !arg_passed || arg_passed[0] == '\0' ) { send_to_char( "Please specify an addressee.\r\n", ch ); return; } if( ( paper = get_eq_char( ch, WEAR_HOLD ) ) == NULL || paper->item_type != ITEM_PAPER ) { paper = create_object( get_obj_index( OBJ_VNUM_NOTE ) ); if( ( tmpobj = get_eq_char( ch, WEAR_HOLD ) ) != NULL ) unequip_char( ch, tmpobj ); paper = obj_to_char( paper, ch ); equip_char( ch, paper, WEAR_HOLD ); act( AT_MAGIC, "$n gets a message disk to record a note.", ch, NULL, NULL, TO_ROOM ); act( AT_MAGIC, "You grab a message disk to record your note.", ch, NULL, NULL, TO_CHAR ); } if( paper->value[2] > 1 ) { send_to_char( "You cannot modify this message.\r\n", ch ); return; } arg_passed[0] = UPPER( arg_passed[0] ); sprintf( fname, "%s%c/%s", PLAYER_DIR, tolower( ( int ) arg_passed[0] ), capitalize( arg_passed ) ); if( !IS_MAIL || stat( fname, &fst ) != -1 || !str_cmp( arg_passed, "all" ) ) { paper->value[2] = 1; ed = SetOExtra( paper, "_to_" ); STRFREE( ed->description ); ed->description = STRALLOC( arg_passed ); send_to_char( "Ok.\r\n", ch ); return; } else { send_to_char( "No player exists by that name.\r\n", ch ); return; } } if( !str_cmp( arg, "show" ) ) { const char *subject = ""; const char *to_list = ""; const char *text = ""; if( ( paper = get_eq_char( ch, WEAR_HOLD ) ) == NULL || paper->item_type != ITEM_PAPER ) { send_to_char( "You are not holding a message disk.\r\n", ch ); return; } if( ( subject = get_extra_descr( "_subject_", paper->first_extradesc ) ) == NULL ) subject = "(no subject)"; if( ( to_list = get_extra_descr( "_to_", paper->first_extradesc ) ) == NULL ) to_list = "(nobody)"; sprintf( buf, "%s: %s\r\nTo: %s\r\n", ch->name, subject, to_list ); send_to_char( buf, ch ); if( ( text = get_extra_descr( "_text_", paper->first_extradesc ) ) == NULL ) text = "The disk is blank.\r\n"; send_to_char( text, ch ); return; } if( !str_cmp( arg, "post" ) ) { char *strtime = NULL; const char *text = NULL; if( ( paper = get_eq_char( ch, WEAR_HOLD ) ) == NULL || paper->item_type != ITEM_PAPER ) { send_to_char( "You are not holding a message disk.\r\n", ch ); return; } if( paper->value[0] == 0 ) { send_to_char( "There is nothing written on this disk.\r\n", ch ); return; } if( paper->value[1] == 0 ) { send_to_char( "This message has no subject... using 'none'.\r\n", ch ); paper->value[1] = 1; ed = SetOExtra( paper, "_subject_" ); STRFREE( ed->description ); ed->description = STRALLOC( "none" ); } if( paper->value[2] == 0 ) { if( IS_MAIL ) { send_to_char( "This message is addressed to no one!\r\n", ch ); return; } else { send_to_char ( "This message is addressed to no one... sending to 'all'!\r\n", ch ); paper->value[2] = 1; ed = SetOExtra( paper, "_to_" ); STRFREE( ed->description ); ed->description = STRALLOC( "All" ); } } board = find_board( ch ); if( !board ) { send_to_char ( "There is no terminal here to upload your message to.\r\n", ch ); return; } if( !can_post( ch, board ) ) { send_to_char ( "You cannot use this terminal. It is encrypted...\r\n", ch ); return; } if( board->num_posts >= board->max_posts ) { send_to_char ( "This terminal is full. There is no room for your message.\r\n", ch ); return; } act( AT_ACTION, "$n uploads a message.", ch, NULL, NULL, TO_ROOM ); strtime = ctime( ¤t_time ); strtime[strlen( strtime ) - 1] = '\0'; CREATE( pnote, NOTE_DATA, 1 ); pnote->date = STRALLOC( strtime ); text = get_extra_descr( "_text_", paper->first_extradesc ); pnote->text = text ? STRALLOC( text ) : STRALLOC( "" ); text = get_extra_descr( "_to_", paper->first_extradesc ); pnote->to_list = text ? STRALLOC( text ) : STRALLOC( "all" ); text = get_extra_descr( "_subject_", paper->first_extradesc ); pnote->subject = text ? STRALLOC( text ) : STRALLOC( "" ); pnote->sender = QUICKLINK( ch->name ); pnote->voting = 0; pnote->yesvotes = str_dup( "" ); pnote->novotes = str_dup( "" ); pnote->abstentions = str_dup( "" ); LINK( pnote, board->first_note, board->last_note, next, prev ); board->num_posts++; write_board( board ); send_to_char( "You upload your message to the terminal.\r\n", ch ); extract_obj( paper ); return; } if( !str_cmp( arg, "remove" ) || !str_cmp( arg, "take" ) || !str_cmp( arg, "copy" ) ) { char take = 0; board = find_board( ch ); if( !board ) { send_to_char ( "There is no terminal here to download a note from!\r\n", ch ); return; } if( !str_cmp( arg, "take" ) ) take = 1; else if( !str_cmp( arg, "copy" ) ) { if( !IS_IMMORTAL( ch ) ) { send_to_char( "Huh? Type 'help note' for usage.\r\n", ch ); return; } take = 2; } else take = 0; if( !is_number( arg_passed ) ) { send_to_char( "Note remove which number?\r\n", ch ); return; } if( !can_read( ch, board ) ) { send_to_char ( "You can't make any sense of what's posted here, let alone remove anything!\r\n", ch ); return; } anum = atoi( arg_passed ); vnum = 0; for( pnote = board->first_note; pnote; pnote = pnote->next ) { if( IS_MAIL && ( ( is_note_to( ch, pnote ) ) || IS_IMMORTAL( ch ) ) ) vnum++; else if( !IS_MAIL ) vnum++; if( ( !str_cmp( ch->name, pnote->sender ) || can_remove( ch, board ) ) && ( vnum == anum ) ) { if( ( is_name( "all", pnote->to_list ) ) && ( !IS_IMMORTAL( ch ) ) && ( take == 1 ) ) { send_to_char ( "Notes addressed to 'all' can not be taken.\r\n", ch ); return; } if( take != 0 ) { paper = create_object( get_obj_index( OBJ_VNUM_NOTE ) ); ed = SetOExtra( paper, "_sender_" ); STRFREE( ed->description ); ed->description = QUICKLINK( pnote->sender ); ed = SetOExtra( paper, "_text_" ); STRFREE( ed->description ); ed->description = QUICKLINK( pnote->text ); ed = SetOExtra( paper, "_to_" ); STRFREE( ed->description ); ed->description = QUICKLINK( pnote->to_list ); ed = SetOExtra( paper, "_subject_" ); STRFREE( ed->description ); ed->description = QUICKLINK( pnote->subject ); ed = SetOExtra( paper, "_date_" ); STRFREE( ed->description ); ed->description = QUICKLINK( pnote->date ); ed = SetOExtra( paper, "note" ); STRFREE( ed->description ); sprintf( notebuf, "From: " ); strcat( notebuf, pnote->sender ); strcat( notebuf, "\r\nTo: " ); strcat( notebuf, pnote->to_list ); strcat( notebuf, "\r\nSubject: " ); strcat( notebuf, pnote->subject ); strcat( notebuf, "\r\n\r\n" ); strcat( notebuf, pnote->text ); strcat( notebuf, "\r\n" ); ed->description = STRALLOC( notebuf ); paper->value[0] = 2; paper->value[1] = 2; paper->value[2] = 2; sprintf( short_desc_buf, "a note from %s to %s", pnote->sender, pnote->to_list ); STRFREE( paper->short_descr ); paper->short_descr = STRALLOC( short_desc_buf ); sprintf( long_desc_buf, "A note from %s to %s lies on the ground.", pnote->sender, pnote->to_list ); STRFREE( paper->description ); paper->description = STRALLOC( long_desc_buf ); sprintf( keyword_buf, "note parchment paper %s", pnote->to_list ); STRFREE( paper->name ); paper->name = STRALLOC( keyword_buf ); } if( take != 2 ) note_remove( board, pnote ); send_to_char( "Ok.\r\n", ch ); if( take == 1 ) { act( AT_ACTION, "$n downloads a message.", ch, NULL, NULL, TO_ROOM ); obj_to_char( paper, ch ); } else if( take == 2 ) { act( AT_ACTION, "$n copies a message.", ch, NULL, NULL, TO_ROOM ); obj_to_char( paper, ch ); } else act( AT_ACTION, "$n removes a message.", ch, NULL, NULL, TO_ROOM ); return; } } send_to_char( "No such message.\r\n", ch ); return; } send_to_char( "Huh? Type 'help note' for usage.\r\n", ch ); }
void wear_obj(Character *ch, Object *obj, bool fReplace) { if (ch->level < obj->level) { xwritelnf(ch, "You must be level %d to use this object.", obj->level); act(TO_ROOM, ch, obj, 0, "$n tries to use $p, but is too inexperienced."); return; } const wear_table_type *t = wear_table; while (t->display != 0) { if (t->flags == obj->wearFlags) { break; } t++; } if (t != 0 && t->canUse != 0 && !(*t->canUse) (ch)) { xwriteln(ch, "You do not know how to wear that object."); act(TO_ROOM, ch, obj, 0, "$n tries to use $p, but doesn't know how."); return; } switch (obj->wearFlags) { case WEAR_HEAD: if (!remove_obj(ch, WEAR_HEAD, fReplace)) { return; } act(TO_ROOM, ch, obj, 0, "$n wears $p on $s head."); act(TO_CHAR, ch, obj, 0, "You wear $p on your head."); equip_char(ch, obj, WEAR_HEAD); return; case WEAR_NECK: if (!remove_obj(ch, WEAR_NECK, fReplace)) { return; } act(TO_ROOM, ch, obj, 0, "$n wears $p around $s neck."); act(TO_CHAR, ch, obj, 0, "You wear $p around your neck."); equip_char(ch, obj, WEAR_NECK); return; case WEAR_EYES: if (!remove_obj(ch, WEAR_EYES, fReplace)) { return; } act(TO_ROOM, ch, obj, 0, "$n wears $p over $s eyes."); act(TO_CHAR, ch, obj, 0, "You wear $p over your eyes."); equip_char(ch, obj, WEAR_EYES); return; case WEAR_SHOULDERS: if (!remove_obj(ch, WEAR_SHOULDERS, fReplace)) { return; } act(TO_ROOM, ch, obj, 0, "$n wears $p on $s shoulders."); act(TO_CHAR, ch, obj, 0, "You wear $p on your shoulders."); equip_char(ch, obj, WEAR_SHOULDERS); return; case WEAR_BACK: if (!remove_obj(ch, WEAR_BACK, fReplace)) { return; } act(TO_ROOM, ch, obj, 0, "$n wears $p on $s back."); act(TO_CHAR, ch, obj, 0, "You wear $p on your back."); equip_char(ch, obj, WEAR_BACK); return; case WEAR_ARMS: if (!remove_obj(ch, WEAR_ARMS, fReplace)) { return; } act(TO_ROOM, ch, obj, 0, "$n wears $p on $s arms."); act(TO_CHAR, ch, obj, 0, "You wear $p on your arms."); equip_char(ch, obj, WEAR_ARMS); return; case WEAR_HANDS: if (!remove_obj(ch, WEAR_HANDS, fReplace)) { return; } act(TO_ROOM, ch, obj, 0, "$n wears $p on $s hands."); act(TO_CHAR, ch, obj, 0, "You wear $p on your hands."); equip_char(ch, obj, WEAR_HANDS); return; case WEAR_WRIST: if (get_eq_char(ch, WEAR_WRIST) != 0 && get_eq_char(ch, WEAR_WRIST_2) != 0 && !remove_obj(ch, WEAR_WRIST, fReplace) && !remove_obj(ch, WEAR_WRIST_2, fReplace)) { return; } if (get_eq_char(ch, WEAR_WRIST) == 0) { act(TO_ROOM, ch, obj, 0, "$n wears $p on $s left wrist."); act(TO_CHAR, ch, obj, 0, "You wear $p on your left wrist."); equip_char(ch, obj, WEAR_WRIST); return; } if (get_eq_char(ch, WEAR_WRIST_2) == 0) { act(TO_ROOM, ch, obj, 0, "$n wears $p on $s right wrist."); act(TO_CHAR, ch, obj, 0, "You wear $p on your right wrist."); equip_char(ch, obj, WEAR_WRIST_2); return; } xwriteln(ch, "You are already wearing something on your wrists."); return; case WEAR_FINGER: if (get_eq_char(ch, WEAR_FINGER) != 0 && get_eq_char(ch, WEAR_FINGER_2) != 0 && !remove_obj(ch, WEAR_FINGER, fReplace) && !remove_obj(ch, WEAR_FINGER_2, fReplace)) { return; } if (get_eq_char(ch, WEAR_FINGER) == 0) { act(TO_ROOM, ch, obj, 0, "$n wears $p on $s left finger."); act(TO_CHAR, ch, obj, 0, "You wear $p on your left finger."); equip_char(ch, obj, WEAR_FINGER); return; } if (get_eq_char(ch, WEAR_FINGER_2) == 0) { act(TO_ROOM, ch, obj, 0, "$n wears $p on $s right finger."); act(TO_CHAR, ch, obj, 0, "You wear $p on your right finger."); equip_char(ch, obj, WEAR_FINGER_2); return; } xwriteln(ch, "You are already wearing two rings."); return; case WEAR_TORSO: if (!remove_obj(ch, WEAR_TORSO, fReplace)) { return; } act(TO_ROOM, ch, obj, 0, "$n wears $p on $s torso."); act(TO_CHAR, ch, obj, 0, "You wear $p on your torso."); equip_char(ch, obj, WEAR_TORSO); return; case WEAR_WAIST: if (!remove_obj(ch, WEAR_WAIST, fReplace)) { return; } act(TO_ROOM, ch, obj, 0, "$n wears $p around $s waist."); act(TO_CHAR, ch, obj, 0, "You wear $p around your waist."); equip_char(ch, obj, WEAR_WAIST); return; case WEAR_LEGS: if (!remove_obj(ch, WEAR_LEGS, fReplace)) { return; } act(TO_ROOM, ch, obj, 0, "$n wears $p on $s legs."); act(TO_CHAR, ch, obj, 0, "You wear $p on your legs."); equip_char(ch, obj, WEAR_LEGS); return; case WEAR_FEET: if (!remove_obj(ch, WEAR_FEET, fReplace)) { return; } act(TO_ROOM, ch, obj, 0, "$n wears $p on $s feet."); act(TO_CHAR, ch, obj, 0, "You wear $p on your feet."); equip_char(ch, obj, WEAR_FEET); return; case WEAR_ABOUT: if (!remove_obj(ch, WEAR_ABOUT, fReplace)) { return; } act(TO_ROOM, ch, obj, 0, "$n wears $p about $s body."); act(TO_CHAR, ch, obj, 0, "You wear $p about your body."); equip_char(ch, obj, WEAR_ABOUT); return; case WEAR_WIELD: if (!remove_obj(ch, WEAR_WIELD, fReplace)) { return; } act(TO_ROOM, ch, obj, 0, "$n wields $p."); act(TO_CHAR, ch, obj, 0, "You wield $p."); equip_char(ch, obj, WEAR_WIELD); return; case WEAR_DUAL: if (!remove_obj(ch, WEAR_DUAL, fReplace)) { return; } act(TO_ROOM, ch, obj, 0, "$n wields $p in $s off hand."); act(TO_CHAR, ch, obj, 0, "You wield $p in your off hand."); equip_char(ch, obj, WEAR_DUAL); return; case WEAR_SHIELD: if (!remove_obj(ch, WEAR_SHIELD, fReplace)) { return; } act(TO_ROOM, ch, obj, 0, "$n usees $p as $s shield."); act(TO_CHAR, ch, obj, 0, "You use $p as your shield."); equip_char(ch, obj, WEAR_SHIELD); return; case WEAR_LIGHT: if (!remove_obj(ch, WEAR_LIGHT, fReplace)) { return; } act(TO_ROOM, ch, obj, 0, "$n lights $p and holds it."); act(TO_CHAR, ch, obj, 0, "You light $p and hold it."); equip_char(ch, obj, WEAR_LIGHT); return; case WEAR_FLOAT: if (!remove_obj(ch, WEAR_FLOAT, fReplace)) { return; } act(TO_ROOM, ch, obj, 0, "$n releases $p to float near $m."); act(TO_CHAR, ch, obj, 0, "You release $p to float nearby."); equip_char(ch, obj, WEAR_FLOAT); return; default: if (fReplace) { xwriteln(ch, "You can't wear, wield, or hold that."); } return; } }
/* Some initializations for characters, including initial skills If mode == 0, then act as though the character was entering the game for the first time. Otherwise, act as though the character is being set to that level. */ void do_start(struct creature *ch, int mode) { void advance_level(struct creature *ch, int8_t keep_internal); int8_t new_player = 0; int i; struct obj_data *implant_save[NUM_WEARS]; struct obj_data *tattoo_save[NUM_WEARS]; // remove implant affects for (i = 0; i < NUM_WEARS; i++) { if (GET_IMPLANT(ch, i)) implant_save[i] = raw_unequip_char(ch, i, EQUIP_IMPLANT); else implant_save[i] = NULL; if (GET_TATTOO(ch, i)) tattoo_save[i] = raw_unequip_char(ch, i, EQUIP_TATTOO); else tattoo_save[i] = NULL; } if (GET_EXP(ch) == 0 && !IS_REMORT(ch) && !IS_VAMPIRE(ch)) new_player = true; GET_LEVEL(ch) = 1; GET_EXP(ch) = 1; if (mode) roll_real_abils(ch); for (i = 1; i <= MAX_SKILLS; i++) SET_SKILL(ch, i, 0); if (IS_VAMPIRE(ch)) GET_LIFE_POINTS(ch) = 1; else GET_LIFE_POINTS(ch) = 3 * (GET_WIS(ch) + GET_CON(ch)) / 40; ch->points.max_hit = 20; ch->points.max_mana = 100; ch->points.max_move = 82; if (IS_TABAXI(ch)) { SET_SKILL(ch, SKILL_CLAW, LEARNED(ch)); SET_SKILL(ch, SKILL_BITE, LEARNED(ch)); } if (IS_ELF(ch)) { SET_SKILL(ch, SKILL_ARCHERY, LEARNED(ch)); } switch (GET_CLASS(ch)) { case CLASS_MAGIC_USER: SET_SKILL(ch, SKILL_PUNCH, 10); break; case CLASS_CLERIC: SET_SKILL(ch, SKILL_PUNCH, 10); break; case CLASS_THIEF: SET_SKILL(ch, SKILL_PUNCH, 15); SET_SKILL(ch, SKILL_SNEAK, 10); SET_SKILL(ch, SKILL_HIDE, 5); SET_SKILL(ch, SKILL_STEAL, 15); break; case CLASS_WARRIOR: SET_SKILL(ch, SKILL_PUNCH, 20); break; case CLASS_BARB: SET_SKILL(ch, SKILL_PUNCH, 15); break; case CLASS_PSIONIC: SET_SKILL(ch, SKILL_PUNCH, 10); break; case CLASS_PHYSIC: SET_SKILL(ch, SKILL_PUNCH, 10); break; case CLASS_CYBORG: SET_SKILL(ch, SKILL_PUNCH, 10); break; case CLASS_KNIGHT: SET_SKILL(ch, SKILL_PUNCH, 20); break; case CLASS_RANGER: SET_SKILL(ch, SKILL_PUNCH, 15); GET_MAX_MOVE(ch) += dice(4, 9); break; case CLASS_MONK: SET_SKILL(ch, SKILL_PUNCH, 20); break; case CLASS_MERCENARY: SET_SKILL(ch, SKILL_PUNCH, 20); case CLASS_BARD: SET_SKILL(ch, SKILL_PUNCH, 25); SET_SKILL(ch, SKILL_ARCHERY, 25); break; } if (new_player) { if (PAST_CLASS(GET_CLASS(ch))) { deposit_past_bank(ch->desc->account, 8192 + number(256, 2048) + GET_INT(ch) + GET_WIS(ch)); ch->points.gold = 8192 + number(256, 2048) + GET_INT(ch) + GET_WIS(ch); } else if (FUTURE_CLASS(GET_CLASS(ch))) { deposit_future_bank(ch->desc->account, 8192 + number(256, 2048) + GET_INT(ch) + GET_WIS(ch)); ch->points.cash = 8192 + number(256, 2048) + GET_INT(ch) + GET_WIS(ch); } // New players do not start with the gown at this point // This has been left in for reference for generic newbie starting gear for the future. // New players start with a hospital gown and items most dear to them /* struct obj_data *gown = read_object(33800); if (gown != NULL) { equip_char(ch, gown, WEAR_ABOUT, EQUIP_WORN); } */ // Good clerics start with a holy symbol on neck if ((GET_CLASS(ch) == CLASS_CLERIC) && IS_GOOD(ch)) { struct obj_data *talisman = read_object(1280); if (talisman != NULL) { equip_char(ch, talisman, WEAR_NECK_1, EQUIP_WORN); } } // Evil clerics start with a holy symbol on hold if ((GET_CLASS(ch) == CLASS_CLERIC) && IS_EVIL(ch)) { struct obj_data *symbol = read_object(1260); if (symbol != NULL) { equip_char(ch, symbol, WEAR_HOLD, EQUIP_WORN); } } // Good knights start with a holy symbol on finger if ((GET_CLASS(ch) == CLASS_KNIGHT) && IS_GOOD(ch)) { struct obj_data *ring = read_object(1287); if (ring != NULL) { equip_char(ch, ring, WEAR_FINGER_L, EQUIP_WORN); } } // Evil knights start with a holy symbol on neck if ((GET_CLASS(ch) == CLASS_KNIGHT) && IS_EVIL(ch)) { struct obj_data *pendant = read_object(1270); if (pendant != NULL) { equip_char(ch, pendant, WEAR_NECK_1, EQUIP_WORN); } } // Bards start with a percussion instrument held, and stringed in inventory if (GET_CLASS(ch) == CLASS_BARD) { struct obj_data *lute = read_object(3218); if (lute != NULL) { obj_to_char(lute, ch); } } set_title(ch, "the complete newbie"); } advance_level(ch, 0); GET_MAX_MOVE(ch) += GET_CON(ch); GET_HIT(ch) = GET_MAX_HIT(ch); GET_MANA(ch) = GET_MAX_MANA(ch); GET_MOVE(ch) = GET_MAX_MOVE(ch); GET_COND(ch, THIRST) = 24; GET_COND(ch, FULL) = 24; GET_COND(ch, DRUNK) = 0; if (new_player) { ch->player.time.played = 0; ch->player.time.logon = time(NULL); } for (i = 0; i < NUM_WEARS; i++) { if (implant_save[i]) equip_char(ch, implant_save[i], i, EQUIP_IMPLANT); if (tattoo_save[i]) equip_char(ch, tattoo_save[i], i, EQUIP_TATTOO); } }