/************************************STARMAP******************************* Star Map - por Nebseni de Clandestine MUD. Adaptado a Smaug por Desden, el Chaman Tibetano - Web:luisso.net/inicio.htm jose@luisso.net Julio 1999 Este snippet permite a los jugadores mirar el cielo y ver una disposicion realista del firmamento, incluyendo la luna que se moverá en el cielo, mostrando además sus distintas fases. Durante el día solo se verá el sol y la luna (si en esos momentos es visible). Si el tiempo está nublado, obviamente, no se podrá ver nada de esto. Este snippet se puede usar sin ningún tipo de problemas, pero os pido que citeis el nombre de los autores en el fichero de ayuda. Algunas de estas están basadas en constelaciones reales y otras son de pura invención. Tu mismo te puedes crear tus propias constelaciones. Las letras son los códigos de colores, asi 'W' ==> "&W " que representa el color blanco Solo son necesarias unas pocas modificaciones en el código pues la mayoria está contenido en un fichero propio. ** Añadir en mud.h ** void look_sky args(( CHAR_DATA *ch )); ** en la funci«n do_look (act_info.c) ** if ( !str_cmp( arg1, "cielo" ) ) { if ( !IS_OUTSIDE(ch) ) { send_to_char( "No se puede ver el cielo si no estas en el exterior..\n\r", ch ); return; } else { look_sky(ch); return; } } ********** Se recomienda a¤adir la siguiente ayuda ********* -1 CIELO ESTRELLAS CONSTELACIONES~ El cielo nocturno de ..(pon aqui el nombre de tu MUD) esta salpicado de numerosas estrellas. Los antiguos creyeron ver que se agrupaban en magicas formas y dieron nombre a las constelaciones. A lo largo del anyo puedes mirar al cielo y ver algunas de las mas famosas, incluyendo: &OCisne &cOsa Menor &GOrion &WDragon &PLeo &gVenus &RMarte &CCasiopea &BMercurio &bUrano &pCorona &rPluton &YRaptor StarMap ha sido escrito por Nebseni de Clandestine MUD y adaptado a Smaug por Desden, el Chaman Tibetano. ~ */ /*Incluir el siguiente archivo como starmap.c en el directorio /src y añadir starmap.o y starmap.c en las correspondientes secciones del Makefile. Después recompilar el código. */ #include #include #include #include #include #include #include "mud.h" #define NUM_DAYS 35 /* Match this to the number of days per month; this is the moon cycle */ #define NUM_MONTHS 17 /* Match this to the number of months defined in month_name[]. */ #define MAP_WIDTH 72 #define MAP_HEIGHT 8 /* Should be the string length and number of the constants below.*/ const char * star_map[] = { " C. C. g*", " O: R* G* G. W* W. W. C. C. Y* Y. Y. ", " O*. c. W.W. W. C. Y..Y. ", "O.O. O. c. G..G. W: B* Y.", " O. c. c. W. W. r* Y.", " O.c. c. G. P.. W. p. Y. Y: ", " c. G* P. P. p. p: Y. Y. ", " b* P.: P* p.p: " }; /****************** CONSTELACIONES y PLANETAS ***************************** Cisne Marte Orion Dragon Casiopea Venus Osa Menor Mercurio Pluton Urano Leo Corona Raptor *************************************************************************/ const char * sun_map[] = { "\\`|'/", "- O -", "/.|.\\" }; const char * moon_map[] = { " @@@ ", "@@@@@", " @@@ " }; void look_sky ( CHAR_DATA * ch ) { static char buf[MAX_STRING_LENGTH]; static char buf2[4]; int starpos, sunpos, moonpos, moonphase, i, linenum, precip; pager_printf_color(ch,"Diriges tu mirada al cielo y ves:\n\r"); precip = (ch->in_room->area->weather->precip + 3*weath_unit - 1)/ weath_unit; if (precip > 1) { send_to_char("Una capa de nubes que te impide contemplar el firmamento.\n\r", ch); return; } sunpos = (MAP_WIDTH * (24 - time_info.hour) / 24); moonpos = (sunpos + time_info.day * MAP_WIDTH / NUM_DAYS) % MAP_WIDTH; if ((moonphase = ((((MAP_WIDTH + moonpos - sunpos ) % MAP_WIDTH ) + (MAP_WIDTH/16)) * 8 ) / MAP_WIDTH) > 4) moonphase -= 8; starpos = (sunpos + MAP_WIDTH * time_info.month / NUM_MONTHS) % MAP_WIDTH; /* The left end of the star_map will be straight overhead at midnight during month 0 */ for ( linenum = 0; linenum < MAP_HEIGHT; linenum++ ) { if ((time_info.hour >= 6 && time_info.hour <= 18) && (linenum < 3 || linenum >= 6)) continue; sprintf(buf," "); /* for ( i = MAP_WIDTH/4; i <= 3*MAP_WIDTH/4; i++)*/ for ( i = 1; i <= MAP_WIDTH; i++) { /* plot moon on top of anything else...unless new moon & no eclipse */ if ((time_info.hour >= 6 && time_info.hour <= 18) /* daytime? */ && (moonpos >= MAP_WIDTH/4 - 2) && (moonpos <= 3*MAP_WIDTH/4 + 2) /* in sky? */ && ( i >= moonpos - 2 ) && (i <= moonpos + 2) /* is this pixel near moon? */ && ((sunpos == moonpos && time_info.hour == 12) || moonphase != 0 ) /*no eclipse*/ && (moon_map[linenum-3][i+2-moonpos] == '@')) { if ((moonphase < 0 && i - 2 - moonpos >= moonphase) || (moonphase > 0 && i + 2 - moonpos <= moonphase)) strcat(buf,"&W@"); else strcat(buf," "); } else if ((linenum >= 3) && (linenum < 6) && /* nighttime */ (moonpos >= MAP_WIDTH/4 - 2) && (moonpos <= 3*MAP_WIDTH/4 + 2) /* in sky? */ && ( i >= moonpos - 2 ) && (i <= moonpos + 2) /* is this pixel near moon? */ && (moon_map[linenum-3][i+2-moonpos] == '@')) { if ((moonphase < 0 && i - 2 - moonpos >= moonphase) || (moonphase > 0 && i + 2 - moonpos <= moonphase)) strcat(buf,"&W@"); else strcat(buf," "); } else /* plot sun or stars */ { if (time_info.hour>=6 && time_info.hour<=18) /* daytime */ { if ( i >= sunpos - 2 && i <= sunpos + 2 ) { sprintf(buf2,"&Y%c",sun_map[linenum-3][i+2-sunpos]); strcat(buf,buf2); } else strcat(buf," "); } else { switch (star_map[linenum][(MAP_WIDTH + i - starpos)%MAP_WIDTH]) { default : strcat(buf," "); break; case ':' : strcat(buf,":"); break; case '.' : strcat(buf,"."); break; case '*' : strcat(buf,"*"); break; case 'G' : strcat(buf,"&G "); break; case 'g' : strcat(buf,"&g "); break; case 'R' : strcat(buf,"&R "); break; case 'r' : strcat(buf,"&r "); break; case 'C' : strcat(buf,"&C "); break; case 'O' : strcat(buf,"&O "); break; case 'B' : strcat(buf,"&B "); break; case 'P' : strcat(buf,"&P "); break; case 'W' : strcat(buf,"&W "); break; case 'b' : strcat(buf,"&b "); break; case 'p' : strcat(buf,"&p "); break; case 'Y' : strcat(buf,"&Y "); break; case 'c' : strcat(buf,"&c "); break; } } } } strcat(buf,"\n\r"); pager_printf_color(ch,buf); } }