void do_news( CHAR_DATA *ch, char *argument ) { char arg1[MAX_NEWS_LENGTH], buf[MIL], arg2[MAX_NEWS_LENGTH]; if ( IS_NPC( ch ) ) return; if ( argument && argument[0] == '\0' ) { send_to_char( "\r\nuso: noticias [<opción>]\r\n", ch ); send_to_char( "Opción puede ser: version, todas, ultima [<#>], primera [<#>], [#]\r\n", ch ); if ( IS_IMMORTAL( ch ) ) { send_to_char( "\r\nUso: noticias [<campo>]\r\n", ch ); send_to_char( "Campo puede ser: agregar, cargar, editar, eliminar\r\n", ch ); send_to_char( " <fecha>, lista\r\n", ch ); return; } return; } if ( argument && argument[0] != '\0' ) { argument = one_argument( argument, arg1 ); if ( !str_cmp( arg1, "version" ) ) { ch_printf_color( ch, "&cT&Che &cE&Clder &cC&Chronicles &cV&Cersion&c: &W%s&c.\r\n", NEWS_VERSION ); return; } else if ( is_number( arg1 ) ) { show_news( ch, TYPE_SHOW_ONE, atoi( arg1 ) ); return; } else if ( !str_cmp( arg1, "todas" ) ) { show_news( ch, TYPE_ALL, -1 ); send_to_char( "\r\nPara más detalles teclea 'ayuda noticias'\r\n", ch ); return; } else if ( !str_cmp( arg1, "primera" ) ) { int show_count = -1; argument = one_argument( argument, arg2 ); if ( !arg2 || arg2[0] == '\0' ) { show_count = -1; } else { if ( is_number( arg2 ) ) show_count = atoi( arg2 ); else show_count = -1; } show_news( ch, TYPE_LIST_FIRST, show_count ); } else if ( !str_cmp( arg1, "ultima" ) ) { int show_count = -1; argument = one_argument( argument, arg2 ); if ( !arg2 || arg2[0] == '\0' ) { show_count = 5; } else { if ( is_number( arg2 ) ) show_count = atoi( arg2 ); else show_count = -1; } show_news( ch, TYPE_LIST_LAST, show_count ); send_to_char( "\r\nPara más detalles teclea 'ayuda noticias'\r\n", ch ); return; } else if ( !IS_IMMORTAL( ch ) ) { show_news( ch, TYPE_NORMAL, -1 ); return; } else if ( !str_cmp( arg1, "html" ) ) { if ( !argument || argument[0] == '\0' ) { ch_printf_color( ch, "&C&Gel sistema de noticias en HTML está &C&W%s&C&G.\r\n", USE_HTML_NEWS == TRUE ? "activado" : "desactivado" ); return; } else if ( !str_cmp( argument, "cambiar" ) || !str_cmp( argument, "activar" ) || !str_cmp( argument, "desactivar" ) ) { if ( !str_cmp( argument, "cambiar" ) ) USE_HTML_NEWS = !USE_HTML_NEWS; else if ( !str_cmp( argument, "activar" ) ) USE_HTML_NEWS = TRUE; else USE_HTML_NEWS = FALSE; do_news( ch, ( char * ) "html" ); write_news( ); if ( USE_HTML_NEWS == TRUE ) generate_html_news( ); return; } else { do_news( ch, ( char * ) "html" ); do_help( ch, ( char * ) "noticias" ); return; } } else if ( !str_cmp( arg1, "agregar" ) && ( argument && argument[0] != '\0' ) ) { add_news( argument ); send_to_char_color( "&C&GNoticia añadida.\r\n", ch ); /* * Send the message about a note being posted to the mud */ snprintf( buf, MIL, "¡Hay una nueva noticia por %s!", ch->name ); announce( buf ); } else if ( !str_cmp( arg1, "cargar" ) ) { clear_news( FALSE, 0 ); load_news( ); if ( USE_HTML_NEWS == TRUE ) generate_html_news( ); send_to_char_color( "&C&GNoticias cargadas.\r\n", ch ); } else if ( !str_cmp( arg1, "lista" ) ) { show_news( ch, TYPE_IMM_LIST, -1 ); } else if ( !str_cmp( arg1, "eliminar" ) && ( argument && argument[0] != '\0' ) ) { bool clearAll = FALSE; if ( !str_cmp( argument, "todas" ) ) { clearAll = TRUE; } if ( !clearAll && !is_number( argument ) ) { send_to_char_color( "El argumento debe ser un número de noticia o todas.\r\n", ch ); return; } if ( clearAll != TRUE ) clear_news( TRUE, atoi( argument ) ); else clear_news( FALSE, 0 ); write_news( ); if ( USE_HTML_NEWS == TRUE ) generate_html_news( ); send_to_char_color( "&C&GNoticias eliminadas.\r\n", ch ); } else { do_help( ch, ( char * ) "noticias" ); return; } } else { show_news( ch, TYPE_NORMAL, -1 ); } }
int show(void) { char *p; void (*cfunc)(int); void (*sfunc)(int); void (*bfunc)(int); struct natstr *natp; int tlev; char buf[1024]; int rlev; again: p = getstarg(player->argp[1], "Show what ('?' to list options)? ", buf); if (!p || !*p) return RET_SYN; if (*p == '?') { pr("bridge, item, land, news, nuke, plane, sect, ship, product, tower, updates\n"); goto again; } natp = getnatp(player->cnum); rlev = (int)(1.25 * natp->nat_level[NAT_RLEV]); if (!player->argp[3]) { tlev = (int)(1.25 * natp->nat_level[NAT_TLEV]); if (player->god) tlev = 1000; } else { tlev = (int)atoi(player->argp[3]); if (tlev > (int)(1.25 * natp->nat_level[NAT_TLEV]) && !player->god) tlev = (int)(1.25 * natp->nat_level[NAT_TLEV]); } if (player->god) rlev = 1000; switch (*p) { case 'b': show_bridge(99999); return RET_OK; case 't': show_tower(99999); return RET_OK; case 'i': show_item(99999); return RET_OK; case 'n': if (*(p + 1) == 'e') { show_news(99999); return RET_OK; } if (drnuke_const > MIN_DRNUKE_CONST) tlev = ((rlev / drnuke_const) > tlev ? tlev : (rlev / drnuke_const)); bfunc = show_nuke_build; cfunc = show_nuke_capab; sfunc = show_nuke_stats; break; case 'l': bfunc = show_land_build; sfunc = show_land_stats; cfunc = show_land_capab; break; case 'p': if (p[1] == 'r') { show_product(99999); return RET_OK; } bfunc = show_plane_build; sfunc = show_plane_stats; cfunc = show_plane_capab; break; case 's': if (*(p + 1) == 'e') { bfunc = show_sect_build; sfunc = show_sect_stats; cfunc = show_sect_capab; } else { bfunc = show_ship_build; sfunc = show_ship_stats; cfunc = show_ship_capab; } break; case 'u': show_updates(player->argp[2] ? atoi(player->argp[2]) : 8); return RET_OK; default: return RET_SYN; } p = getstarg(player->argp[2], "Build, stats, or capability data (b,s,c)? ", buf); if (!p || !*p) return RET_SYN; pr("Printing for tech level '%d'\n", tlev); if (*p == 'B' || *p == 'b') bfunc(tlev); else if (*p == 'C' || *p == 'c') cfunc(tlev); else if (*p == 'S' || *p == 's') sfunc(tlev); else return RET_SYN; return RET_OK; }