Пример #1
0
void GetMonth( int month)
{
   if (month < 0)
      return;

   if (month <= 1)
       send_to_outdoor(" It is bitterly cold outside\n");
   else if (month <=2)
       send_to_outdoor(" It is very cold \n");
   else if (month <=4)
       send_to_outdoor(" It is chilly outside \n");
   else if (month <= 5)
        send_to_outdoor(" The flowers start to bloom \n");
   else if (month <= 11)
        send_to_outdoor(" It is warm and humid. \n");
   else if (month <= 12)
        send_to_outdoor(" It starts to get a little windy \n");
   else if (month <= 13)
        send_to_outdoor(" The air is getting chilly \n"); 
   else if (month <= 14)
        send_to_outdoor(" The leaves start to change colors. \n");
   else if (month <= 15)
        send_to_outdoor(" It starts to get cold \n");
   else if (month <= 16)
        send_to_outdoor(" It is bitterly cold outside \n");

}
Пример #2
0
/** Increment the game time by one hour (no matter what) and display any time 
 * dependent messages via send_to_outdoors() (if parameter is non-zero).
 * @param mode Really, this parameter has the effect of a boolean. If non-zero,
 * display day/night messages to all eligible players.
 */
static void another_hour(int mode)
{
  time_info.hours++;

  if (mode) {
    switch (time_info.hours) {
    case 5:
      weather_info.sunlight = SUN_RISE;
      send_to_outdoor("The sun rises in the east.\r\n");
      break;
    case 6:
      weather_info.sunlight = SUN_LIGHT;
      send_to_outdoor("The day has begun.\r\n");
      break;
    case 21:
      weather_info.sunlight = SUN_SET;
      send_to_outdoor("The sun slowly disappears in the west.\r\n");
      break;
    case 22:
      weather_info.sunlight = SUN_DARK;
      send_to_outdoor("The night has begun.\r\n");
      break;
    default:
      break;
    }
  }
  if (time_info.hours > 23) {	/* Changed by HHS due to bug ??? */
    time_info.hours -= 24;
    time_info.day++;

    if (time_info.day > 34) {
      time_info.day = 0;
      time_info.month++;

      if (time_info.month > 16) {
	time_info.month = 0;
	time_info.year++;
      }
    }
  }
}
Пример #3
0
void get_month(int month) {
  if (month < 0)
    return;

  if (month <= 1) {
    send_to_outdoor(" It is bitterly cold outside\n\r");
  }
  else if (month <= 2) {
    send_to_outdoor(" It is very cold \n\r");
  }
  else if (month <= 3) {
    send_to_outdoor(" It is chilly outside \n\r");
  }
  else if (month == 4) {
    send_to_outdoor(" The flowers start to bloom \n\r");
    pulse_mobiles(EVENT_SPRING);
  }
  else if (month == 8) {
    send_to_outdoor(" It is warm and humid. \n\r");
    pulse_mobiles(EVENT_SUMMER);
  }
  else if (month == 12) {
    send_to_outdoor(" It starts to get a little windy \n\r");
    pulse_mobiles(EVENT_FALL);
  }
  else if (month == 13) {
    send_to_outdoor(" The air is getting chilly \n\r");
  }
  else if (month == 14) {
    send_to_outdoor(" The leaves start to change colors. \n\r");
  }
  else if (month == 15) {
    send_to_outdoor(" It starts to get cold \n\r");
  }
  else if (month == 16) {
    send_to_outdoor(" It is bitterly cold outside \n\r");
    pulse_mobiles(EVENT_WINTER);
  }
}
Пример #4
0
void another_hour(int mode)
{
  char moon[20], buf[100];

	time_info.hours++;

	if (mode) {
		switch (time_info.hours) {
	         	case 3 :
                          {
			    send_to_outdoor("The moon sets.\n");
                            break;
			  }
			case 5 :
			{
				weather_info.sunlight = SUN_RISE;
				send_to_outdoor("The sun rises in the east.\n");
				break;
			}
			case 7 :
			{
				weather_info.sunlight = SUN_LIGHT;
				send_to_outdoor("The day has begun.\n");
				break;	
			}
  		        case 12 :
			  {
                                send_to_outdoor("It is noon.\n");
				break;
			  }
			case 18 :
			{
				weather_info.sunlight = SUN_SET;
				send_to_outdoor(
				"The sun slowly disappears in the west.\n");
				break;
			}
			case 20 :
			{
				weather_info.sunlight = SUN_DARK;
				send_to_outdoor("The night has begun.\n");
				break;
			}
		        case 22 :
			  {
                            if (moontype < 4) {
                               strcpy(moon, "new");
                             } else if (moontype < 12) {
                               strcpy(moon, "waxing");
                             } else if (moontype < 20) {
                               strcpy(moon, "full");
                             } else  if (moontype < 28) {
                               strcpy(moon, "waning");
                             } else {
                               strcpy(moon, "new");
                             }
                             sprintf(buf,"The %s moon rises in the east\n",moon);
                             send_to_outdoor(buf);
                             break;
			  }
			default : break;
		}
	}

	if (time_info.hours > 23)  /* Changed by HHS due to bug ???*/
	{
		time_info.hours -= 24;
		time_info.day++;
                moontype++;
                if (moontype > 32)
                   moontype = 1;

		if (time_info.day>34)		{
			time_info.day = 0;
			time_info.month++;
                        GetMonth(time_info.month);

			if(time_info.month>16)	       	{
				time_info.month = 0;
				time_info.year++;
			}
		}
	}
}
Пример #5
0
void ChangeWeather( int change)
{

   if (change < 0)
      change = 0;
   if (change > 7)
      change = 6;

	switch(change){
		case 0 : break;
		case 1 :
		{
			send_to_outdoor("The sky is getting cloudy.\n");
			weather_info.sky=SKY_CLOUDY;
			break;
		}
		case 2 :
		{
                        if ((time_info.month > 3) && (time_info.month < 14)) 
			   send_to_outdoor("It starts to rain.\n");
                        else 
                           send_to_outdoor("It starts to snow. \n");
			weather_info.sky=SKY_RAINING;
			break;
		}
		case 3 :
		{
			send_to_outdoor("The clouds disappear.\n");
			weather_info.sky=SKY_CLOUDLESS;
			break;
		}
		case 4 :
		{
                        if ((time_info.month > 3) && (time_info.month < 14)) 
			   send_to_outdoor("You are caught in lightning storm.\n");
                        else 
                           send_to_outdoor("You are caught in a blizzard. \n");
			weather_info.sky=SKY_LIGHTNING;
			break;
		}
		case 5 :
		{
                        if ((time_info.month > 3) && (time_info.month < 14)) 
			   send_to_outdoor("The rain has stopped.\n");
                        else 
                           send_to_outdoor("The snow has stopped. \n");
			weather_info.sky=SKY_CLOUDY;
			break;
		}
		case 6 :
		{
                        if ((time_info.month > 3) && (time_info.month < 14)) 
			   send_to_outdoor("The lightning has gone, but it is still raining.\n");
                        else 
                           send_to_outdoor("The blizzard is over, but it is still snowing.\n");
			weather_info.sky=SKY_RAINING;
			break;
		}
		default : break;
	}
}
Пример #6
0
void weather_change(void)
{
	int diff = 0, sky_change, temp_change, i,
			   grainlevel = 0, gsnowlevel = 0, icelevel = 0, snowdec = 0,
											raincast = 0, snowcast = 0, avg_day_temp, avg_week_temp, cweather_type = 0, temp;

	weather_info.hours_go++;
	if (weather_info.hours_go > HOURS_PER_DAY)
	{
		weather_info.press_last_day = weather_info.press_last_day * (HOURS_PER_DAY - 1) / HOURS_PER_DAY;
		weather_info.temp_last_day = weather_info.temp_last_day * (HOURS_PER_DAY - 1) / HOURS_PER_DAY;
	}
	// Average pressure and temperature per 24 hours
	weather_info.press_last_day += weather_info.pressure;
	weather_info.temp_last_day += weather_info.temperature;
	if (weather_info.hours_go > (DAYS_PER_WEEK * HOURS_PER_DAY))
	{
		weather_info.press_last_week =
			weather_info.press_last_week * (DAYS_PER_WEEK * HOURS_PER_DAY -
											1) / (DAYS_PER_WEEK * HOURS_PER_DAY);
		weather_info.temp_last_week =
			weather_info.temp_last_week * (DAYS_PER_WEEK * HOURS_PER_DAY - 1) / (DAYS_PER_WEEK * HOURS_PER_DAY);
	}
	// Average pressure and temperature per week
	weather_info.press_last_week += weather_info.pressure;
	weather_info.temp_last_week += weather_info.temperature;
	avg_day_temp = average_day_temp();
	avg_week_temp = average_week_temp();

	calc_basic(weather_info.weather_type, weather_info.sky, &grainlevel, &gsnowlevel);

	// Ice and show change by temperature
	if (!(time_info.hours % 6) && weather_info.hours_go)
	{
		if (avg_day_temp < -15)
			icelevel += 4;
		else if (avg_day_temp < -10)
			icelevel += 3;
		else if (avg_day_temp < -5)
			icelevel += 2;
		else if (avg_day_temp < -1)
			icelevel += 1;
		else if (avg_day_temp < 1)
		{
			icelevel += 0;
			gsnowlevel -= 1;
			snowdec += 1;
		}
		else if (avg_day_temp < 5)
		{
			icelevel -= 1;
			gsnowlevel -= 2;
			snowdec += 2;
		}
		else if (avg_day_temp < 10)
		{
			icelevel -= 2;
			gsnowlevel -= 3;
			snowdec += 3;
		}
		else
		{
			icelevel -= 3;
			gsnowlevel -= 4;
			snowdec += 4;
		}
	}

	weather_info.icelevel = MAX(0, MIN(100, weather_info.icelevel + icelevel));
	if (gsnowlevel < -1 && weather_info.rainlevel < 20)
		weather_info.rainlevel -= (gsnowlevel / 2);
	weather_info.snowlevel = MAX(0, MIN(120, weather_info.snowlevel + gsnowlevel));
	weather_info.rainlevel = MAX(0, MIN(80, weather_info.rainlevel + grainlevel));


	// Change some values for world
	for (i = FIRST_ROOM; i <= top_of_world; i++)
	{
		raincast = snowcast = 0;
		if (ROOM_FLAGGED(i, ROOM_NOWEATHER))
			continue;
		if (world[i]->weather.duration)
		{
			calc_basic(world[i]->weather.weather_type, world[i]->weather.sky, &raincast, &snowcast);
			snowcast -= snowdec;
		}
		else
		{
			raincast = grainlevel;
			snowcast = gsnowlevel;
		}
		if (world[i]->weather.duration <= 0)
			world[i]->weather.duration = 0;
		else
			world[i]->weather.duration--;

		world[i]->weather.icelevel = MAX(0, MIN(100, world[i]->weather.icelevel + icelevel));
		if (snowcast < -1 && world[i]->weather.rainlevel < 20)
			world[i]->weather.rainlevel -= (snowcast / 2);
		world[i]->weather.snowlevel = MAX(0, MIN(120, world[i]->weather.snowlevel + snowcast));
		world[i]->weather.rainlevel = MAX(0, MIN(80, world[i]->weather.rainlevel + raincast));
	}


	switch (time_info.month)
	{
	case 0:		// Jan
		diff = (weather_info.pressure > 985 ? -2 : 2);
		break;
	case 1:		// Feb
		diff = (weather_info.pressure > 985 ? -2 : 2);
		break;
	case 2:		// Mar
		diff = (weather_info.pressure > 985 ? -2 : 2);
		break;
	case 3:		// Apr
		diff = (weather_info.pressure > 985 ? -2 : 2);
		break;
	case 4:		// May
		diff = (weather_info.pressure > 1015 ? -2 : 2);
		break;
	case 5:		// Jun
		diff = (weather_info.pressure > 1015 ? -2 : 2);
		break;
	case 6:		// Jul
		diff = (weather_info.pressure > 1015 ? -2 : 2);
		break;
	case 7:		// Aug
		diff = (weather_info.pressure > 1015 ? -2 : 2);
		break;
	case 8:		// Sep
		diff = (weather_info.pressure > 1015 ? -2 : 2);
		break;
	case 9:		// Oct
		diff = (weather_info.pressure > 1015 ? -2 : 2);
		break;
	case 10:		// Nov
		diff = (weather_info.pressure > 985 ? -2 : 2);
		break;
	case 11:		// Dec
		diff = (weather_info.pressure > 985 ? -2 : 2);
		break;
	default:
		break;
	}

	// if ((time_info.month >= 9) && (time_info.month <= 16))
	//    diff = (weather_info.pressure > 985 ? -2 : 2);
	// else
	//    diff = (weather_info.pressure > 1015 ? -2 : 2);

	weather_info.change += (dice(1, 4) * diff + dice(2, 6) - dice(2, 6));

	weather_info.change = MIN(weather_info.change, 12);
	weather_info.change = MAX(weather_info.change, -12);

	weather_info.pressure += weather_info.change;

	weather_info.pressure = MIN(weather_info.pressure, 1040);
	weather_info.pressure = MAX(weather_info.pressure, 960);

	if (time_info.month == MONTH_MAY)
		weather_info.season = SEASON_SPRING;
	else if (time_info.month >= MONTH_JUNE && time_info.month <= MONTH_AUGUST)
		weather_info.season = SEASON_SUMMER;
	else if (time_info.month >= MONTH_SEPTEMBER && time_info.month <= MONTH_OCTOBER)
		weather_info.season = SEASON_AUTUMN;
	else if (time_info.month >= MONTH_DECEMBER || time_info.month <= MONTH_FEBRUARY)
		weather_info.season = SEASON_WINTER;


	switch (weather_info.season)
	{
	case SEASON_WINTER:
		if ((time_info.month == MONTH_MART && avg_week_temp > 5
				&& weather_info.snowlevel == 0) || (time_info.month == MONTH_APRIL && weather_info.snowlevel == 0))
			weather_info.season = SEASON_SPRING;
	case SEASON_AUTUMN:
		if (time_info.month == MONTH_NOVEMBER && (avg_week_temp < 2 || weather_info.snowlevel >= 5))
			weather_info.season = SEASON_WINTER;
	}

	sky_change = 0;
	temp_change = 0;

	switch (weather_info.sky)
	{
	case SKY_CLOUDLESS:
		if (weather_info.pressure < 990)
			sky_change = 1;
		else if (weather_info.pressure < 1010)
			if (dice(1, 4) == 1)
				sky_change = 1;
		break;
	case SKY_CLOUDY:
		if (weather_info.pressure < 970)
			sky_change = 2;
		else if (weather_info.pressure < 990)
		{
			if (dice(1, 4) == 1)
				sky_change = 2;
			else
				sky_change = 0;
		}
		else if (weather_info.pressure > 1030)
			if (dice(1, 4) == 1)
				sky_change = 3;

		break;
	case SKY_RAINING:
		if (weather_info.pressure < 970)
		{
			if (dice(1, 4) == 1)
				sky_change = 4;
			else
				sky_change = 0;
		}
		else if (weather_info.pressure > 1030)
			sky_change = 5;
		else if (weather_info.pressure > 1010)
			if (dice(1, 4) == 1)
				sky_change = 5;

		break;
	case SKY_LIGHTNING:
		if (weather_info.pressure > 1010)
			sky_change = 6;
		else if (weather_info.pressure > 990)
			if (dice(1, 4) == 1)
				sky_change = 6;

		break;
	default:
		sky_change = 0;
		weather_info.sky = SKY_CLOUDLESS;
		break;
	}

	switch (sky_change)
	{
	case 1:		// CLOUDLESS -> CLOUDY
		if (time_info.month >= MONTH_MAY && time_info.month <= MONTH_AUGUST)
		{
			if (time_info.hours >= 8 && time_info.hours <= 16)
				temp_change += number(-3, -1);
			else if (time_info.hours >= 5 && time_info.hours <= 20)
				temp_change += number(-1, 0);

		}
		else
			temp_change += number(-2, + 2);
		break;
	case 2:		// CLOUDY -> RAINING
		if (time_info.month >= MONTH_MAY && time_info.month <= MONTH_AUGUST)
			temp_change += number(-1, + 1);
		else
			temp_change += number(-2, + 2);
		break;
	case 3:		// CLOUDY -> CLOUDLESS
		if (time_info.month >= MONTH_MAY && time_info.month <= MONTH_AUGUST)
		{
			if (time_info.hours >= 7 && time_info.hours <= 19)
				temp_change += number( + 1, + 2);
			else
				temp_change += number(0, + 1);
		}
		else
			temp_change += number(-1, + 1);
		break;
	case 4:		// RAINING -> LIGHTNING
		if (time_info.month >= MONTH_MAY && time_info.month <= MONTH_AUGUST)
		{
			if (time_info.hours >= 10 && time_info.hours <= 18)
				temp_change += number( + 1, + 3);
			else
				temp_change += number(0, + 2);
		}
		else
			temp_change += number(-3, + 3);
		break;
	case 5:		// RAINING -> CLOUDY
		if (time_info.month >= MONTH_JUNE && time_info.month <= MONTH_AUGUST)
			temp_change += number(0, + 1);
		else
			temp_change += number(-1, + 1);
		break;
	case 6:		// LIGHTNING -> RAINING
		if (time_info.month >= MONTH_MAY && time_info.month <= MONTH_AUGUST)
		{
			if (time_info.hours >= 10 && time_info.hours <= 17)
				temp_change += number(-3, + 1);
			else
				temp_change += number(-1, + 2);
		}
		else
			temp_change += number( + 1, + 3);
		break;
	case 0:
	default:
		if (dice(1, 4) == 1)
			temp_change += number(-1, + 1);
		break;
	}

	temp_change += day_temp_change[time_info.hours][weather_info.sky];
	if (time_info.day >= 22)
	{
		temp = weather_info.temperature +
			   (time_info.month >= MONTH_DECEMBER ? year_temp[0].med : year_temp[time_info.month + 1].med);
		temp /= 2;
	}
	else if (time_info.day <= 8)
	{
		temp = weather_info.temperature + year_temp[time_info.month].med;
		temp /= 2;
	}
	else
		temp = weather_info.temperature;

	temp += temp_change;
	cweather_type = 0;
	*buf = '\0';
	if (weather_info.temperature - temp > 6)
	{
		strcat(buf, "Резкое похолодание.\r\n");
		SET_BIT(cweather_type, WEATHER_QUICKCOOL);
	}
	else if (weather_info.temperature - temp < -6)
	{
		strcat(buf, "Резкое потепление.\r\n");
		SET_BIT(cweather_type, WEATHER_QUICKHOT);
	}
	weather_info.temperature = MIN(year_temp[time_info.month].max, MAX(year_temp[time_info.month].min, temp));


	if (weather_info.change >= 10 || weather_info.change <= -10)
	{
		strcat(buf, "Сильный ветер.\r\n");
		SET_BIT(cweather_type, WEATHER_BIGWIND);
	}
	else if (weather_info.change >= 6 || weather_info.change <= -6)
	{
		strcat(buf, "Умеренный ветер.\r\n");
		SET_BIT(cweather_type, WEATHER_MEDIUMWIND);
	}
	else if (weather_info.change >= 2 || weather_info.change <= -2)
	{
		strcat(buf, "Слабый ветер.\r\n");
		SET_BIT(cweather_type, WEATHER_LIGHTWIND);
	}
	else if (IS_SET(weather_info.weather_type, WEATHER_BIGWIND | WEATHER_MEDIUMWIND | WEATHER_LIGHTWIND))
	{
		strcat(buf, "Ветер утих.\r\n");
		if (IS_SET(weather_info.weather_type, WEATHER_BIGWIND))
			SET_BIT(cweather_type, WEATHER_MEDIUMWIND);
		else if (IS_SET(weather_info.weather_type, WEATHER_MEDIUMWIND))
			SET_BIT(cweather_type, WEATHER_LIGHTWIND);
	}

	switch (sky_change)
	{
	case 1:		// CLOUDLESS -> CLOUDY
		strcat(buf, "Небо затянуло тучами.\r\n");
		weather_info.sky = SKY_CLOUDY;
		break;
	case 2:		// CLOUDY -> RAINING
		switch (time_info.month)
		{
		case MONTH_MAY:
		case MONTH_JUNE:
		case MONTH_JULY:
		case MONTH_AUGUST:
		case MONTH_SEPTEMBER:
			strcat(buf, "Начался дождь.\r\n");
			create_rainsnow(&cweather_type, WEATHER_LIGHTRAIN, 30, 40, 30);
			break;
		case MONTH_DECEMBER:
		case MONTH_JANUARY:
		case MONTH_FEBRUARY:
			strcat(buf, "Пошел снег.\r\n");
			create_rainsnow(&cweather_type, WEATHER_LIGHTSNOW, 30, 40, 30);
			break;
		case MONTH_OCTOBER:
		case MONTH_APRIL:
			if (IS_SET(cweather_type, WEATHER_QUICKCOOL)
					&& weather_info.temperature <= 5)
			{
				strcat(buf, "Пошел снег.\r\n");
				SET_BIT(cweather_type, WEATHER_LIGHTSNOW);
			}
			else
			{
				strcat(buf, "Начался дождь.\r\n");
				create_rainsnow(&cweather_type, WEATHER_LIGHTRAIN, 40, 60, 0);
			}
			break;
		case MONTH_NOVEMBER:
			if (avg_day_temp <= 3 || IS_SET(cweather_type, WEATHER_QUICKCOOL))
			{
				strcat(buf, "Пошел снег.\r\n");
				create_rainsnow(&cweather_type, WEATHER_LIGHTSNOW, 40, 60, 0);
			}
			else
			{
				strcat(buf, "Начался дождь.\r\n");
				create_rainsnow(&cweather_type, WEATHER_LIGHTRAIN, 40, 60, 0);
			}
			break;
		case MONTH_MART:
			if (avg_day_temp >= 3 || IS_SET(cweather_type, WEATHER_QUICKHOT))
			{
				strcat(buf, "Начался дождь.\r\n");
				create_rainsnow(&cweather_type, WEATHER_LIGHTRAIN, 80, 20, 0);
			}
			else
			{
				strcat(buf, "Пошел снег.\r\n");
				create_rainsnow(&cweather_type, WEATHER_LIGHTSNOW, 60, 30, 10);
			}
			break;
		}
		weather_info.sky = SKY_RAINING;
		break;
	case 3:		// CLOUDY -> CLOUDLESS
		strcat(buf, "Начало проясняться.\r\n");
		weather_info.sky = SKY_CLOUDLESS;
		break;
	case 4:		// RAINING -> LIGHTNING
		strcat(buf, "Налетевший ветер разогнал тучи.\r\n");
		weather_info.sky = SKY_LIGHTNING;
		break;
	case 5:		// RAINING -> CLOUDY
		if (IS_SET(weather_info.weather_type, WEATHER_LIGHTRAIN | WEATHER_MEDIUMRAIN | WEATHER_BIGRAIN))
			strcat(buf, "Дождь прекратился.\r\n");
		else if (IS_SET(weather_info.weather_type, WEATHER_LIGHTSNOW | WEATHER_MEDIUMSNOW | WEATHER_BIGSNOW))
			strcat(buf, "Снегопад прекратился.\r\n");
		else if (IS_SET(weather_info.weather_type, WEATHER_GRAD))
			strcat(buf, "Град прекратился.\r\n");
		weather_info.sky = SKY_CLOUDY;
		break;
	case 6:		// LIGHTNING -> RAINING
		switch (time_info.month)
		{
		case MONTH_MAY:
		case MONTH_JUNE:
		case MONTH_JULY:
		case MONTH_AUGUST:
		case MONTH_SEPTEMBER:
			if (IS_SET(cweather_type, WEATHER_QUICKCOOL))
			{
				strcat(buf, "Начался град.\r\n");
				SET_BIT(cweather_type, WEATHER_GRAD);
			}
			else
			{
				strcat(buf, "Полил дождь.\r\n");
				create_rainsnow(&cweather_type, WEATHER_LIGHTRAIN, 10, 40, 50);
			}
			break;
		case MONTH_DECEMBER:
		case MONTH_JANUARY:
		case MONTH_FEBRUARY:
			strcat(buf, "Повалил снег.\r\n");
			create_rainsnow(&cweather_type, WEATHER_LIGHTSNOW, 10, 40, 50);
			break;
		case MONTH_OCTOBER:
		case MONTH_APRIL:
			if (IS_SET(cweather_type, WEATHER_QUICKCOOL)
					&& weather_info.temperature <= 5)
			{
				strcat(buf, "Повалил снег.\r\n");
				create_rainsnow(&cweather_type, WEATHER_LIGHTSNOW, 40, 60, 0);
			}
			else
			{
				strcat(buf, "Начался дождь.\r\n");
				create_rainsnow(&cweather_type, WEATHER_LIGHTRAIN, 40, 60, 0);
			}
			break;
		case MONTH_NOVEMBER:
			if (avg_day_temp <= 3 || IS_SET(cweather_type, WEATHER_QUICKCOOL))
			{
				strcat(buf, "Повалил снег.\r\n");
				create_rainsnow(&cweather_type, WEATHER_LIGHTSNOW, 40, 60, 0);
			}
			else
			{
				strcat(buf, "Начался дождь.\r\n");
				create_rainsnow(&cweather_type, WEATHER_LIGHTRAIN, 40, 60, 0);
			}
			break;
		case MONTH_MART:
			if (avg_day_temp >= 3 || IS_SET(cweather_type, WEATHER_QUICKHOT))
			{
				strcat(buf, "Начался дождь.\r\n");
				create_rainsnow(&cweather_type, WEATHER_LIGHTRAIN, 80, 20, 0);
			}
			else
			{
				strcat(buf, "Пошел снег.\r\n");
				create_rainsnow(&cweather_type, WEATHER_LIGHTSNOW, 60, 30, 10);
			}
			break;
		}
		weather_info.sky = SKY_RAINING;
		break;
	case 0:
	default:
		if (IS_SET(weather_info.weather_type, WEATHER_GRAD))
		{
			strcat(buf, "Град прекратился.\r\n");
			create_rainsnow(&cweather_type, WEATHER_LIGHTRAIN, 10, 40, 50);
		}
		else if (IS_SET(weather_info.weather_type, WEATHER_BIGRAIN))
		{
			if (weather_info.change >= 5)
			{
				strcat(buf, "Дождь утих.\r\n");
				create_rainsnow(&cweather_type, WEATHER_LIGHTRAIN, 20, 80, 0);
			}
			else
				SET_BIT(cweather_type, WEATHER_BIGRAIN);
		}
		else if (IS_SET(weather_info.weather_type, WEATHER_MEDIUMRAIN))
		{
			if (weather_info.change <= -5)
			{
				strcat(buf, "Дождь усилился.\r\n");
				SET_BIT(cweather_type, WEATHER_BIGRAIN);
			}
			else if (weather_info.change >= 5)
			{
				strcat(buf, "Дождь утих.\r\n");
				SET_BIT(cweather_type, WEATHER_LIGHTRAIN);
			}
			else
				SET_BIT(cweather_type, WEATHER_MEDIUMRAIN);
		}
		else if (IS_SET(weather_info.weather_type, WEATHER_LIGHTRAIN))
		{
			if (weather_info.change <= -5)
			{
				strcat(buf, "Дождь усилился.\r\n");
				create_rainsnow(&cweather_type, WEATHER_LIGHTRAIN, 0, 70, 30);
			}
			else
				SET_BIT(cweather_type, WEATHER_LIGHTRAIN);
		}
		else if (IS_SET(weather_info.weather_type, WEATHER_BIGSNOW))
		{
			if (weather_info.change >= 5)
			{
				strcat(buf, "Снегопад утих.\r\n");
				create_rainsnow(&cweather_type, WEATHER_LIGHTSNOW, 20, 80, 0);
			}
			else
				SET_BIT(cweather_type, WEATHER_BIGSNOW);
		}
		else if (IS_SET(weather_info.weather_type, WEATHER_MEDIUMSNOW))
		{
			if (weather_info.change <= -5)
			{
				strcat(buf, "Снегопад усилился.\r\n");
				SET_BIT(cweather_type, WEATHER_BIGSNOW);
			}
			else if (weather_info.change >= 5)
			{
				strcat(buf, "Снегопад утих.\r\n");
				SET_BIT(cweather_type, WEATHER_LIGHTSNOW);
			}
			else
				SET_BIT(cweather_type, WEATHER_MEDIUMSNOW);
		}
		else if (IS_SET(weather_info.weather_type, WEATHER_LIGHTSNOW))
		{
			if (weather_info.change <= -5)
			{
				strcat(buf, "Снегопад усилился.\r\n");
				create_rainsnow(&cweather_type, WEATHER_LIGHTSNOW, 0, 70, 30);
			}
			else
				SET_BIT(cweather_type, WEATHER_LIGHTSNOW);
		}
		break;
	}

	if (*buf)
		send_to_outdoor(buf, WEATHER_CONTROL);
	weather_info.weather_type = cweather_type;
}
Пример #7
0
void another_hour(int mode)
{
	time_info.hours++;

	if (time_info.hours == sunrise[time_info.month][0])
	{
		weather_info.sunlight = SUN_RISE;
		send_to_outdoor("На востоке показались первые солнечные лучи.\r\n", SUN_CONTROL);
		// Gorrah: Закомментил вызов тут и далее по коду, пока не будет приведено в нормальный виж.
		// Вы с дуба рухнули - каждый тик бегать по ~100-150к объектов в мире?
		// Надо делать через собственный лист объектов с такими тригами в собственном же неймспейсе
		// См. как сделаны slow DT например.
		//script_timechange_trigger_check(25);//рассвет
	}
	else if (time_info.hours == sunrise[time_info.month][0] + 1)
	{
		weather_info.sunlight = SUN_LIGHT;
		send_to_outdoor("Начался день.\r\n", SUN_CONTROL);
		//script_timechange_trigger_check(26);//день
	}
	else if (time_info.hours == sunrise[time_info.month][1])
	{
		weather_info.sunlight = SUN_SET;
		send_to_outdoor("Солнце медленно исчезло за горизонтом.\r\n", SUN_CONTROL);
		//script_timechange_trigger_check(27);//закат
	}
	else if (time_info.hours == sunrise[time_info.month][1] + 1)
	{
		weather_info.sunlight = SUN_DARK;
		send_to_outdoor("Началась ночь.\r\n", SUN_CONTROL);
		//script_timechange_trigger_check(28);//ночь
	}

	if (time_info.hours >= HOURS_PER_DAY)  	/* Changed by HHS due to bug ??? */
	{
		time_info.hours = 0;
		time_info.day++;

		weather_info.moon_day++;
		if (weather_info.moon_day >= MOON_CYCLE)
			weather_info.moon_day = 0;
		weather_info.week_day_mono++;
		if (weather_info.week_day_mono >= WEEK_CYCLE)
			weather_info.week_day_mono = 0;
		weather_info.week_day_poly++;
		if (weather_info.week_day_poly >= POLY_WEEK_CYCLE)
			weather_info.week_day_poly = 0;

		if (time_info.day >= DAYS_PER_MONTH)
		{
			time_info.day = 0;
			time_info.month++;
			if (time_info.month >= MONTHS_PER_YEAR)
			{
				time_info.month = 0;
				time_info.year++;
				calc_easter();
			}
		}
	}
	//script_timechange_trigger_check(24);//просто смена часа
	//script_timechange_trigger_check(time_info.hours);//выполняется для конкретного часа

	if ((weather_info.sunlight == SUN_SET ||
			weather_info.sunlight == SUN_DARK) &&
			weather_info.sky == SKY_LIGHTNING &&
			weather_info.moon_day >= FULLMOONSTART && weather_info.moon_day <= FULLMOONSTOP)
	{
		send_to_outdoor("Лунный свет заливает равнины тусклым светом.\r\n", SUN_CONTROL);
	}
}
Пример #8
0
void another_hour(int mode) {
  char moon[20], buf[100];
  int tmp, i;

  time_info.hours++;

  tmp = time_info.hours;

  if (mode) {                   /* tick */

    /* as a test, save a piece of the world every mud hour */
    save_the_world();
    if (tmp == 0) {
      for (i = 0; i < 29; i++)  /* save the rest of the world automatically */
        save_the_world();
    }
    if (tmp == gMoonRise) {
      if (moontype < 4) {
        strcpy(moon, "new");
      }
      else if (moontype < 12) {
        strcpy(moon, "waxing");
      }
      else if (moontype < 20) {
        strcpy(moon, "full");
      }
      else if (moontype < 28) {
        strcpy(moon, "waning");
      }
      else {
        strcpy(moon, "new");
      }
      switch_light(MOON_RISE);
      SPRINTF(buf, "The %s moon slowly rises from the western horizon.\n\r",
              moon);
      send_to_outdoor(buf);
      if ((moontype > 16) && (moontype < 22)) {
        gLightLevel++;          /* brighter during these moons */
      }
    }
    if (tmp == gSunRise) {
      weather_info.sunlight = SUN_RISE;
      send_to_outdoor("The sun begins to rise from the western horizon.\n\r");
    }
    if (tmp == gSunRise + 1) {
      weather_info.sunlight = SUN_LIGHT;
      switch_light(SUN_LIGHT);
      send_to_outdoor("The day has begun.\n\r");
      global_sun_problem_check(TRUE);
    }
    if (tmp == gSunSet) {
      weather_info.sunlight = SUN_SET;
      send_to_outdoor
        ("The sun slowly disappears into the eastern horizon.\n\r");
    }
    if (tmp == gSunSet + 1) {
      weather_info.sunlight = SUN_DARK;
      switch_light(SUN_DARK);
      send_to_outdoor("Nightime has settled upon the realms.\n\r");
      global_sun_problem_check(FALSE);
    }
    if (tmp == gMoonSet) {
      if ((moontype > 15) && (moontype < 25)) {
        switch_light(MOON_SET);
        send_to_outdoor
          ("Darkness once again fills the realm as the moon sets.\n\r");
      }
      else {
        send_to_outdoor("The moon sets.\n\r");
      }

    }
    if (tmp == 12) {
      send_to_outdoor("It is noon.\n\r");
    }

    if (time_info.hours > 23) { /* Changed by HHS due to bug ??? */
      time_info.hours -= 24;
      time_info.day++;
      switch (time_info.day) {
      case 0:
      case 6:
      case 13:
      case 20:
      case 27:
      case 34:
        pulse_mobiles(EVENT_WEEK);
        break;
      }
      /* check the season */
      change_season(time_info.month);

      moontype++;
      if (moontype > 32)
        moontype = 1;

      if (time_info.day > 34) {
        time_info.day = 0;
        time_info.month++;
        get_month(time_info.month);
        pulse_mobiles(EVENT_MONTH);

        if (time_info.month > 16) {
          time_info.month = 0;
          time_info.year++;
        }
      }

      change_season(time_info.month);
    }
  }
}
Пример #9
0
void change_weather(int change) {

  if (change < 0)
    change = 0;
  if (change > 7)
    change = 6;

  switch (change) {
  case 0:
    break;
  case 1:
    {
      send_to_outdoor("The sky is getting cloudy.\n\r");
      weather_info.sky = SKY_CLOUDY;
      break;
    }
  case 2:
    {
      if ((time_info.month > 3) && (time_info.month < 14)) {
        send_to_desert("A strong wind begins to sweep across the land\n\r");
        send_to_arctic("It starts to snow\n\r");
        send_to_out_other("It starts to rain.\n\r");
      }
      else {
        send_to_desert
          ("A strong, cold wind begins to sweep across the land\n\r");
        send_to_arctic("It starts to snow heavily.\n\r");
        send_to_out_other("It starts to snow.\n\r");
      }
      weather_info.sky = SKY_RAINING;
      break;
    }
  case 3:
    {
      send_to_outdoor("The clouds disappear.\n\r");
      weather_info.sky = SKY_CLOUDLESS;
      break;
    }
  case 4:
    {
      if ((time_info.month > 3) && (time_info.month < 14)) {
        send_to_desert("You are caught in a blinding sandstorm\n\r");
        send_to_arctic("You are caught in a blinding blizzard\n\r");
        send_to_out_other("You are caught in lightning storm.\n\r");
      }
      else {
        send_to_desert("You are caught in a blinding sandstorm\n\r");
        send_to_arctic("You are caught in a blizzard\n\r");
        send_to_out_other("You are caught in a blizzard. \n\r");
      }
      weather_info.sky = SKY_LIGHTNING;
      break;
    }
  case 5:
    {
      if ((time_info.month > 3) && (time_info.month < 14)) {
        send_to_desert("The sandstorm slowly quiets\n\r");
        send_to_arctic("The snowstorm slowly dies down\n\r");
        send_to_out_other("The rainstorm slowly dies down\n\r");
      }
      else {
        send_to_desert("The sandstorm slowly quiets\n\r");
        send_to_arctic("It has stopped snowing\n\r");
        send_to_out_other("The snow has stopped. \n\r");
      }
      weather_info.sky = SKY_CLOUDY;
      break;
    }
  case 6:
    {
      if ((time_info.month > 3) && (time_info.month < 14)) {
        send_to_desert("The sandstorm dies down, but the wind continues\n\r");
        send_to_arctic
          ("The blizzard has died down, but the snow continutes\n\r");
        send_to_out_other
          ("The lightning has gone, but it is still raining.\n\r");
      }
      else {
        send_to_desert("The sandstorm dies down, but the wind continues\n\r");
        send_to_arctic("The blizzard is over, but it is still snowing.\n\r");
        send_to_out_other
          ("The blizzard is over, but it is still snowing.\n\r");
      }
      weather_info.sky = SKY_RAINING;
      break;
    }
  default:
    break;
  }
}
Пример #10
0
void another_hour(void)
{
    bool new_month = FALSE;
    struct char_data *ch, *next;
    char *temp;

    time_info.hours++;

    switch (time_info.hours) {
    case 7:
        weather_info.sunlight = SUN_RISE;
        if (weather_info.sky == SKY_CLOUDLESS)
            temp = "^y";
        else
            temp = "^L";
        sprintf(buf, "%sThe sun rises in the east.^n\r\n", temp);
        send_to_outdoor(buf);
        for (ch = character_list; ch; ch = next) {
            next = ch->next;
            if (IS_SPIRIT(ch) && GET_MOB_VNUM(ch) >= 25 && GET_MOB_VNUM(ch) <= 41) {
                act("$n abruptly fades from the physical plane.", TRUE, ch, 0, 0, TO_ROOM);
                act("Arrgh!  The sun is rising!  Goodbye!", FALSE, ch, 0, 0, TO_CHAR);
                extract_char(ch);
            }
        }
        break;
    case 9:
        weather_info.sunlight = SUN_LIGHT;
        switch (weather_info.sky) {
        case SKY_CLOUDLESS:
            temp = "^Y";
            break;
        case SKY_CLOUDY:
        case SKY_RAINING:
            temp = "^n";
            break;
        case SKY_LIGHTNING:
            temp = "^L";
            break;
        default:
            temp = "^Y";
            break;
        }
        sprintf(buf, "%sThe day has begun.^n\r\n", temp);
        send_to_outdoor(buf);
        break;
    case 18:
        weather_info.sunlight = SUN_SET;
        switch (weather_info.sky) {
        case SKY_CLOUDLESS:
            temp = "^r";
            break;
        case SKY_CLOUDY:
            temp = "^B";
            break;
        case SKY_RAINING:
            temp = "^b";
            break;
        case SKY_LIGHTNING:
            temp = "^L";
            break;
        default:
            temp = "^r";
            break;
        }
        sprintf(buf, "%sThe sun slowly disappears in the west.^n\r\n", temp);
        send_to_outdoor(buf);
        for (ch = character_list; ch; ch = next) {
            next = ch->next;
            if (IS_SPIRIT(ch) && GET_MOB_VNUM(ch) >= 25 && GET_MOB_VNUM(ch) <= 41) {
                act("$n abruptly fades from the physical plane.", TRUE, ch, 0, 0, TO_ROOM);
                act("You sense the sun setting, and dissolve yourself.", FALSE, ch, 0, 0, TO_CHAR);
                extract_char(ch);
            }
        }
        break;
    case 21:
        weather_info.sunlight = SUN_DARK;
        if (weather_info.sky == SKY_CLOUDLESS)
            sprintf(buf, "^bThe night has begun. The moon is %s.^n\r\n",moon[weather_info.moonphase]);
        else
            sprintf(buf, "^LThe night has begun.^n\r\n");

        send_to_outdoor(buf);
        break;
    }

    if (time_info.hours > 23) {
        time_info.hours -= 24;
        time_info.day++;
        time_info.weekday++;
        if (time_info.weekday > 6)
            time_info.weekday = 0;

        if (((time_info.month == 3) || (time_info.month == 5) ||
                (time_info.month == 8) || (time_info.month == 10)) &&
                (time_info.day > 29))
            new_month = TRUE;
        else if ((time_info.month == 1) && (time_info.day > 27))
            new_month = TRUE;
        else if (time_info.day > 30)
            new_month = TRUE;
        if (new_month) {
            time_info.day = 0;
            time_info.month++;

            if (time_info.month > 11) {
                time_info.month = 0;
                time_info.year++;
            }
        }
    }
    if(time_info.day < 7)
        weather_info.moonphase = MOON_NEW;
    else if(time_info.day > 7 && time_info.day < 14)
        weather_info.moonphase = MOON_WAX;
    else if(time_info.day > 14 && time_info.day < 21)
        weather_info.moonphase = MOON_FULL;
    else
        weather_info.moonphase = MOON_WANE;

}
Пример #11
0
void weather_change(void)
{
    int diff, change;

    if ((time_info.month >= 8) && (time_info.month <= 12))
        diff = (weather_info.pressure > 985 ? -2 : 2);
    else
        diff = (weather_info.pressure > 1015 ? -2 : 2);

    weather_info.change += (dice(1, 4) * diff + dice(2, 6) - dice(2, 6));

    weather_info.change = MIN(weather_info.change, 12);
    weather_info.change = MAX(weather_info.change, -12);

    weather_info.pressure += weather_info.change;

    weather_info.pressure = MIN(weather_info.pressure, 1040);
    weather_info.pressure = MAX(weather_info.pressure, 960);

    change = 0;
    switch (weather_info.sky) {
    case SKY_CLOUDLESS:
        if (weather_info.pressure < 990)
            change = 1;
        else if (weather_info.pressure < 1010)
            if (dice(1, 4) == 1)
                change = 1;
        break;
    case SKY_CLOUDY:
        if (weather_info.pressure < 970)
            change = 2;
        else if (weather_info.pressure < 990)
            if (dice(1, 4) == 1)
                change = 2;
            else
                change = 0;
        else if (weather_info.pressure > 1030)
            if (dice(1, 4) == 1)
                change = 3;
        break;
    case SKY_RAINING:
        if (weather_info.pressure < 970)
            if (dice(1, 4) == 1)
                change = 4;
            else
                change = 0;
        else if (weather_info.pressure > 1030)
            change = 5;
        else if (weather_info.pressure > 1010)
            if (dice(1, 4) == 1)
                change = 5;
        break;
    case SKY_LIGHTNING:
        if (weather_info.pressure > 1010)
            change = 6;
        else if (weather_info.pressure > 990)
            if (dice(1, 4) == 1)
                change = 6;
        break;
    default:
        change = 0;
        weather_info.sky = SKY_CLOUDLESS;
        break;
    }

    switch (change) {
    case 0:
        break;
    case 1:
        send_to_outdoor("^LThe sky starts to get cloudy.^n\r\n");
        weather_info.sky = SKY_CLOUDY;
        break;
    case 2:
        send_to_outdoor("^BIt starts to rain.^n\r\n");
        weather_info.sky = SKY_RAINING;
        break;
    case 3:
        send_to_outdoor("^CThe clouds disappear.^n\r\n");
        weather_info.sky = SKY_CLOUDLESS;
        break;
    case 4:
        send_to_outdoor("^WLightning^L starts to show in the sky.^n\r\n");
        weather_info.sky = SKY_LIGHTNING;
        break;
    case 5:
        send_to_outdoor("^cThe rain stops.^n\r\n");
        weather_info.sky = SKY_CLOUDY;
        weather_info.lastrain = 0;
        break;
    case 6:
        send_to_outdoor("^cThe ^Wlightning^c stops.^n\r\n");
        weather_info.sky = SKY_RAINING;
        break;
    default:
        break;
    }
    if (weather_info.sky < SKY_RAINING)
        weather_info.lastrain++;
}
Пример #12
0
void
another_hour(int mode)
{
  void full_moon(void);
  void lunar_hunter(void);
  void load_night_gate(void);
  void remove_night_gate(void);
  void ghost_ship_appear(void);
  void ghost_ship_disappear(void);

  time_info.hours++;

  if (mode)
    {
      switch (time_info.hours)
    {
    case 5:
      weather_info.sunlight = SUN_RISE;
      send_to_outdoor("The suns rise in the east and north.\r\n");
          ghost_ship_disappear();
      remove_night_gate();
      break;
    case 6:
      weather_info.sunlight = SUN_LIGHT;
      send_to_outdoor("The day has begun.\r\n");
      break;
    case 21:
      weather_info.sunlight = SUN_SET;
      send_to_outdoor("The suns slowly disappear in the west and "
        "south.\r\n");
      ghost_ship_appear();
      load_night_gate();
      if (time_info.day+1 <26 && time_info.day+1 >=22)
      {
        full_moon();
        lunar_hunter();
      }
      break;
    case 22:
      weather_info.sunlight = SUN_DARK;
      send_to_outdoor("The night has begun.\r\n");
      break;
    default:
      break;
    }
    }
  if (time_info.hours > 23)
    {   /* Changed by HHS due to bug ??? */
      time_info.hours -= 24;
      time_info.day++;

      switch(time_info.day)
    {
    case 1: time_info.moon = MOON_NEW;
      break;
    case 6: time_info.moon = MOON_QUARTER_FULL;
      break;
    case 12: time_info.moon = MOON_HALF_FULL;
      break;
    case 17: time_info.moon = MOON_THREE_FULL;
      break;
    case 22: time_info.moon = MOON_FULL;
      break;
    case 26: time_info.moon = MOON_QUARTER_EMPTY;
      break;
    case 30: time_info.moon = MOON_HALF_EMPTY;
      break;
    case 34: time_info.moon = MOON_THREE_EMPTY;
      break;
    default:
      break;
    }

      if (time_info.day > 34)
    {
      time_info.day = 0;
      time_info.month++;

      if (time_info.month > 16)
        {
          time_info.month = 0;
          time_info.year++;
        }
    }
    }
}