#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 buf[MAX_STRING_LENGTH]; char temp[MAX_STRING_LENGTH]; char rdesc[MAX_STRING_LENGTH]; int i, letters, space, newspace, line; EXIT_DATA *pexit; /* Count the number of each type of message, and abbreviate in case of very long strings */ /* Get room's desc first, tack other stuff in after that. */ strcpy(buf, ch->in_room->description); sprintf(buf, "\n\r"); sprintf(message, " "); /* One sentence about the room we're in */ switch(ch->in_room->sector_type) { case 0: break; case 1: strcat(message, " The city street is"); // if (ch->in_room->curr_vegetation > 66) // strcat(message, " lined by lush trees and hedges"); strcat(message, ". "); 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(buf, message); if (IS_SET(ch->in_room->room_flags, ROOM_NO_MOB)) strcat(message, "A shield protects this room allowing only players. "); strcat(buf, message); if (IS_SET(ch->in_room->room_flags, ROOM_NO_CHANT)) strcat(message, "A sign is on the wall, 'No chanting!'. "); strcat(buf, message); if (IS_SET(ch->in_room->room_flags, ROOM_PET_SHOP)) strcat(message, "You are in a Pet Shop. "); strcat(buf, message); if (IS_SET(ch->in_room->room_flags, ROOM_INDOORS)) strcat(message, "You are inside. "); strcat(buf, message); /* List appropriate room flags */ strcpy(message, ""); if (IS_AFFECTED(ch, AFF_DETECT_MAGIC)) { if (IS_SET(ch->in_room->room_flags, ROOM_SAFE)) strcat(message, "A magical aura seems to promote a feeling of peace. "); if (IS_SET(ch->in_room->room_flags, ROOM_NO_RECALL)) strcat(message, "A very weak pulling sensation emenates from this place. "); } if (IS_SET(ch->in_room->room_flags, ROOM_DARK)) strcat(message, "It is quite dark in here. "); if (IS_SET(ch->in_room->room_flags, ROOM_PRIVATE)) strcat(message, "A sign on the wall states, 'This room is private.' "); strcat(buf, message); /* 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(message, ""); if (IS_SET(pexit->exit_info, EX_ISDOOR)) { if (IS_SET(pexit->exit_info, EX_BASHED)) strcat(message, "bashed in "); else { if (IS_SET(pexit->exit_info, EX_NOPASSDOOR) || IS_SET(pexit->exit_info, EX_BASHPROOF)) strcat(message, "thick looking "); if (IS_SET(pexit->exit_info, EX_CLOSED)) strcat(message, "closed "); else strcat(message, "open "); } if (strcmp(pexit->keyword, "")) strcat(message, pexit->keyword); else strcat(message, "door"); strcat(message, " leads "); strcat(message, dir_name[pexit->vdir]); strcat(message, ". "); strcat(buf, capitalize(message)); } 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(message, temp, dir_name[pexit->vdir]); strcat(buf, message); } } } } if (ch->in_room->blood == 1000) strcat(message, "You notice that the room is completely drenched in blood. "); if (ch->in_room->blood > 750) strcat(message, "You notice that there is a very large amount of blood around the room. "); if (ch->in_room->blood > 500) strcat(message, "You notice that there is a large quantity of blood around the room. "); if (ch->in_room->blood > 250) strcat(message, "You notice a fair amount of blood on the floor. "); if (ch->in_room->blood > 100) strcat(message, "You notice several blood stains on the floor. "); if (ch->in_room->blood > 50) strcat(message, "You notice a few blood stains on the floor. "); if (ch->in_room->blood > 25) strcat(message, "You notice a couple of blood stains on the floor. "); if (ch->in_room->blood > 0) strcat(message, "You notice a few drops of blood on the floor. "); strcat(buf, message); if (weather_info.sunlight == SUN_LIGHT) strcat(message, "The day has begun. "); if (weather_info.sunlight == SUN_RISE) strcat (message, "The sun rises in the east. "); if (weather_info.sunlight == SUN_SET) strcat (message, "The sun slowly disappears in the west. "); if (weather_info.sunlight == SUN_DARK) strcat (message, "The night has begun. "); strcat(buf, message); if (IS_SET(ch->in_room->area->a_weather, SKY_SNOWING)) strcat (message, "It is Snowing. "); if (IS_SET(ch->in_room->area->a_weather, SKY_CLOUDLESS)) strcat (message, "The sky is cloudless. "); if (IS_SET(ch->in_room->area->a_weather, SKY_CLOUDY)) strcat (message, "It is cloudy. "); if (IS_SET(ch->in_room->area->a_weather, SKY_RAINING)) strcat (message, "It is raining. "); if (IS_SET(ch->in_room->area->a_weather, SKY_LIGHTNING)) strcat (message, "There is lightning. "); if (IS_SET(ch->in_room->area->a_weather, SKY_BLIZZARD)) strcat (message, "Your in a blizzard. "); if (IS_SET(ch->in_room->area->a_weather, SKY_FOGGY)) strcat (message, "It is foggy. "); if (IS_SET(ch->in_room->area->a_weather, SKY_HAILSTORM)) strcat (message, "Your in a hailstorm. "); if (IS_SET(ch->in_room->area->a_weather, SKY_THUNDERSTORM)) strcat (message, "Your in a thunderstorm. "); if (IS_SET(ch->in_room->area->a_weather, SKY_ICESTORM)) strcat (message, "Your in an icestorm. "); if (IS_SET(ch->in_room->area->a_weather, SKY_SUNNY)) strcat (message, "Its a sunny day. "); if (IS_SET(ch->in_room->area->a_weather, SKY_TORNADO)) strcat (message, "There is a tornado. "); if (IS_SET(ch->in_room->area->a_weather, SKY_EARTHQUAKE)) strcat (message, "There is an earthquake. "); if (IS_SET(ch->in_room->area->a_weather, SKY_HURRICANE)) strcat (message, "Your in a hurricane. "); if (IS_SET(ch->in_room->area->a_weather, SKY_HEAT)) strcat (message, "Its a scorcher. "); if (IS_SET(ch->in_room->area->a_weather, SKY_WINDY)) strcat (message, "There is a strong wind. "); if (IS_SET(ch->in_room->area->a_weather, SKY_FREEZING)) strcat (message, "Its freezing cold. "); if (IS_SET(ch->in_room->area->a_weather, SKY_AVALANCHE)) strcat (message, "There is an Avalanche. "); strcat(buf, message); strcat(buf, " "); i=0; letters=0; /* Strip \r and \n */ for (i=0; i<strlen(buf); i++) { if (buf[i] != '\r' && buf[i] != '\n') { rdesc[letters]=buf[i]; letters++; } else if (buf[i] == '\r') { rdesc[letters]=' '; letters++; } rdesc[letters]='\0'; } i=0; letters=0; space=0; newspace=0; line=0; strcpy(buf, rdesc); /* Add \r\n's back in at their appropriate places */ for (i=0; i<strlen(buf); i++) { if (buf[i]==' ') { space=i; newspace=letters; } if (line > 70) { i=space; letters=newspace; rdesc[letters++]='\r'; rdesc[letters++]='\n'; line=0; } else if (!(buf[i]==' ' && buf[i+1]==' ')) { rdesc[letters]=buf[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); return descr; }