Example #1
0
void
mage_activity(struct creature *ch)
{
    if (room_is_dark(ch->in_room) &&
        can_cast_spell(ch, SPELL_INFRAVISION) && !has_dark_sight(ch)) {
        cast_spell(ch, ch, NULL, NULL, SPELL_INFRAVISION);
    } else if (room_is_dark(ch->in_room) &&
        can_cast_spell(ch, SPELL_GLOWLIGHT) && !has_dark_sight(ch)) {
        cast_spell(ch, ch, NULL, NULL, SPELL_GLOWLIGHT);
    } else if (can_cast_spell(ch, SPELL_PRISMATIC_SPHERE)
        && !AFF3_FLAGGED(ch, AFF3_PRISMATIC_SPHERE)) {
        cast_spell(ch, ch, NULL, NULL, SPELL_PRISMATIC_SPHERE);
    } else if (can_cast_spell(ch, SPELL_ANTI_MAGIC_SHELL)
        && !affected_by_spell(ch, SPELL_ANTI_MAGIC_SHELL)) {
        cast_spell(ch, ch, NULL, NULL, SPELL_ANTI_MAGIC_SHELL);
    } else if (can_cast_spell(ch, SPELL_HASTE)
        && !AFF2_FLAGGED(ch, AFF2_HASTE)) {
        cast_spell(ch, ch, NULL, NULL, SPELL_HASTE);
    } else if (can_cast_spell(ch, SPELL_DISPLACEMENT)
        && !AFF2_FLAGGED(ch, AFF2_DISPLACEMENT)) {
        cast_spell(ch, ch, NULL, NULL, SPELL_DISPLACEMENT);
    } else if (can_cast_spell(ch, SPELL_TRUE_SEEING)
        && !AFF2_FLAGGED(ch, AFF2_TRUE_SEEING)) {
        cast_spell(ch, ch, NULL, NULL, SPELL_TRUE_SEEING);
    } else if (can_cast_spell(ch, SPELL_REGENERATE)
        && !AFF_FLAGGED(ch, AFF_REGEN)) {
        cast_spell(ch, ch, NULL, NULL, SPELL_REGENERATE);
    } else if (can_cast_spell(ch, SPELL_FIRE_SHIELD)
        && !AFF2_FLAGGED(ch, AFF2_FIRE_SHIELD)) {
        cast_spell(ch, ch, NULL, NULL, SPELL_FIRE_SHIELD);
    } else if (can_cast_spell(ch, SPELL_STRENGTH)
        && !affected_by_spell(ch, SPELL_STRENGTH)) {
        cast_spell(ch, ch, NULL, NULL, SPELL_STRENGTH);
    } else if (can_cast_spell(ch, SPELL_BLUR) && !AFF_FLAGGED(ch, AFF_BLUR)) {
        cast_spell(ch, ch, NULL, NULL, SPELL_BLUR);
    } else if (can_cast_spell(ch, SPELL_ARMOR)
        && !affected_by_spell(ch, SPELL_ARMOR)) {
        cast_spell(ch, ch, NULL, NULL, SPELL_ARMOR);
    }
}
void look_room(struct char_data *ch, struct room_index_data *in_room) {
    if (!validate_look(ch)) {
	return;
    }

    if (in_room == NULL) {
	send_to_char("NOWHERE.", ch);
	return;
    }

    if (room_is_dark(ch, in_room) && !IS_SET(ch->act, PLR_HOLYLIGHT)) {
	send_to_char("It is pitch ```8black...`` \n\r", ch);
	show_char_to_char(in_room->people, ch);
	return;
    }


    send_to_char(in_room->name, ch);
    if ((IS_IMMORTAL(ch) && (IS_NPC(ch) || IS_SET(ch->act, PLR_HOLYLIGHT))) || IS_BUILDER(ch, in_room->area)) {
	printf_to_char(ch, " [`1Room `!%d``]", in_room->vnum);
    }

    send_to_char("\n\r", ch);
    if ((!IS_NPC(ch) && !IS_SET(ch->comm, COMM_BRIEF))) {
	send_to_char("  ", ch);
	send_to_char(in_room->description, ch);
    }

    send_to_char("\n\r", ch);

    if ((is_affected(ch, gsp_detect_magic) || IS_SET(ch->act, PLR_HOLYLIGHT))) {
	struct affect_data *paf;
	for (paf = in_room->affected; paf != NULL; paf = paf->next) {
	    send_to_char(room_affect(paf), ch);
	}
	send_to_char("\n\r", ch);
    }

    if (!IS_NPC(ch) && IS_SET(ch->act, PLR_AUTOEXIT))
	do_exits(ch, "auto");

    if (is_affected_room(in_room, gsp_faerie_fog))
	send_to_char("There is a `Ppurple haze`` floating throughout the room.\n\r", ch);

    show_list_to_char(in_room->contents, ch, false, false);
    show_char_to_char(in_room->people, ch);
    return;
}
Example #3
0
// Returns true if the player can see in the room
bool
check_sight_room(struct creature * self, struct room_data * room)
{
    if (!room) {
        errlog("check_sight_room() called with NULL room");
        return false;
    }

    if (room_is_dark(room) && !has_dark_sight(self))
        return false;

    if (ROOM_FLAGGED(room, ROOM_SMOKE_FILLED) &&
        !AFF3_FLAGGED(self, AFF3_SONIC_IMAGERY))
        return false;

    return true;
}
void show_char_to_char(struct char_data *list, struct char_data *ch)
{
    struct char_data *rch;

    for (rch = list; rch != NULL; rch = rch->next_in_room) {
	if (rch == ch)
	    continue;

	if (get_trust(ch) < rch->invis_level)
	    continue;

	if (can_see(ch, rch))
	    show_char_to_char_0(rch, ch);
	else if (room_is_dark(ch, ch->in_room)
		&& IS_AFFECTED(rch, AFF_INFRARED))
	    send_to_char("You see glowing ```1red ``eyes watching YOU!\n\r", ch);
    }

    return;
}
Example #5
0
int
char_class_race_hit_bonus(struct creature *ch, struct creature *vict)
{
    int bonus = 0;
    // Height modifiers
    bonus += (IS_DWARF(ch) && (IS_OGRE(vict) || IS_TROLL(vict) ||
            IS_GIANT(vict) || (GET_HEIGHT(vict) > 2 * GET_HEIGHT(ch))));
    // Dwarven dislike of water or heights
    bonus -= (IS_DWARF(ch) && (room_is_watery(ch->in_room)
            || room_is_open_air(ch->in_room)));
    // Thieves operating in the dark
    bonus += (IS_THIEF(ch) && room_is_dark(ch->in_room));
    // Rangers like being outside
    bonus += (IS_RANGER(ch) && (SECT_TYPE(ch->in_room) == SECT_FOREST ||
            (SECT_TYPE(ch->in_room) != SECT_CITY &&
                SECT_TYPE(ch->in_room) != SECT_INSIDE && OUTSIDE(ch))));
    // Tabaxi in their native habitat
    bonus += (IS_TABAXI(ch) && SECT_TYPE(ch->in_room) == SECT_FOREST &&
        OUTSIDE(ch));
    return (bonus);
}
Example #6
0
void
psionic_activity(struct creature *ch)
{
    if (room_is_dark(ch->in_room)
        && !has_dark_sight(ch)
        && can_cast_spell(ch, SPELL_RETINA))
        cast_spell(ch, ch, NULL, NULL, SPELL_RETINA);
    else if (GET_HIT(ch) < GET_MAX_HIT(ch) * 0.80) {
        if (can_cast_spell(ch, SPELL_CELL_REGEN))
            cast_spell(ch, ch, NULL, NULL, SPELL_CELL_REGEN);
        else if (can_cast_spell(ch, SPELL_WOUND_CLOSURE))
            cast_spell(ch, ch, NULL, NULL, SPELL_WOUND_CLOSURE);
    } else if (!AFF_FLAGGED(ch, AFF_NOPAIN)
        && !AFF_FLAGGED(ch, AFF_SANCTUARY)
        && can_cast_spell(ch, SPELL_NOPAIN))
        cast_spell(ch, ch, NULL, NULL, SPELL_NOPAIN);
    else if (!room_has_air(ch->in_room) &&
        !can_travel_sector(ch, ch->in_room->sector_type, 0) &&
        can_cast_spell(ch, SPELL_BREATHING_STASIS) &&
        !AFF3_FLAGGED(ch, AFF3_NOBREATHE))
        cast_spell(ch, ch, NULL, NULL, SPELL_BREATHING_STASIS);
    else if (!AFF2_FLAGGED(ch, AFF2_TELEKINESIS)
        && can_cast_spell(ch, SPELL_TELEKINESIS))
        cast_spell(ch, ch, NULL, NULL, SPELL_TELEKINESIS);
    else if (!affected_by_spell(ch, SPELL_DERMAL_HARDENING)
        && can_cast_spell(ch, SPELL_DERMAL_HARDENING))
        cast_spell(ch, ch, NULL, NULL, SPELL_DERMAL_HARDENING);
    else if (!AFF3_FLAGGED(ch, AFF3_PSISHIELD)
        && can_cast_spell(ch, SPELL_PSISHIELD))
        cast_spell(ch, ch, NULL, NULL, SPELL_PSISHIELD);
    else if (can_cast_spell(ch, SPELL_PSYCHIC_RESISTANCE) &&
        !affected_by_spell(ch, SPELL_PSYCHIC_RESISTANCE))
        cast_spell(ch, ch, NULL, NULL, SPELL_PSYCHIC_RESISTANCE);
    else if (can_cast_spell(ch, SPELL_POWER)
        && !affected_by_spell(ch, SPELL_POWER))
        cast_spell(ch, ch, NULL, NULL, SPELL_POWER);
    else if (!AFF_FLAGGED(ch, AFF_CONFIDENCE)
        && can_cast_spell(ch, SPELL_CONFIDENCE))
        cast_spell(ch, ch, NULL, NULL, SPELL_CONFIDENCE);
}
Example #7
0
/* This function is recursive, ie it calls itself */
void map_exits( CHAR_DATA * ch, ROOM_INDEX_DATA * pRoom, int x, int y, int depth )
{
	static char map_chars[11] = "|-|-UD/\\\\/";
	int door;
	int exitx = 0, exity = 0;
	int roomx = 0, roomy = 0;
	EXIT_DATA *pExit;

	/*
	 * Setup this coord as a room - Change any symbols that can't be displayed here 
	 */
	dmap[x][y].sector = pRoom->sector_type;
	switch ( pRoom->sector_type )
	{
		case SECT_INSIDE:
			dmap[x][y].tegn = 'O';
			dmap[x][y].sector = -1;
			break;

		case SECT_CITY:
			dmap[x][y].tegn = ':';
			break;

		case SECT_FIELD:
		case SECT_FOREST:
		case SECT_HILLS:
			dmap[x][y].tegn = '*';
			break;

		case SECT_MOUNTAIN:
			dmap[x][y].tegn = '@';
			break;

		case SECT_WATER_SWIM:
		case SECT_WATER_NOSWIM:
			dmap[x][y].tegn = '=';
			break;

		case SECT_AIR:
			dmap[x][y].tegn = '~';
			break;

		case SECT_DESERT:
			dmap[x][y].tegn = '+';
			break;

		default:
			dmap[x][y].tegn = 'O';
			dmap[x][y].sector = -1;
			bug( "%s: Bad sector type (%d) in room %d.", __FUNCTION__, pRoom->sector_type, pRoom->vnum );
			break;
	}

	dmap[x][y].vnum = pRoom->vnum;
	dmap[x][y].depth = depth;
//   dmap[x][y].info = pRoom->room_flags;
	dmap[x][y].can_see = room_is_dark( pRoom );

	/*
	 * Limit recursion 
	 */
	if ( depth > MAXDEPTH )
		return;

	/*
	 * This room is done, deal with it's exits 
	 */
	for ( door = 0; door < 10; ++door )
	{
		/*
		 * Skip if there is no exit in this direction 
		 */
		if ( !( pExit = get_exit( pRoom, door ) ) )
			continue;

		/*
		 * Skip up and down until I can figure out a good way to display it 
		 */
		if ( door == 4 || door == 5 )
			continue;

		/*
		 * Get the coords for the next exit and room in this direction 
		 */
		get_exit_dir( door, &exitx, &exity, x, y );
		get_exit_dir( door, &roomx, &roomy, exitx, exity );

		/*
		 * Skip if coords fall outside map 
		 */
		if ( BOUNDARY( exitx, exity ) || BOUNDARY( roomx, roomy ) )
			continue;

		/*
		 * Skip if there is no room beyond this exit 
		 */
		if ( !pExit->to_room )
			continue;

		/*
		 * Ensure there are no clashes with previously defined rooms 
		 */
		if ( ( dmap[roomx][roomy].vnum != 0 ) && ( dmap[roomx][roomy].vnum != pExit->to_room->vnum ) )
		{
			/*
			 * Use the new room if the depth is higher 
			 */
			if ( dmap[roomx][roomy].depth <= depth )
				continue;

			/*
			 * It is so clear the old room 
			 */
			clear_room( roomx, roomy );
		}

		/*
		 * No exits at MAXDEPTH 
		 */
		if ( depth == MAXDEPTH )
			continue;

		/*
		 * No need for exits that are already mapped 
		 */
		if ( dmap[exitx][exity].depth > 0 )
			continue;

		/*
		 * Fill in exit 
		 */
		dmap[exitx][exity].depth = depth;
		dmap[exitx][exity].vnum = pExit->to_room->vnum;
//      dmap[exitx][exity].info = pExit->exit_info;
		dmap[exitx][exity].tegn = map_chars[door];
		dmap[exitx][exity].sector = -1;

		/*
		 * More to do? If so we recurse 
		 */
		if ( depth < MAXDEPTH && ( ( dmap[roomx][roomy].vnum == pExit->to_room->vnum ) || ( dmap[roomx][roomy].vnum == 0 ) ) )
		{
			/*
			 * Depth increases by one each time 
			 */
			map_exits( ch, pExit->to_room, roomx, roomy, depth + 1 );
		}
	}
}
Example #8
0
/*
 * 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;
		}
	}
}
Example #9
0
void do_track( CHAR_DATA *ch, char *argument )
{
	char       buf [ MAX_STRING_LENGTH ];
	char       arg [ MAX_STRING_LENGTH ];
	CHAR_DATA *victim;
	int        direction, skill;
	bool       fArea=TRUE;

	skill=get_skill(ch, gsn_track);

	if (IS_NPC(ch))
	{
		return;
	}

	if ( ch->mount )
	{
		send_to_char( "Najpierw zsi±d¼ ze swojego wierzchowca.\n\r", ch );
		return;
	}

	if ( !IS_IMMORTAL( ch ) && IS_AFFECTED( ch, AFF_BLIND ) )
	{
		act("$n klêka i bezradnie potrz±sa g³ow±.",ch,NULL,NULL,TO_ROOM);
		send_to_char("Klekasz, ale przecie¿ niczego nie widzisz.\n\r",ch);
		return;
	}
	if ( room_is_dark( ch, ch->in_room ) &&  !(IS_AFFECTED( ch, AFF_DARK_VISION ) || IS_IMMORTAL( ch ) ))
	{
		send_to_char("Klekasz, ale jest tu tak ciemno, ¿e niczego nie widzisz.\n\r",ch);
		return;
	}

	// wycinamy niektóre ze sektorów
	switch ( ch->in_room->sector_type )
	{
		case  6:  //woda p³yw
		case  7:  //woda niep
		case 19:  //rzeka
		case 20:  //jezioro
		case 21:  //morze
		case 22:  //ocean
		case 23:  //lawa
		case 24:  //ruchome piaski
		case 25:  //gor±ce ¼ród³o
		case 34:  //pod wod±
		case 37:  //ciemna woda
		case 39:  //podziemne jezioro
			send_to_char( "Tutaj chyba nie da siê szukaæ ¶ladów.\n\r", ch );
			return;
	}

	// komunikaty dla tych, którzy nie umiej± szukaæ ¶ladów
	if ( skill == 0 )
	{
		switch (number_range(1,7))
		{
			case 1:
				act("$n klêka i nie wie co robiæ dalej.",ch,NULL,NULL,TO_ROOM);
				send_to_char("Klêkasz i nie za bardzo wiesz co robiæ dalej.\n\r",ch);
				break;
			case 2:
				act("$n klêka i niczego nie widzi.",ch,NULL,NULL,TO_ROOM);
				send_to_char("Klêkasz i niczego nie widzisz.\n\r",ch);
				break;
			case 3:
				act("$n mocno tupie, klêka i przygl±da siê ¶ladom.",ch,NULL,NULL,TO_ROOM);
				send_to_char("Mocno tupiesz, klêkasz i przygl±dasz siê ¶ladom.\n\r",ch);
				break;
			case 4:
				act("$n klêka i ¶ledzi tropy, ale nie ma o tym zielonego pojêcia.",ch,NULL,NULL,TO_ROOM);
				send_to_char("Klêkasz i ¶ledzisz tropy, choæ nie masz o tym zielonego pojêcia.\n\r",ch);
				break;
			case 5:
				act("$n klêka i robi nieszczê¶liw± minê.",ch,NULL,NULL,TO_ROOM);
				send_to_char("Klêkasz i robisz nieszczê¶liw± minê.\n\r",ch);
				break;
			case 6:
				act("$n rozgl±da siê dooko³a.",ch,NULL,NULL,TO_ROOM);
				send_to_char("Rozgl±dasz siê dooko³a, ale to nie pomaga.\n\r",ch);
				break;
			case 7:
				act("$n zastanawia siê nad tym, ¿e tropienie to niez³a umiejêtno¶æ.",ch,NULL,NULL,TO_ROOM);
				send_to_char("Zastanawiasz siê nad tym, ¿e tropienie to niez³a umiejêtno¶æ.\n\r",ch);
				break;
			default :
				send_to_char( "Nie masz pojêcia jak to siê robi.\n\r", ch );
				act("$n klêka i ¶ledzi tropy, ale nie ma o tym zielonego pojêcia.",ch,NULL,NULL,TO_ROOM);
				break;
		}
		return;
	}

	// bonus/kara od dobrej lokacji s± wiêksze ni¿ od z³ej
	if ( EXT_IS_SET( ch->in_room->room_flags, ROOM_CONSECRATE ))
	{
		if (IS_EVIL( ch ) ) skill -= number_range(1,5);
		if (IS_GOOD( ch ) ) skill += number_range(1,5);
	}

	if ( EXT_IS_SET( ch->in_room->room_flags, ROOM_DESECRATE ))
	{
		if (IS_EVIL( ch ) ) skill += number_range(0,4);
		if (IS_GOOD( ch ) ) skill -= number_range(0,4);
	}

	// sprawdzamy czy skill nie zrobi³ siê nam mniejszy ni¿ 1
	if (skill < 1)
	{
		skill = 1;
	}

	// no to zaczynamy w³a¶ciwe trackowanie :D
	one_argument( argument, arg );

#ifdef ENABLE_NEW_TRACK
	if(MAX_TRACK_LEN > 0)
	{
		track_new(ch, skill, argument);
		return;
	}
#endif

	if ( arg[0] == '\0' )
	{
		act("$n klêka i zaczyna z uwag± przygl±daæ siê ¶ladom.",ch,NULL,NULL,TO_ROOM);
		act("Klêkasz i z uwag± przygl±dasz siê ¶ladom.",ch,NULL,NULL,TO_CHAR);
		return;
	}

	if ( fArea )
	{
		victim = get_char_area( ch, arg );
	}
	else
	{
		victim = get_char_world( ch, arg );
	}

	if ( !victim )
	{
		act("$n klêka i zaczyna z uwag± przygl±daæ siê ¶ladom.",ch,NULL,NULL,TO_ROOM);
		act("Klêkasz, przygl±dasz siê ¶ladom, ale nie znajdujesz ¿adnego tropu.",ch,NULL,NULL,TO_CHAR);
		WAIT_STATE( ch, skill_table[gsn_track].beats );
		return;
	}

	if(victim==ch)
	{
		act("Zastanawiasz siê przez chwilê czy to ma sens, no có¿...",ch,NULL,NULL,TO_CHAR);
		return;
	}

	if ( ch->in_room == victim->in_room )
	{
		act( "Klêkasz i badasz trop, po chwili zdajesz sobie sprawê, ¿e $N stoi ko³o ciebie.", ch, NULL, victim, TO_CHAR );
		act("$n klêka i zaczyna z uwag± przygl±daæ siê ¶ladom.",ch,NULL,NULL,TO_ROOM);
		return;
	}

	if ( skill < number_range( 20, 40 ) )
	{
		act("$n klêka i zaczyna z uwag± przygl±daæ siê ¶ladom.",ch,NULL,NULL,TO_ROOM);
		act("Klêkasz, przygl±dasz siê ¶ladom, ale nie znajdujesz ¿adnego tropu.",ch,NULL,NULL,TO_CHAR);
		WAIT_STATE( ch, skill_table[gsn_track].beats );
		check_improve(ch, NULL, gsn_track, FALSE, 12);
		return;
	}

	if ( IS_AFFECTED ( victim, AFF_SPIRIT_WALK ) )
	{
		act("$n klêka i zaczyna z uwag± przygl±daæ siê ¶ladom.",ch,NULL,NULL,TO_ROOM);
		act("Klêkasz, przygl±dasz siê ¶ladom, ale nie znajdujesz ¿adnego tropu.",ch,NULL,NULL,TO_CHAR);
		WAIT_STATE( ch, skill_table[gsn_track].beats );
		return;
	}
	else
	{
		act("$n klêka i zaczyna z uwag± przygl±daæ siê ¶ladom.",ch,NULL,NULL,TO_ROOM);
		act("Klêkasz i przygladasz siê ¶ladom, chyba widzisz jaki¶ trop.",ch,NULL,NULL,TO_CHAR);
	}

	WAIT_STATE( ch, skill_table[gsn_track].beats );


	direction = find_path( ch->in_room->vnum, victim->in_room->vnum, ch, -40000, fArea );

	if ( direction == -1 )
	{
		act( "Niestety, nie mo¿esz nic wiêcej odczytaæ ze ¶ladów.", ch, NULL, victim, TO_CHAR );
		return;
	}

	if ( direction < 0 || direction >= MAX_DIR )
	{
		send_to_char( "Hmm... co¶ jest nie tak.\n\r", ch );
		return;
	}

/*
 * Give a random direction if the player misses the die roll.
 */
	if ( number_percent() > skill )
	{
		do
		{
			direction = number_door( );
		}
		while (   !( ch->in_room->exit[direction] ) || !( ch->in_room->exit[direction]->u1.to_room ) );
	}

	check_improve(ch, NULL, gsn_track, TRUE, 9);

