示例#1
0
SPEC_RET spec_janitor( CHAR_DATA *ch )
{
	OBJ_DATA *trash;
	OBJ_DATA *trash_next;

	if ( !is_awake(ch) )
		return FALSE;

	for ( trash = ch->in_room->first_content;  trash;  trash = trash_next )
	{
		trash_next = trash->next_content;

		if ( !HAS_BIT(trash->wear_flags, OBJWEAR_TAKE) )	continue;
		if ( HAS_BIT(trash->extra_flags, OBJFLAG_BURIED) )	continue;

		if ( trash->type == OBJTYPE_DRINK_CON
		  || trash->type == OBJTYPE_TRASH
		  || trash->cost < 10
		  || (trash->pObjProto->vnum == VNUM_OBJ_SHOPPING_BAG && !trash->first_content) )
		{
			act( AT_ACTION, "$n raccoglie della spazzatura.", ch, NULL, NULL, TO_ROOM );
			obj_from_room( trash );
			obj_to_char( trash, ch );
			return TRUE;
		}
	}

	return FALSE;
}
示例#2
0
SPEC_RET spec_fido( CHAR_DATA *ch )
{
	OBJ_DATA *corpse;
	OBJ_DATA *c_next;
	OBJ_DATA *obj;
	OBJ_DATA *obj_next;

	if ( !is_awake(ch) )
		return FALSE;

	for ( corpse = ch->in_room->first_content;  corpse;  corpse = c_next )
	{
		c_next = corpse->next_content;
		if ( corpse->type != OBJTYPE_CORPSE_MOB )
			continue;

		act( AT_ACTION, "$n divora selvaggiamente un cadavere.", ch, NULL, NULL, TO_ROOM );

		for ( obj = corpse->first_content;  obj;  obj = obj_next )
		{
			obj_next = obj->next_content;
			obj_from_obj( obj );
			obj_to_room( obj, ch->in_room );
		}

		free_object( corpse );
		return TRUE;
	}

	return FALSE;
}
示例#3
0
SPEC_RET spec_executioner( CHAR_DATA *ch )
{
	MOB_PROTO_DATA *cityguard;
	CHAR_DATA	   *victim;
	CHAR_DATA	   *v_next;
	char		   *crime;
	char			buf[MSL];

	if ( !is_awake(ch) )	return FALSE;
	if ( ch->fighting )		return FALSE;

	crime = "";
	for ( victim = ch->in_room->first_person;  victim;  victim = v_next )
	{
		v_next = victim->next_in_room;

		if ( IS_PG(victim) && HAS_BIT_PLR(victim, PLAYER_KILLER) )
		{
			crime = "assassino";
			break;
		}

		if ( IS_PG(victim) && HAS_BIT_PLR(victim, PLAYER_THIEF) )
		{
			crime = "ladro";
			break;
		}
	}

	if ( !victim )
		return FALSE;

	if ( HAS_BIT(ch->in_room->flags, ROOM_SAFE) )
	{
		sprintf( buf, "yell codardo di un %s!", crime );	/* (GR) articolo */
		send_command( ch, buf, CO );
		return TRUE;
	}

	sprintf( buf, "yell Proteggiamo l'innocente dal %s!!", crime );	/* (GR) articolo dal dall' */
	send_command( ch, buf, CO );
	multi_hit( ch, victim, TYPE_UNDEFINED );

	if ( char_died(ch) )
		return TRUE;

	/* Aggiunto il log nel caso che venga a mancare la guardia cittadina */
	cityguard = get_mob_index( NULL, VNUM_MOB_CITYGUARD );

	if ( !cityguard )
	{
		send_log( NULL, LOG_BUG, "spec_executioner: Guardia cittadina mancante - Vnum:[%d]", VNUM_MOB_CITYGUARD );
		return TRUE;
	}

	char_to_room( make_mobile(cityguard), ch->in_room );
	char_to_room( make_mobile(cityguard), ch->in_room );
	return TRUE;
}
示例#4
0
void
ToolSlave::tick()
{
    switch (_masterState) {
    case kMSDisabled:
        // master is disabled, do nothing
        break;

    case kMSWaiting:

        // if the bus is idle, become the master
        if (!is_awake()) {
            _masterState = kMSRequest;
            _lastFrameStart.update();
        }

        break;

    case kMSRequest:
    case kMSResponse:

        // if we haven't been re-armed for a while, drop out of master mode
        if (_masterTimeout.is_older_than(1000U)) {
            _masterState = kMSDisabled;
            // kill any in-flight transaction that might otherwise wedge; we can't
            // complete it now
            _state = kStateIdle;
            break;
        }

        // if we haven't reached the start of the next frame time, do nothing
        if (!_lastFrameStart.is_older_than(10)) {
            break;
        }

        // remember when we sent the next header
        _lastFrameStart.update();

        if (_masterState == kMSRequest) {
            // Don't waste time with slave response frames unless we are doing something
            // that needs them.
            if (_state >= kStateGetData) {
                _masterState = kMSResponse;
            }

            mt_send_header(kFrameIDMasterRequest);

        } else {
            _masterState = kMSRequest;
            mt_send_header(kFrameIDSlaveResponse);
        }

        break;
    }

    Slave::tick();
}
示例#5
0
SPEC_RET spec_thief( CHAR_DATA *ch )
{
	CHAR_DATA *victim;
	CHAR_DATA *v_next;
	int		   gold;
	int		   maxgold;

	if ( ch->position != POSITION_STAND )
		return FALSE;

	for ( victim = ch->in_room->first_person;  victim;  victim = v_next )
	{
		v_next = victim->next_in_room;

		if ( IS_MOB(victim) )			continue;
		if ( IS_ADMIN(victim) )			continue;
		if ( number_bits(2) != 0 )		continue;
		if ( !can_see(ch, victim) )		continue;

		if ( is_awake(victim) && number_range(0, get_level(ch)/2) == 0 )
		{
			act( AT_ACTION, "$n mi sta derubando! Dannato ladro!",
				ch, NULL, victim, TO_VICT	 );
			if ( get_curr_sense(ch, SENSE_SIXTH) > 75 )
			{
				act( AT_ACTION, "Mi accorgo che $n sta frugando nel suo sacco di monete di $N!",
					ch, NULL, victim, TO_NOVICT );
			}
		}
		else
		{
			maxgold = get_level(ch)/2 * get_level(ch)/2 * 1000;
			gold = victim->gold * number_range( 1, URANGE(2, get_level(ch)/8, 10) ) / 100;
			ch->gold += 9 * gold / 10;
			victim->gold -= gold;

			if ( ch->gold > maxgold )
			{
				boost_economy( ch->in_room->area, ch->gold - maxgold/2 );
				ch->gold = maxgold/2;
			}
		}
		return TRUE;
	} /* chiude il for */

	return FALSE;
}
示例#6
0
SPEC_RET spec_guard( CHAR_DATA *ch )
{
	CHAR_DATA	*victim;
	CHAR_DATA	*v_next;
	CHAR_DATA	*ech;
	char		*crime;
	char		 buf[MSL];
	int			 max_evil;

	if ( !is_awake(ch) )	return FALSE;
	if ( ch->fighting )		return FALSE;

	max_evil = 300;
	ech		 = NULL;
	crime	 = "";

	for ( victim = ch->in_room->first_person;  victim;  victim = v_next )
	{
		v_next = victim->next_in_room;

		if ( !victim->fighting )			continue;
		if ( who_fighting(victim) == ch )	continue;

		if ( IS_PG(victim) && HAS_BIT_PLR(victim, PLAYER_KILLER) )
		{
			crime = "assassino";
			break;
		}

		if ( IS_PG(victim) && HAS_BIT_PLR(victim, PLAYER_THIEF) )
		{
			crime = "ladro";
			break;
		}

		if ( victim->alignment < max_evil )
		{
			max_evil = victim->alignment;
			ech	  = victim;
		}
	}

	if ( victim && HAS_BIT(ch->in_room->flags, ROOM_SAFE) )
	{
		sprintf( buf, "yell codardo di un %s!", crime );	/* (GR) articolo */
		send_command( ch, buf, CO );
		return TRUE;
	}

	if ( victim )
	{
		sprintf( buf, "yell Proteggiamo l'innocente dal %s!!", crime );	/* (GR) articolo dal dall' */
		send_command( ch, buf, CO );
		multi_hit( ch, victim, TYPE_UNDEFINED );
		return TRUE;
	}

	if ( ech )
	{
		act( AT_YELL, "$n urla 'Proteggiamo l'innocente!'", ch, NULL, NULL, TO_ROOM );
		multi_hit( ch, ech, TYPE_UNDEFINED );
		return TRUE;
	}

	return FALSE;
}
示例#7
0
/*
 * Procedure speciali per i Mob
 */
