#if defined(macintosh) #include <types.h> #else #include <sys/types.h> #endif #include <stdio.h> #include <stdlib.h> #include <string.h> #include <time.h> #include "merc.h" char *get_room_description(CHAR_DATA *ch, char *descr) { char message[MAX_STRING_LENGTH]; char message2[MAX_STRING_LENGTH]; char message3[MAX_STRING_LENGTH]; char message4[MAX_STRING_LENGTH]; char message5[MAX_STRING_LENGTH]; char message6[MAX_STRING_LENGTH]; char msg[MAX_STRING_LENGTH]; char temp[MAX_STRING_LENGTH]; char rdesc[MAX_STRING_LENGTH]; char buf[MAX_STRING_LENGTH]; ROOM_INDEX_DATA *pRoom; int i, letters, space, newspace, line; EXIT_DATA *pexit; int door; strcpy(msg, ch->in_room->description); // sprintf(msg, "%s\n\r", ch->in_room->description); sprintf(message, " "); sprintf(message2, " "); sprintf(message3, " "); sprintf(message4, " "); sprintf(message5, " "); sprintf(message6, " "); switch(ch->in_room->sector_type) { case 0: strcat(message, " The inside air is still and musty. "); break; case 1: strcat(message, " The City street is below your feet. "); break; case 2: strcat(message, " Rocky, steep terrain leads up into these mountain peaks. "); break; case 3: strcat(message, " Water swirls all around. "); break; case 4: strcat(message, " The thin air swirls past, barely making even its presence known. "); break; case 5: strcat(message, " The details of this location are strangely difficult to determine. "); break; case 6: strcat(message, " Molten lava flows through the volcanic caverns. "); break; case 7: strcat(message, " The solid ice shows no trace of life. "); break; default: strcat(message, ""); break; } strcat(msg, message); /* List appropriate room flags */ // strcpy(message, ""); if (IS_SET(ch->in_room->room_flags, ROOM_SAFE)) strcat(message2, "A magical aura seems to promote a feeling of peace. "); if (IS_SET(ch->in_room->room_flags, ROOM_NO_RECALL)) strcat(message2, "A very weak pulling sensation emenates from this place. "); if (IS_SET(ch->in_room->room_flags, ROOM_DARK)) strcat(message2, "It is quite dark in here. "); if (IS_SET(ch->in_room->room_flags, ROOM_PRIVATE)) strcat(message2, "A sign on the wall states, 'This room is private.' "); if (IS_SET(ch->in_room->room_flags, ROOM_PET_SHOP)) strcat(message2, "You are in a Pet Shop. "); if (IS_SET(ch->in_room->room_flags, ROOM_INDOORS)) strcat(message2, "You are inside. "); strcat(msg, message2); // strcat(msg, " " ); /* if (pRoom->exit[0]->description != NULL){ strcpy(msg, pRoom->exit[0]->description); strcat(message6, "Exit 0 ");} if (pRoom->exit[1]->description != NULL){ strcpy(msg, pRoom->exit[1]->description); strcat(message6, "Exit 1 " );} if (pRoom->exit[2]->description != NULL){ strcpy(msg, pRoom->exit[2]->description); strcat(message6, "Exit 2 ");} if (pRoom->exit[3]->description != NULL){ strcpy(msg, pRoom->exit[3]->description); strcat(message6, "Exit 3 ");} if (pRoom->exit[4]->description != NULL){ strcpy(msg, pRoom->exit[4]->description); strcat(message6, "Exit 4 ");} if (pRoom->exit[5]->description != NULL){ strcpy(msg, pRoom->exit[5]->description); strcat(message6, "Exit 5 ");} strcat(msg, message6); */ /* List exits */ for ( pexit = ch->in_room->first_exit; pexit; pexit = pexit->next ) { if (pexit->to_room) { if (IS_SET(pexit->exit_info, EX_HIDDEN) || IS_SET(pexit->exit_info, EX_SECRET)) continue; strcpy(message6, ""); if (IS_SET(pexit->exit_info, EX_ISDOOR)) { if (IS_SET(pexit->exit_info, EX_BASHED)) strcat(message6, "bashed in "); else { if (IS_SET(pexit->exit_info, EX_NOPASSDOOR) || IS_SET(pexit->exit_info, EX_BASHPROOF)) strcat(message6, "thick looking "); if (IS_SET(pexit->exit_info, EX_CLOSED)) strcat(message6, "closed "); else strcat(message6, "open "); } if (strcmp(pexit->keyword, "")) strcat(message6, pexit->keyword); else strcat(message6, "door"); strcat(message6, " leads "); strcat(message6, dir_name[pexit->vdir]); strcat(message6, ". "); strcat(buf, capitalize(message6)); } else { /* Don't say anything about normal exits, only interesting ones */ // if (pexit->to_room->sector_type != ch->in_room->sector_type) { strcpy(temp, ""); switch (pexit->to_room->sector_type) { case 0: strcat(temp, "A building lies %s from here. "); break; case 1: strcat(temp, "A well worn road leads %s from here. "); break; case 2: strcat(temp, "Fields lie to the %s. "); break; case 3: strcat(temp, "Tall trees obscure the horizon to the %s. "); break; case 4: strcat(temp, "Rough, hilly terrain lies %s from here. "); break; case 5: strcat(temp, "Steep mountains loom to the %s. "); break; case 6: /* Is the water frozen? */ // if (IS_OUTSIDE(ch) && ((ch->in_room->area->weather->temp + 3*weath_unit -1)/weath_unit < 3)) strcat(temp, "Some fairly shallow water to the %s seems frozen enough to walk on. "); // else // strcat(temp, "Fairly shallow water is visible to the %s. "); break; case 7: /* Is the water frozen? */ // if (IS_OUTSIDE(ch) && ((ch->in_room->area->weather->temp + 3*weath_unit -1)/weath_unit < 3)) strcat(temp, "The water to the %s is frozen solid. "); // else // strcat(temp, "The water %s of here looks quite deep. "); break; case 8: strcat(temp, "Murky water swirls endlessly %s of here. "); break; case 9: strcat(temp, "There is nothing but open air %s from here. "); break; case 10: strcat(temp, "Desert sands reach %s into the distance. "); break; case 12: strcat(temp, "The sandy ocean floor stretches %s. "); break; case 13: strcat(temp, "Dimly lit caverns continue %s from here. "); break; case 14: strcat(temp, "Molten lava flows %s from here. "); break; case 15: strcat(temp, "Muddy swamplands continue to the %s. "); break; case 16: strcat(temp, "Solid ice is visible to the %s. "); break; case 17: strcat(temp, "The beach can be seen to the %s. "); } sprintf(message6, temp, dir_name[pexit->vdir]); strcat(msg, message6); // } } } } if (ch->in_room->blood == 1000) strcat(message3, "You notice that the room is completely drenched in blood. "); else if (ch->in_room->blood > 750) strcat(message3, "You notice that there is a very large amount of blood around the room. "); else if (ch->in_room->blood > 500) strcat(message3, "You notice that there is a large quantity of blood around the room. "); else if (ch->in_room->blood > 250) strcat(message3, "You notice a fair amount of blood on the floor. "); else if (ch->in_room->blood > 100) strcat(message3, "You notice several blood stains on the floor. "); else if (ch->in_room->blood > 50) strcat(message3, "You notice a few blood stains on the floor. "); else if (ch->in_room->blood > 25) strcat(message3, "You notice a couple of blood stains on the floor. "); else if (ch->in_room->blood > 0) strcat(message3, "You notice a few drops of blood on the floor. "); else strcat(message3, "You dont see any blood sprayed on the surroundings. "); strcat(msg, message3); // strcat(msg, " " ); if (weather_info.sunlight == SUN_LIGHT) strcat(message4, "The day has begun. "); if (weather_info.sunlight == SUN_RISE) strcat (message4, "The sun rises in the east. "); if (weather_info.sunlight == SUN_SET) strcat (message4, "The sun slowly disappears in the west. "); if (weather_info.sunlight == SUN_DARK) strcat (message4, "The night has begun. "); strcat(msg, message4); // strcat(msg, " " ); if (IS_SET(ch->in_room->area->a_weather, SKY_SNOWING)) strcat (message5, "It is Snowing. "); if (IS_SET(ch->in_room->area->a_weather, SKY_CLOUDLESS)) strcat (message5, "The sky is cloudless. "); if (IS_SET(ch->in_room->area->a_weather, SKY_CLOUDY)) strcat (message5, "It is cloudy. "); if (IS_SET(ch->in_room->area->a_weather, SKY_RAINING)) strcat (message5, "It is raining. "); if (IS_SET(ch->in_room->area->a_weather, SKY_LIGHTNING)) strcat (message5, "There is lightning. "); if (IS_SET(ch->in_room->area->a_weather, SKY_BLIZZARD)) strcat (message5, "Your in a blizzard. "); if (IS_SET(ch->in_room->area->a_weather, SKY_FOGGY)) strcat (message5, "It is foggy. "); if (IS_SET(ch->in_room->area->a_weather, SKY_HAILSTORM)) strcat (message5, "Your in a hailstorm. "); if (IS_SET(ch->in_room->area->a_weather, SKY_THUNDERSTORM)) strcat (message5, "Your in a thunderstorm. "); if (IS_SET(ch->in_room->area->a_weather, SKY_ICESTORM)) strcat (message5, "Your in an icestorm. "); if (IS_SET(ch->in_room->area->a_weather, SKY_SUNNY)) strcat (message5, "Its a sunny day. "); if (IS_SET(ch->in_room->area->a_weather, SKY_TORNADO)) strcat (message5, "There is a tornado. "); if (IS_SET(ch->in_room->area->a_weather, SKY_EARTHQUAKE)) strcat (message5, "There is an earthquake. "); if (IS_SET(ch->in_room->area->a_weather, SKY_HURRICANE)) strcat (message5, "Your in a hurricane. "); if (IS_SET(ch->in_room->area->a_weather, SKY_HEAT)) strcat (message5, "Its a scorcher. "); if (IS_SET(ch->in_room->area->a_weather, SKY_WINDY)) strcat (message5, "There is a strong wind. "); if (IS_SET(ch->in_room->area->a_weather, SKY_FREEZING)) strcat (message5, "Its freezing cold. "); if (IS_SET(ch->in_room->area->a_weather, SKY_AVALANCHE)) strcat (message5, "There is an Avalanche. "); strcat(msg, message5); // strcat(msg, " " ); /* if (weather_info.sky == SKY_CLOUDLESS) { strcat (message5, "The sky is getting cloudy. "); strcat(msg, message5); } if (weather_info.sky == SKY_CLOUDY) { if (weather_info.mmhg < 970 || (weather_info.mmhg < 990 && number_bits (2) == 0)) { strcat (message5, "It starts to rain.\n\r"); strcat(msg, message5); } else if (weather_info.mmhg > 1030 && number_bits (2) == 0) { strcat (message5, "The clouds disappear.\n\r"); strcat(msg, message5); } } if (weather_info.sky == SKY_RAINING) { if (weather_info.mmhg < 970 && number_bits (2) == 0) { strcat (message5, "Lightning flashes in the sky.\n\r"); strcat(msg, message5); } else if (weather_info.mmhg > 1030 || (weather_info.mmhg > 1010 && number_bits (2) == 0)) { strcat (message5, "The rain stopped.\n\r"); strcat(msg, message5); } } if (weather_info.sky == SKY_LIGHTNING) { if (weather_info.mmhg > 1010 || (weather_info.mmhg > 990 && number_bits (2) == 0)) { strcat (message5, "The lightning has stopped.\n\r"); strcat(msg, message5); } } */ i=0; letters=0; /* Strip \r and \n */ for (i=0; i<strlen(msg); i++) { if (msg[i] != '\r' && msg[i] != '\n') { rdesc[letters]=msg[i]; letters++; } else if (msg[i] == '\r') { rdesc[letters]=' '; letters++; } rdesc[letters]='\0'; } i=0; letters=0; space=0; newspace=0; line=0; strcpy(msg, rdesc); /* Add \r\n's back in at their appropriate places */ for (i=0; i<strlen(msg); i++) { if (msg[i]==' ') { space=i; newspace=letters; } if (line > 70) { i=space; letters=newspace; rdesc[letters++]='\r'; rdesc[letters++]='\n'; line=0; } else if (!(msg[i]==' ' && msg[i+1]==' ')) { rdesc[letters]=msg[i]; letters++; /* Index for rdesc; i is the index for buf */ line++; /* Counts number of characters on this line */ } rdesc[letters+1]='\0'; } if (strlen(rdesc) > 0) strcat(rdesc, "\r\n"); // descr=STRALLOC(rdesc); mudstrlcpy( descr, rdesc, MSL ); return descr; }