/*
 * Display the results of the search.
 */


	sprintf( buf, "Znajdujesz ¶lady $Z prowadz±ce na %s.", direction == 4 ? "górê" : dir_name[direction] );
	act( buf, ch, NULL, victim, TO_CHAR );
	return;
}
Example #10
0
/*
 * 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;
}
Example #11
0
// Opposite of room_is_dark()
bool
room_is_light(struct room_data * room)
{
    return !room_is_dark(room);
}
Example #12
0
/* This function is recursive, ie it calls itself */
void map_exits(CHAR_DATA *ch, ROOM_INDEX_DATA *pRoom, int x, int y, int depth)
{
  static char map_chars [4] = "|-|-";
  int door;
  int exitx = 0, exity = 0;
  int roomx = 0, roomy = 0;
  char buf[200]; // bugs
  EXIT_DATA *pExit;

  /* Setup this coord as a room */
  switch(pRoom->sector_type)
  {
    case SECT_CITY:
    case SECT_INSIDE:
    case SECT_UNUSED:
      map[x][y].tegn = 'O';
      break;
    case SECT_FIELD:
    case SECT_FOREST:
    case SECT_HILLS:
      map[x][y].tegn = '*';
      break;
    case SECT_MOUNTAIN:
      map[x][y].tegn = '@';
      break;
    case SECT_WATER_SWIM:
    case SECT_WATER_NOSWIM:
      map[x][y].tegn = '=';
      break;
    case SECT_AIR:
      map[x][y].tegn = '~';
      break;
    case SECT_DESERT:
      map[x][y].tegn = '+';
      break;
    default:
      map[x][y].tegn = 'O';
      xprintf(buf, "Map_exits: Bad sector type (%d) in room %d.",
        pRoom->sector_type, pRoom->vnum);
      bug(buf, 0);
      break;
  }
  map[x][y].vnum = pRoom->vnum;
  map[x][y].depth = depth;
  map[x][y].info = pRoom->room_flags;
  map[x][y].can_see = room_is_dark( pRoom );

  /* Limit recursion */
  if ( depth > MAXDEPTH ) return;

  /* This room is done, deal with it's exits */
  for( door = 0; door < 4; door++ )
  {
    /* Skip if there is no exit in this direction */
    if ( ( pExit = pRoom->exit[door] ) == NULL ) continue;

    /* Get the coords for the next exit and room in this direction */
    get_exit_dir( door, &exitx, &exity, x, y );
    get_exit_dir( door, &roomx, &roomy, exitx, exity );

    /* Skip if coords fall outside map */
    if ( BOUNDARY( exitx, exity ) || BOUNDARY( roomx, roomy )) continue;

    /* Skip if there is no room beyond this exit */
    if ( pExit->to_room == NULL ) continue;

    /* Ensure there are no clashes with previously defined rooms */
    if ( ( map[roomx][roomy].vnum != 0 ) &&
         ( map[roomx][roomy].vnum != pExit->to_room->vnum ))
    {
      /* Use the new room if the depth is higher */
      if ( map[roomx][roomy].depth <= depth ) continue;

      /* It is so clear the old room */
      clear_room( roomx, roomy );
    }

    /* No exits at MAXDEPTH */
    if ( depth == MAXDEPTH ) continue;

    /* No need for exits that are already mapped */
    if ( map[exitx][exity].depth > 0 ) continue;

    /* Fill in exit */
    map[exitx][exity].depth = depth;
    map[exitx][exity].vnum = pExit->to_room->vnum;
    map[exitx][exity].info = pExit->exit_info;
    map[exitx][exity].tegn = map_chars[door];

    /* More to do? If so we recurse */
    if ( ( depth < MAXDEPTH ) &&
       ( ( map[roomx][roomy].vnum == pExit->to_room->vnum ) ||
         ( map[roomx][roomy].vnum == 0 ) ) )
    {
      /* Depth increases by one each time */
      map_exits( ch, pExit->to_room, roomx, roomy, depth + 1 );
    }
  }
}
Example #13
0
void do_scan( CHAR_DATA *ch, char *argument )
{
    EXIT_DATA       *pexit;
    ROOM_INDEX_DATA *room;
    ROOM_INDEX_DATA *in_room;
    DESCRIPTOR_DATA * d;
    extern char *const dir_name[];
    char buf[ MAX_STRING_LENGTH ];
    char exitname[ MAX_STRING_LENGTH ];
    int lookdoor, door, iter;
    int distance, max_dist;
    int mob_count, mob_count_new;
    bool darkness = FALSE;
    const char *dir_long_name[] = { "pó³noc", "wschód", "po³udnie", "zachód", "góra", "dó³" };
    lookdoor = -1;
    door = -1;

    if ( !IS_NPC( ch ) && ch->pcdata->mind_in )
    {
        in_room = ch->pcdata->mind_in;
    }
    else
    {
        if ( !check_blind( ch ) )
        {
            return ;
        }
        in_room = ch->in_room;
    }

    if ( argument[0] != '\0' )
    {
        if ( IS_AFFECTED( ch, AFF_MAZE ) )
        {
            send_to_char("Nie bardzo wiesz w która stronê popatrzeæ.\n\r", ch);
            return;
        }

        //wieza obserwacyjna
        if( !str_prefix( argument, "around" ) )
        {
            if ( !EXT_IS_SET( ch->in_room->room_flags, ROOM_WATCH_TOWER ) )
            {
                send_to_char( "Musisz byæ na szczycie wie¿y obserwacyjnej.\n\r", ch );
                return;
            }

            if ( ch->position != POS_STANDING )
            {
                send_to_char( "Najpierw wstañ.\n\r", ch );
                return;
            }

            send_to_char( "Ze szczytu wie¿y ogl±dasz uwa¿nie ca³± okolicê.\n\r", ch );
            act( "Stoj±c na szczycie wie¿y $n uwa¿nie omiata wzrokiem ca³± okolicê.", ch, NULL, NULL, TO_ROOM );

            for ( d = descriptor_list; d != NULL; d = d->next )
            {
                if ( !d->character || d->connected < 0 )
                {
                    continue;
                }
                if( d->connected != CON_PLAYING || d->character == ch || d->character->in_room == NULL )
                {
                    continue;
                }
                if ( !SAME_AREA( d->character->in_room->area, ch->in_room->area ) || !SAME_AREA_PART( d->character, ch ) )
                {
                    continue;
                }
                if ( !can_see( ch, d->character ) )
                {
                    continue;
                }
                if ( EXT_IS_SET( d->character->in_room->room_flags, ROOM_INDOORS ) || IS_SET( sector_table[ d->character->in_room->sector_type ].flag, SECT_NOWEATHER ) )
                {
                    continue;
                }
                if ( ch->in_room == d->character->in_room )
                {
                    continue;
                }
                print_char( ch, "{x%s - Widzisz tam {C%s{x.\n\r", d->character->in_room->name, d->character->name4 );
            }
            return;
        }
        door = get_door( ch, argument );
        if ( door >= 0 && check_vname( ch, door, FALSE ) )
        {
            send_to_char("W ktorym kierunku chcesz siê rozejrzeæ?\n\r", ch);
            return;
        }
        if ( door < 0 )
        {
            door = -1;
            for ( iter = 0; iter <= 5; iter++ )
            {
                if ( ( pexit = in_room->exit[iter] ) != NULL &&   !str_prefix( argument, pexit->vName ) &&  !( (IS_SET(pexit->exit_info, EX_SECRET) || IS_SET(pexit->exit_info, EX_HIDDEN))&& !IS_AFFECTED(ch,AFF_DETECT_HIDDEN) ) )
                {
                    door = iter;
                    break;
                }
            }
        }
        if ( door < 0 || in_room->exit[door] == NULL )
        {
            send_to_char("W ktorym kierunku chcesz siê rozejrzeæ?\n\r", ch);
            return;
        }
        lookdoor = door;
        door = -1;
    }
    if ( lookdoor < 0 )
    {
        if ( IS_NPC( ch ) || !ch->pcdata->mind_in )
        {
            act("$n rozgl±da siê dooko³a.", ch, NULL, NULL, TO_ROOM);
        }
        send_to_char("Rozgl±daj±c siê dooko³a widzisz:\n\r", ch);
        sprintf( buf, "{CTutaj{x\n\r" );
        mob_count = 0;
        mob_count_new = scan_room (ch, in_room, buf, 0);
        if ( mob_count_new < 0 )
        {
            send_to_char( "{CTutaj{x{c - nieprzenikniona ciemno¶æ.{x\n\r", ch );
            darkness = TRUE;
        }
        else
        {
            mob_count += mob_count_new;
        }
        strcat(buf, "{x");
        if ( mob_count > 0 )
        {
            send_to_char ( buf, ch );
        }
        else
        {
            if ( mob_count == 0 && !darkness)
            {
                send_to_char( "{CTutaj{x{c - nikogo nie ma.{x\n\r", ch );
            }
        }
    }
    darkness = FALSE;

    if ( !IS_NPC( ch ) && !EXT_IS_SET( ch->act, PLR_HOLYLIGHT ) )
    {
        if ( room_is_dark(ch, in_room) && !IS_AFFECTED(ch, AFF_INFRARED) )
        {
            send_to_char("Jest tutaj zbyt ciemno aby powiedzieæ co¶ o okolicy.\n\r", ch);
            return;
        }
    }
    for ( door = 0; door < MAX_DIR; door++ )
    {
        room = in_room;
        if ( lookdoor >= 0 && door != lookdoor )
        {
            continue;
        }
        if ( ( pexit = room->exit[door] ) == NULL )
        {
            continue;
        }
        if ( lookdoor >= 0 || !( ( IS_SET(pexit->exit_info, EX_SECRET) && !IS_SET(pexit->exit_info, EX_HIDDEN) ) || ( IS_SET(pexit->exit_info, EX_HIDDEN) && !IS_AFFECTED(ch,AFF_DETECT_HIDDEN) ) ) )
        {
            if ( pexit )
            {
                if ( pexit->vName && pexit->vName[0] != '\0' )
                {
                    sprintf( exitname, "%s", pexit->vName );
                }
                else
                {
                    if ( IS_AFFECTED( ch, AFF_MAZE ) )
                    {
                        sprintf ( exitname, "%s", capitalize( dir_long_name[ number_range( 0, 5 ) ] ) );
                    }
                    else
                    {
                        sprintf( exitname, "%s", capitalize( dir_name[door] ) );
                    }
                }
            }
            else
            {
                exitname[0] = '\0';
            }
            if ( !room_is_dark( ch, in_room ) )
            {
                if ( IS_SET( pexit->exit_info, EX_HIDDEN ) )
                {
                    sprintf( buf, "{C%s{x{c - kto¶ stara³ siê ukryæ to przej¶cie.{x\n\r", exitname );
                    send_to_char( buf, ch );
                    continue;
                }
                else if ( IS_SET( pexit->exit_info, EX_CLOSED ) && !IS_AFFECTED(ch, AFF_PIERCING_SIGHT) )
                {
                    if ( pexit->biernik != NULL && pexit->biernik[ 0 ] != '\0' && pexit->biernik[ 0 ] != ' ' )
                    {
                        if( !pexit->liczba_mnoga )
                        {
                            sprintf( buf, "{C%s{x{c - nic nie widzisz przez zamkniêt± %s.{x\n\r", exitname, pexit->biernik );
                        }
                        else
                        {
                            sprintf( buf, "{C%s{x{c - nic nie widzisz przez zamkniête %s.{x\n\r", exitname, pexit->biernik );
                        }
                        send_to_char( buf, ch );
                    }
                    else
                    {
                        sprintf( buf, "{C%s{x{c - nic nie widzisz przez zamkniête drzwi.{x\n\r", exitname );
                        send_to_char( buf, ch );
                    }
                    continue;
                }
                else if ( IS_SET( pexit->exit_info, EX_WALL_OF_MIST ) && !IS_AFFECTED(ch, AFF_PIERCING_SIGHT) )
                {
                    sprintf( buf, "{C%s{x{c - ¶ciana mg³y zas³ania ci widoczno¶æ.{x\n\r", exitname );
                    send_to_char( buf, ch );
                    continue;
                }
            }

            buf[0] = '\0';
            mob_count = 0;
            max_dist = (lookdoor < 0)? 2:4;

            /**
             * imorovmen range for elfs
             * http://forum.mud.pl/viewtopic.php?t=5457
             */
            if(!str_cmp( race_table[ GET_RACE(ch) ].name, "elf" ))
            {
                max_dist += number_range(0, 2);
            }
            for ( distance = 1 ; distance < max_dist; distance++ )
            {
                pexit = room->exit[door];
                if ( !pexit || !pexit->u1.to_room || ( IS_SET( pexit->exit_info, EX_CLOSED ) && !IS_AFFECTED(ch, AFF_PIERCING_SIGHT) ) || ( IS_SET( pexit->exit_info, EX_WALL_OF_MIST ) && !IS_AFFECTED(ch, AFF_PIERCING_SIGHT) ))
                {
                    break;
                }
                darkness = FALSE;
                mob_count_new = scan_room ( ch, pexit->u1.to_room, buf, distance);
                if (  mob_count_new < 0)
                {
                    printf_to_char( ch, "{C%s{x{c - panuje tam nieprzenikniona ciemno¶æ.{x\n\r", exitname );
                    darkness = TRUE;
                }
                else
                {
                    mob_count += mob_count_new;
                }

                room = pexit->u1.to_room;
            }
            strcat(buf, "{x");

            if ( mob_count > 0 && !darkness )
            {
                if ( room_is_dark( ch, in_room ) )
                {
                    printf_to_char( ch, "{C%s{x{c - widaæ tam chyba kogo¶.{x\n\r", exitname );
                }
                else
                {
                    print_char( ch, "{C%s{x\n\r", exitname );
                    send_to_char ( buf, ch );
                }
            }
            else if ( !room_is_dark( ch, in_room ) && !darkness )
            {
                if ( mob_count == 0 && in_room->exit[door])
                {
                    printf_to_char( ch, "{C%s{x{c - nikogo tam nie widaæ.{x\n\r", exitname );
                }
            }
            darkness = FALSE;
        }
    }

    if ( room_is_dark( ch, in_room ) )
    {
        send_to_char("\n\rJest tutaj zbyt ciemno aby powiedzieæ co¶ dok³adniej o okolicy.\n\r", ch);
        return;
    }
    return;
}
Example #14
0
void do_herb( CHAR_DATA *ch, char *argument )
{
HERB_IN_ROOM_DATA *temp;
    sh_int skill
		, herb_diff //trudnosc ziola
		, skill_roll;
    char arg1 [MAX_INPUT_LENGTH];
	bool find = FALSE,notfinded = FALSE;

    if ( IS_NPC( ch ) )
    return;


    argument = one_argument( argument, arg1 );


        if ( !ch->in_room )
        return;

		if ( ( skill = get_skill( ch, gsn_herbs_knowledge ) ) <= 0 )
		{
			send_to_char( "Huh?\n\r", ch );
			return;
		}

		if(room_is_dark(ch, ch->in_room ))
		{
			send_to_char( "Ciemno¶æ widze, ciemno¶æ!!!.\n\r", ch );
			return;
		}

		if ( ch->mount )
		{
			send_to_char( "Twój wierzchowiec w milczeniu zaczyna wcinaæ jakie¶ zielsko.\n\r", ch );
			return;
		}

		//przeszukiwanie rooma kosztuje troche mova
		if ( ch->move <= 0 )
		{
			act( "Jeste¶ zbyt zmêczon<&y/a/e> by szukaæ zió³.", ch, NULL, NULL, TO_CHAR );
			return;
		}
		ch->move -= 1;//zjadamy move... Drake: -4 mv? Jeszcze powiedzmy przy bieganiu po lesie?
                    //                       Czyli co, szukanie zió³ bardziej mêczy od pracy w kopalni?! =.=
		if ( ch->move < 0 )
		{
			ch->move = 0;
		}

		//Brak zió³ w ROOMIE
		if( !(temp = ch->in_room->first_herb)){
			 act( "Badasz najbli¿sz± okolicê w poszukiwaniu jakich¶ zió³ ale nic nie znajdujesz.",
                 ch, NULL, NULL, TO_CHAR );
            act( "$n bada najbli¿sz± okolicê w poszukiwaniu jakich¶ zió³ ale nic nie znajduje.",
                 ch, NULL, NULL, TO_ROOM );

			return;
		}//koniec nie ma zió³


		//lecimy po li¶cie zió³
		// teraz mamy:
		skill = get_skill( ch, gsn_herbs_knowledge ); //skill gracz

		for(temp = ch->in_room->first_herb;temp;temp = temp->next)
	    {
				herb_diff = herb_table[temp->herb].difficult; //trudnosc znalezienia ziola
				if(temp->herb_status > 1) continue; //znaczy ze juz zerwane lub proba byla
				//jesli tutaj to sprawdzamy czy uda sie zebrac
				if(skill >= herb_diff)//proba zerwania
				{
					//skill_roll = number_range(1, 100);
					skill_roll = number_range(1, 100-herb_diff);
					find = TRUE;

					if ( FALSE ||  !str_cmp( ch->name, "Agron" ))
						{
      					print_char( ch, "\n\rRzut na skill:%d + trudnosc %d  >  skill = %d.\n\r",skill_roll,herb_diff,skill  );
						}
					if (skill_roll+herb_diff > skill ) //nie udany rzut na skill,  po prostu koles chujowy skill ma
					{


						temp->herb_status = 3;
						if(notfinded == FALSE){
							switch(number_range(1,2)){
							case 1:
								{
								act( "Znajdujesz i probujesz zebraæ znalezione zio³o, ale w ostatniej chwili rozpada siê ono na nieu¿yteczne kawa³eczki.",ch, NULL, NULL, TO_CHAR );
								act( "$n znajduje co¶ jednak w ostatniej chwili za³amuje rêce i rozsypuje dooko³a nieu¿yteczne szcz±tki.",ch, NULL, NULL, TO_ROOM );
								break;
								}
							case 2:
								{
								act( "Bez problemu odnajdujesz i szybkim ruchem starasz siê zebraæ zio³o, jednak ³apiesz w z³ym miejscu i rozrywasz je na kilka bezwarto¶ciowych czê¶ci.",ch, NULL, NULL, TO_CHAR );
								act( "$n bez problemu odnajduje i zrywa jak±¶ ro¶linê, ta jednak rozpada siê w jego rêkach.",ch, NULL, NULL, TO_ROOM );
								break;
								}

							}
							notfinded = TRUE;
						}
						WAIT_STATE( ch, 4 );
						continue;
					}
					else // zrywamy!
					{
						herb_to_char(ch,temp);
						temp->herb_status = 2;
						WAIT_STATE( ch, 4 );

					}

				}
				else continue;


		}

/*
                obj = create_object( pHerb->herb, FALSE );
                act( "Badasz najbli¿sz± okolicê w poszukiwaniu jakich¶ zió³ i po chwili natrafiasz na $h.",
                     ch, obj, NULL, TO_CHAR );
                act( "$n bada najbli¿sz± okolicê w poszukiwaniu jakich¶ zió³ i po chwili natrafia na co¶.",
                     ch, obj, NULL, TO_ROOM );
                obj_to_char( obj, ch );
  */
		WAIT_STATE( ch, 24 );
       if (!find)//czyli na koniec jesli przelecialo liste i nic nie zostalo znalezione
       {
            act( "Badasz najbli¿sz± okolicê w poszukiwaniu jakich¶ zió³ ale nic nie znajdujesz.",
                 ch, NULL, NULL, TO_CHAR );
            act( "$n bada najbli¿sz± okolicê w poszukiwaniu jakich¶ zió³ ale nic nie znajduje.",
                 ch, NULL, NULL, TO_ROOM );

			return;
		}
	//cos znalazl ale nie zebral
	if(notfinded) check_improve( ch, NULL, gsn_herbs_knowledge, FALSE, 12 );
    //tu skill jesli sie udalo, wieksza szansa na nauczenie
    else check_improve( ch, NULL, gsn_herbs_knowledge, TRUE, 10 );

    return;
}