SPEC_RET spec_cast_adept( CHAR_DATA *ch )
{
	CHAR_DATA *victim;
	CHAR_DATA *v_next;

	if ( !is_awake(ch) )	return FALSE;
	if ( ch->fighting )		return FALSE;

	for ( victim = ch->in_room->first_person;  victim;  victim = v_next )
	{
		v_next = victim->next_in_room;

		if ( victim == ch )				continue;
		if ( !can_see(ch, victim) )		continue;

		if ( number_bits(1) == 0 )
			break;
	}

	if ( !victim )
		return FALSE;

	switch ( number_bits(4) )
	{
	  case 0:
		act( AT_MAGIC, "$n pronuncia la parola 'ciroht'.", ch, NULL, NULL, TO_ROOM );
		spell_smaug( skill_lookup("armor"), get_level(ch)/2, ch, victim );
		return TRUE;

	  case 1:
		act( AT_MAGIC, "$n pronuncia la parola 'sunimod'.", ch, NULL, NULL, TO_ROOM );
		spell_smaug( skill_lookup("bless"), get_level(ch)/2, ch, victim );
		return TRUE;

	  case 2:
		act( AT_MAGIC, "$n pronuncia la parola 'suah'.", ch, NULL, NULL, TO_ROOM );
		spell_cure_blindness( skill_lookup("cure blindness"), get_level(ch)/2, ch, victim );
		return TRUE;

	  case 3:
		act( AT_MAGIC, "$n pronuncia la parola 'nran'.", ch, NULL, NULL, TO_ROOM );
		spell_smaug( skill_lookup("cure light"), get_level(ch)/2, ch, victim );
		return TRUE;

	  case 4:
		act( AT_MAGIC, "$n pronuncia la parola 'nyrcs'.", ch, NULL, NULL, TO_ROOM );
		spell_cure_poison( skill_lookup("cure poison"), get_level(ch)/2, ch, victim );
		return TRUE;

	  case 5:
		act( AT_MAGIC, "$n pronuncia la parola 'gartla'.", ch, NULL, NULL, TO_ROOM );
		spell_smaug( skill_lookup("refresh"), get_level(ch)/2, ch, victim );
		return TRUE;

	  case 6:
		act( AT_MAGIC, "$n pronuncia la parola 'naimad'.", ch, NULL, NULL, TO_ROOM );
		spell_smaug( skill_lookup("cure serious"), get_level(ch)/2, ch, victim );
		return TRUE;

	  case 7:
		act( AT_MAGIC, "$n pronuncia la parola 'gorog'.", ch, NULL, NULL, TO_ROOM );
		spell_remove_curse( skill_lookup("remove curse"), get_level(ch)/2, ch, victim );
		return TRUE;
	}

	return FALSE;
}
示例#8
0
/*
 * Update the time
 */
