Finger snippet - Originally coded by an unknown author, it was ported to SWR by
Atrox of Paradawn, and then modifed by Greven of DW, and then cleaned up by Gavin of DW.
You are free to distribute/modify/post this snippet as you see fit, as long you leave
all of the original comments and headers in the file.
This snippet allows people to share OOC information with people by entering it into
a sort of profile. These files can be viewed when the victim is both online and offline.
oh, BTW, the name for this command is from the unix command "finger" that gives online
status and times for users on the system, not what most people think it means :) - Greven
This snippet was tested on stock SWR 1.0, and should work on most SWR muds. It may require
som bludgeoning to make it work with other DIKU derivitives.
Version 1.01 removes check for can_see, since if they weren't online they would get the
file anyways, so...
mud.h
-----
Find:
long bank;
in pc_data, and add below it:
char * realname;
char * icq;
char * msn;
char * aolim;
char * yahoo;
Find:
/* newscore.c */
char * get_race args( (CHAR_DATA *ch) );
Below, add:
/* Finger.c */
void save_finger args( ( CHAR_DATA *ch ) );
Find the do_ declares, and add with them:
DECLARE_DO_FUN( do_setself );
DECLARE_DO_FUN( do_finger );
act_comm.c
------
in do_save, find:
saving_char = NULL;
send_to_char( "Ok.\n\r", ch );
below that, add:
#ifdef FINGER
save_finger( ch );
#endif
save.c
------
In function fwrite_char, find:
if ( ch->pcdata->homepage && ch->pcdata->homepage[0] != '\0' )
fprintf( fp, "Homepage %s~\n", ch->pcdata->homepage );
And below, add:
if ( ch->pcdata->aolim && ch->pcdata->aolim[0] != '\0' )
fprintf( fp, "Aim %s~\n", ch->pcdata->aolim );
if ( ch->pcdata->icq && ch->pcdata->icq[0] != '\0' )
fprintf( fp, "Icq %s~\n", ch->pcdata->icq );
if ( ch->pcdata->yahoo && ch->pcdata->yahoo[0] != '\0' )
fprintf( fp, "Yahoo %s~\n", ch->pcdata->yahoo );
if ( ch->pcdata->msn && ch->pcdata->msn[0] != '\0' )
fprintf( fp, "Msn %s~\n", ch->pcdata->msn );
if ( ch->pcdata->realname && ch->pcdata->realname[0] != '\0' )
fprintf( fp, "Realname %s~\n", ch->pcdata->realname );
Further down, in load_char_obj, find:
ch->pcdata->authed_by = STRALLOC( "" );
ch->pcdata->prompt = STRALLOC( "" );
And below that, add:
ch->pcdata->icq = STRALLOC( "" );
ch->pcdata->msn = STRALLOC( "" );
ch->pcdata->aolim = STRALLOC( "" );
ch->pcdata->yahoo = STRALLOC( "" );
ch->pcdata->realname = STRALLOC( "" );
In function fread_char, you need to add these to the right case, if the word starts with I,
put it in case I (ICQ, for example):
KEY( "Aim", ch->pcdata->aolim, fread_string( fp ) );
KEY( "Icq", ch->pcdata->icq, fread_string( fp ) );
KEY( "Msn", ch->pcdata->msn, fread_string( fp ) );
KEY( "Realname", ch->pcdata->realname, fread_string( fp ) );
You will probably have to add this:
case 'Y':
KEY( "Yahoo", ch->pcdata->yahoo, fread_string( fp ) );
break;
db.c
----
In free_char, find:
STRFREE( ch->pcdata->authed_by );
STRFREE( ch->pcdata->prompt );
Below, add this:
if ( ch->pcdata->realname )
STRFREE( ch->pcdata->realname );
if ( ch->pcdata->icq )
STRFREE( ch->pcdata->icq );
if ( ch->pcdata->msn )
STRFREE( ch->pcdata->msn );
if ( ch->pcdata->aolim )
STRFREE( ch->pcdata->aolim );
if ( ch->pcdata->yahoo )
STRFREE( ch->pcdata->yahoo );
if ( ch->pcdata->title )
Next, we need to edit the makefile.
Add finger.c and finger.o to your .o and .c files.
Below this line:
#DBUGFLG = -DREQUESTS
add this line:
DEFINES = -DFINGER
and on the line declaring C_FLAGS, add this to the end:
$(DEFINES)
Save, and exit.
tables.c
--------
find:
if ( skill == do_force ) return "do_force";
and below, add:
#ifdef FINGER
if ( skill == do_finger ) return "do_finger";
if ( skill == do_setself ) return "do_setself";
#endif
Find:
if ( !str_cmp( name, "do_freeze" )) return do_freeze;
Below, add:
#ifdef FINGER
if ( !str_cmp( name, "do_finger" )) return do_finger;
#endinf
Find:
if ( !str_cmp( name, "do_shout" )) return do_shout;
Below, add:
#ifdef FINGER
if ( !str_cmp( name, "do_setself" )) return do_setself;
#endif
Compile clean, compile, and reboot your mud. Now, whenever anyone saves, it should save/update the file.
Inside your mud, use cedit to create the commands:
cedit finger create
cedit setself create
cedit save cmdtable
That should do it. Enjoy! -Greven