allships.txt
snippets · 4.5 KB · 2010-03-30
Allships v2.0: replaces the stock allships command so you can browse ships by class.
Download « Back to the snippets list
Allships Command v2.0
What this does:
This will replace your stock allships command and allow you to browse certain ship
classes if you so desire. It also allows for ships to have little 2 character tags that identify
the ship class. ie. (SF) = starfighter.
What you will need to change:
spacec.c
*Always remember to backup the files you will change incase of an error with installation, or
an error with the code.
cp <filename> <newfilename>.bak
What you will need to add:
Nothing.
-------------------------------------------------------------------------------------------------
space.c
Find,
void do_allships( CHAR_DATA *ch, char *argument )
Comment out the entire function or delete it and replace it with,
#define ALL_SHIP -1
void do_allships(CHAR_DATA *ch, char *argument)
{
SHIP_DATA *ship;
int count = 0;
int ship_class = 0;
int stfcount = 0;
int midcount = 0;
int capcount = 0;
int placount = 0;
int mobcount = 0;
if ( argument[0] == '\0' )
{
send_to_char("&CSyntax&B: &Wfreeships &B[&wall&B/&wfighter&B/&wmidsize&B/&wcapital&B]\n\r", ch );
return;
}
else if ( !str_cmp(argument, "all" ) )
ship_class = ALL_SHIP;
else if ( !str_cmp(argument, "fighter" ) )
ship_class = FIGHTER_SHIP;
else if ( !str_cmp(argument, "midsize" ) )
ship_class = MIDSIZE_SHIP;
else if ( !str_cmp(argument, "capital" ) )
ship_class = CAPITAL_SHIP;
else
ship_class = ALL_SHIP;
count = 0;
send_to_char( "\n\r&B------------------------------------------------------------------------------\n\r", ch );
send_to_char( "&CThe following ships are currently formed&B:\n\r", ch );
send_to_char( "&CShip Price Location\n\r", ch );
for ( ship = first_ship; ship; ship = ship->next )
{
if ( ship->class > SHIP_PLATFORM )
continue;
if ( ship_class != ALL_SHIP && ship->class != ship_class )
continue;
{
ch_printf( ch, "&B(&w%s&B) %s%-35s %-15s ",
ship->class == FIGHTER_SHIP ? "SF" :
(ship->class == MIDSIZE_SHIP ? "MS" :
(ship->class == CAPITAL_SHIP ? "CS" :
(ship->class == SHIP_PLATFORM ? "PF" : "??" ) ) ),
ship->type == MOB_SHIP ? "&Y" :
(ship->type == SHIP_REPUBLIC ? "&r" :
(ship->type == SHIP_IMPERIAL ? "&g" :
(ship->type == SHIP_CIVILIAN ? "&C" : "&w" ) ) ),
ship->name, ship->owner );
if( ship->type == MOB_SHIP || ship->class == SHIP_PLATFORM )
{
ch_printf( ch, "" );
mobcount++;
}
if ( !str_cmp(ship->owner, "Public") )
{
ch_printf( ch, "500 to rent.\n\r" );
}
else if ( str_cmp(ship->owner, "" ) )
ch_printf( ch, "%s", "\n\r" );
else
ch_printf( ch, "%ld to buy.\n\r", get_ship_value(ship) );
count++;
stfcount++;
}
}
if ( count )
{
ch_printf( ch, "\n\r&B------------------------------------------------------------------------------\n\r" );
ch_printf( ch, " &CFighters&B: &W%3d &CMidships&B: &W%3d\n\r", stfcount, midcount );
ch_printf( ch, " &CCapitals&B: &W%3d &CPlatform&B: &W%3d\n\r", capcount, placount );
ch_printf( ch, " &CMob Ship&B: &W%3d\n\r", mobcount );
ch_printf( ch, " &CTotal&B: &W%3d\n\r", count );
ch_printf( ch, "&B------------------------------------------------------------------------------\n\r" );
return;
}
else
{
send_to_char( "&rThere are no ships currently formed.\n\r", ch );
return;
}
}
#undef ALL_SHIP
-------------------------------------------------------------------------------------------------
make clean
make
copyover/reboot the mud
There, that wasn't too bad.
Any problems please contact me at the provided email address,
-,,,.,,,,-
_'Diablo'_ Star Wars Development
''''''
[*]------------------------------------------------[*]
||| If you have any problems please contact me at: |||
||| crazy_mike_316@hotmail.com |||
[*]------------------------------------------------[*]