void update_calendar( void )
{
	calendar.hour++;

	if ( calendar.hour == HOUR_MIDNIGHT )
	{
		DESCRIPTOR_DATA *d;

		calendar.hour = 0;
		calendar.day++;

		if ( calendar.day >= DAYS_IN_MONTH )
		{
			calendar.day = 0;
			calendar.month++;
	
			if ( calendar.month >= MONTHS_IN_YEAR )
			{
				calendar.month = 0;
				calendar.year++;
			}
		}

		for ( d = first_descriptor;  d;  d = d->next )
		{
			ANNIVERSARY_DATA *anniversary;

			bool msend = FALSE;	/* Indica se ha inviato un messaggio al pg evitando di visualizzare il cielo */

			if ( d->connected != CON_PLAYING )	continue;
			if ( !d->character->in_room )		continue;

			for ( anniversary = first_anniversary;  anniversary;  anniversary = anniversary->next )
			{
				if ( anniversary->month != calendar.month )		continue;
				if ( anniversary->day != calendar.day )			continue;

				if ( HAS_BIT(anniversary->races, d->character->race) )
					ch_printf( d->character, "%s\r\n", anniversary->message );
			}

			if ( calendar.day == 0 )
			{
				if ( calendar.month == 0 )
				{
					set_char_color( AT_GREEN, d->character );
					send_to_char( d->character, "Oggi è il primo dell'anno!\r\n" );
				}
				else
				{
					set_char_color( AT_DGREEN, d->character );
					ch_printf( d->character, "Oggi è il primo giorno del mese %s\r\n", month_name[calendar.month] );
				}
				msend = TRUE;
			}

			if ( !is_outside(d->character) )	continue;
			if ( !is_awake(d->character) )		continue;
#ifdef T2_MSP
			send_audio( d, "midnight.wav", TO_CHAR );
#endif
			if ( !msend && d->character->in_room->area && d->character->in_room->area->weather )
			{
				int precip;

				precip = ( d->character->in_room->area->weather->precip + (meteo.weath_unit*3) - 1 ) / meteo.weath_unit;
				if ( precip <= 1 )
					send_command( d->character, "sky", CO );
			}
		}
	}

	/* Invia l'echo sulla base dell'ora trascorsa e del weather dell'area */
	send_time_echo( );

	/* Salva il calendario ogni ora-mud */
	save_calendar( );
}
示例#9
0
/*
 * Get echo messages according to time changes...
 * some echoes depend upon the weather so an echo must be
 * found for each area
 */
void send_time_echo( void )
{
	AREA_DATA		*pArea;
	DESCRIPTOR_DATA *d;

	for ( pArea = first_area;  pArea;  pArea = pArea->next )
	{
		char			 echo[MSL];
		int				 color = AT_GREY;
		int				 n;
		int				 pindex;

		if ( !pArea->weather )
			continue;

		echo[0] = '\0';
		n = number_bits( 2 );
		pindex = ( pArea->weather->precip + (meteo.weath_unit*3) - 1 ) / meteo.weath_unit;
	
		switch ( calendar.hour )
		{
		  case HOUR_SUNRISE-1:
		  {
			char *echo_strings[4] =
			{
				"Comincia un nuovo giorno.\r\n",
				"E' un nuovo giorno.\r\n",
				"Il cielo lentamente si rischiara, nell'alba di un nuovo giorno.\r\n",
				"S'affaccia adagio il sole, al giorno appena nato.\r\n"
			};
			calendar.sunlight = SUN_RISE;
			strcpy( echo, echo_strings[n] );
			color = AT_YELLOW;
			break;
		  }

		  case HOUR_SUNRISE:
		  {
			char *echo_strings[4] =
			{
				"Il sole nasce di raggi tiepidi, sorgendo ad est..\r\n",
				"L'Oriente si rischiara: il sole sta sorgendo.\r\n",
				"Un sole fosco alza lo sguardo sul piatto dell'orizzonte..\r\n",
				"Un giorno nuovo saluta il mondo all'ascesa di un pallido sole..\r\n"
			};
			calendar.sunlight = SUN_LIGHT;
			strcpy( echo, echo_strings[n] );
			color = AT_ORANGE;
			break;
		  }

		  case HOUR_NOON:
		  {
			if ( pindex > 0 )
				strcpy( echo, "E' mezzogiorno.\r\n" );
			else
			{
				char *echo_strings[2] =
				{
					"Il sole è alto nel cielo, l'intensità del suo diadema infuocato annuncia il mezzogiorno di luce..\r\n",
					"La luce del sole è vigorosa, nel cielo disegna un bagliore acceso: è mezzogiorno.\r\n"
				};
				strcpy( echo, echo_strings[n%2] );
			}
			calendar.sunlight = SUN_LIGHT;
			color  = AT_WHITE;
			break;
		  }
	
		  case HOUR_SUNSET:
		  {
			char *echo_strings[4] =
			{
				"L'occidente riluce dell'abbraccio infuocato del sole che tramonta..\r\n",
				"L'orizzonte è tagliato dalla corona rossa del sole in tramonto..\r\n",
				"Il cielo si dipinge d'oro rosso brillante, il sole ruotando adagio tramonta oltre lo sguardo.. \r\n",
				"Il sole finisce il suo viaggio portando i raggi splendenti nel sonno del tramonto..\r\n"
			};
	
			calendar.sunlight = SUN_SET;
			strcpy( echo, echo_strings[n] );
			color = AT_RED;

			break;
		  }
	
		  case HOUR_SUNSET+1:
		  {
			if ( pindex > 0 )
			{
				char *echo_strings[2] =
				{
					"Cala la sera.\r\n",
					"Avanza lento il crepuscolo..\r\n"
				};
				strcpy( echo, echo_strings[n%2] );
			}
			else
			{
				char *echo_strings[2] =
				{
					"Il chiarore gentile della luna si diffonde attraverso il cielo, annunciando la sera..\r\n",
					"Mille punti di luci tenui occhieggiano nel cielo serale, contornando una pallida luna..\r\n"
				};
				strcpy( echo, echo_strings[n%2] );
			}
			calendar.sunlight = SUN_DARK;
			color = AT_BLUE;
			break;
		  }
		} /* chiude lo switch su calendar.hour */

		for ( d = first_descriptor;  d;  d = d->next )
		{
			if ( d->connected != CON_PLAYING )			continue;
			if ( !is_outside(d->character) )			continue;
			if ( !is_awake(d->character) )				continue;
			if ( !d->character->in_room )				continue;
			if ( d->character->in_room->area != pArea )	continue;

			/* Se è stato creato un'echo viene inviato */
			if ( VALID_STR(echo) )
			{
				set_char_color( color, d->character );
				send_to_char( d->character, echo );
			}
#ifdef T2_MSP
			/* Invia i suoni */
			if ( calendar.hour == HOUR_SUNSET )
				send_audio( d, "sunset.wav", TO_CHAR );
#endif
		}	/* ciclo for dei descrittori */
	}	/* ciclo for delle aree */
}