Not sure totaly what you mean by a clan roster but this is a nice little one
I made that keeps track of all memebers in all tribes in one list. Their is
functions in it tho to have it only print the particular tribe your looking
for. I made it to work with Garys clan code so it stores the clans with ints
and the same with ranks. Use the change function to add people and remove
people. And us the Update to update existing people. It was a snippet for a
automated wizlist that I altered to work for my tribes if ya have any
questions just ask.

----- Original Message -----
From: "Frank W." <[EMAIL PROTECTED]>
To: <[email protected]>
Sent: Saturday, October 05, 2002 5:37 PM
Subject: Any working clan roster codes?


> I have been having trouble finding a working clan roster code most of them
> are either incomplete or don't work and i have spent hours messing with
them
> and I still have not got any working. Help please.
>
>
>
>
> _________________________________________________________________
> MSN Photos is the easiest way to share and print your photos:
> http://photos.msn.com/support/worldwide.aspx
>
>
> --
> ROM mailing list
> [email protected]
> http://www.rom.org/cgi-bin/mailman/listinfo/rom
>
/***************************************************************************   
 *  Original Diku Mud copyright (C) 1990, 1991 by Sebastian Hammer,        *
 *  Michael Seifert, Hans Henrik St{rfeldt, Tom Madsen, and Katja Nyboe.   *
 *                                                                         *
 *  Merc Diku Mud improvments copyright (C) 1992, 1993 by Michael          *
 *  Chastain, Michael Quan, and Mitchell Tse.                              *
 *                                                                         *
 *  In order to use any part of this Merc Diku Mud, you must comply with   *
 *  both the original Diku license in 'license.doc' as well the Merc       *
 *  license in 'license.txt'.  In particular, you may not remove either of *
 *  these copyright notices.                                               *
 *                                                                         *
 *  Much time and thought has gone into this software and you are          *
 *  benefitting.  We hope that you share your changes too.  What goes      *
 *  around, comes around.                                                  *
 ***************************************************************************/

/***************************************************************************
*       ROM 2.4 is copyright 1993-1995 Russ Taylor                         *
*                                                                          *
*       ROM has been brought to you by the ROM consortium                  *
*           Russ Taylor ([EMAIL PROTECTED])                                *
*           Gabrielle Taylor ([EMAIL PROTECTED])                           *
*           Brian Moore ([EMAIL PROTECTED])                                *
*                                                                          *
*       By using this code, you have agreed to follow the terms of the     *
*       ROM license, in the file Rom24/doc/rom.license                     *
***************************************************************************/

/*************************************************************************** 
*       ROT 1.4 is copyright 1996-1997 by Russ Walsh                       *
*                                                                          *
*       By using this code, you have agreed to follow the terms of the     *
*       ROT license, in the file doc/rot.license                           *
***************************************************************************/

/*************************************************************************** 
*       This code was put in by Lucas Clav/Rico Suave/Jed/Bobo the Big fat *
*       clown(joke), ported from ROT 1.4 to ROM2.4B(supposedly)... Should  *
*       work... har har har!!!                                             *
****************************************************************************/
/*************************************************************************** 
*       This code was rewriten by Dale Kingston (Sarix) for a tribal clan list 
of all the 
*       members of a tribe for a ROM2.4B should work with no problems
*        any questions or comments please email [EMAIL PROTECTED]
****************************************************************************/

#if defined(macintosh)
#include <types.h>
#include <time.h>
#else
#include <sys/types.h>
#include <sys/time.h>
#endif
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <time.h>
#include "mud.h"
#include "recycle.h"

/*extern char                    boot_buf[MAX_STRING_LENGTH]; */
TRIBE_DATA *tribe_list;


/*
 * Local functions.
 */
void    change_tribelist        args( (CHAR_DATA *ch, bool add, int rank, char 
*argument, int tribe));



void save_tribelist(void)
{
    TRIBE_DATA *pTribe;
    FILE *fp;
    bool found = FALSE;
        long time;

    fclose( fpReserve ); 
    if ( ( fp = fopen( TRIBE_FILE, "w" ) ) == NULL )
    {
        perror( TRIBE_FILE );
    }

    for (pTribe = tribe_list; pTribe != NULL; pTribe = pTribe->next)
    {
        found = TRUE;
        time = pTribe->laston;
        fprintf(fp, "%s %d %d %ld %d\n", pTribe->name, pTribe->rank, 
pTribe->tribe, time, pTribe->level);
     }

     fclose(fp);
     fpReserve = fopen( NULL_FILE, "r" );
     if (!found)
        unlink(TRIBE_FILE);
}

void load_tribelist(void)
{
    FILE *fp;
    TRIBE_DATA *tribe_last;
 
    if ( ( fp = fopen( TRIBE_FILE, "r" ) ) == NULL )
    {
        return;
    }
 
    tribe_last = NULL;
    for ( ; ; )
    {
        TRIBE_DATA *pTribe;
        if ( feof(fp) )
        {
            fclose( fp );
            return;
        }
 
        pTribe = new_tribe();
 
        pTribe->name = str_dup(fread_word(fp));
                pTribe->rank = fread_number(fp);
                pTribe->tribe = fread_number(fp);
                pTribe->laston = fread_number(fp);
                pTribe->level = fread_number(fp);
                fread_to_eol(fp);

        if (tribe_list == NULL)
            tribe_list = pTribe;
        else
            tribe_last->next = pTribe;
        tribe_last = pTribe;
    }
}

void  do_tribelist(CHAR_DATA *ch, char *argument)
{
    char arg1[MAX_INPUT_LENGTH];
    char arg2[MAX_INPUT_LENGTH];
    char arg3[MAX_INPUT_LENGTH];
    char arg4[MAX_INPUT_LENGTH];
/*    char buf[MAX_STRING_LENGTH]; */
    int rank;
    int tribe;


    argument = one_argument( argument, arg1 );
    argument = one_argument( argument, arg2 );
    argument = one_argument( argument, arg3 );
    argument = one_argument( argument, arg4 );

    if ((arg1[0] != '\0') && (get_trust(ch) >= (MAX_LEVEL - 1)))
    {
                if ( !str_prefix( arg1, "add" ) )
                {
                    if ( !is_number( arg2 ) || ( arg3[0] == '\0' ) )
                    {
                                send_to_char( "Syntax: tribelist add <tribe> 
<name> <rank>\n\r", ch);
                                return;
                    }
                    tribe = atoi(arg2);
                    rank = atoi(arg4);
                    change_tribelist( ch, TRUE, rank, arg3, tribe);
                    return;
                }
                if ( !str_prefix( arg1, "delete" ) )
                {
                    if ( arg2[0] == '\0' )
                    {
                                send_to_char( "Syntax: tribelist delete 
<name>\n\r", ch );
                                return;
                    }
            
                    change_tribelist( ch, FALSE, 0, arg2, 0);
                    return;
                }
        send_to_char( "Syntax:\n\r", ch );
        send_to_char( "       tribelist delete <name>\n\r", ch );
        send_to_char( "       tribelist add <tribe> <name>\n\r", ch );
        return;
    }

    if (tribe_list == NULL)
    {
                send_to_char("Their is no tribe Record at this time.\n\r",ch);
                return;
    }
    list_tribes(ch, "all");

}
void list_tribes(CHAR_DATA *ch, char *arg)
{
        int tribe = 0;
        int s;
        char date[MSL];
        BUFFER *buffer;
        char buf[MSL];
        TRIBE_DATA *pTribe;
        bool all = FALSE, found = FALSE;
        
        buffer = new_buf();

        if (!str_cmp(arg, "all") || !str_cmp(arg, "All"))
                all = TRUE;

        if(!all)
                for (tribe = 1; tribe != 5; tribe++)
                {
                        if (!str_cmp(capitalize(arg), clan_table[tribe].name))
                                {
                                        found = TRUE;
                                        break;
                                }
                }
                if (!found && !all)
                {
                        send_to_char("No Tribe by that name.\n\r", ch);
                        return;
                }
        

   if(all)
   for (tribe = 1; clan_table[tribe].name[0] != '\0'; tribe++)
        {
                if (tribe == 1)
        add_buf(buffer, "The Tribe Members of Realms of the Forgotten\n\n\r");

                sprintf(buf, "%s's members:\n\n\r", clan_table[tribe].name);
                add_buf(buffer, buf);

                for ( pTribe = tribe_list; pTribe && pTribe->name != NULL; 
pTribe = pTribe->next )
                {
                        if (pTribe->tribe != tribe)
                                continue;
                         sprintf(date, "%s", (char *) ctime(&pTribe->laston ));

                        for (s =0; date[s] != '\0'; s++);
                        date[s - 1] = '\0';

                        sprintf(buf, "%-3d %15s {c%-15s{w %s\n\r", 
pTribe->level, strcap_color(20, clan_table[tribe].rank[pTribe->rank].rankname), 
strcap_color( 15, pTribe->name), date);
                        add_buf(buffer, buf);
                }
                add_buf(buffer, "\n\r");
        }
        if (found && !all)
        {
                sprintf(buf, "%s Tribe Members:\n\n\r", clan_table[tribe].name);
                add_buf(buffer, buf);

                for ( pTribe = tribe_list; pTribe && pTribe->name != NULL; 
pTribe = pTribe->next )
                {
                        if (pTribe->tribe != tribe)
                                continue;

                         sprintf(date, "%s", (char *) ctime(&pTribe->laston ));

                        for (s =0; date[s] != '\0'; s++);
                        date[s - 1] = '\0';

                        sprintf(buf, "%-3d %15s {c%-15s{w %s\n\r", 
pTribe->level, strcap_color(20, clan_table[tribe].rank[pTribe->rank].rankname), 
strcap_color( 15, pTribe->name), date);
                        add_buf(buffer, buf);
                }
                add_buf(buffer, "\n\r");
        }
                
    page_to_char( buf_string(buffer), ch );
    free_buf(buffer);
    return;
}
void update_tribelist(CHAR_DATA *ch, int rank, int tribe, int laston, int level)
{
    TRIBE_DATA *prev;
    TRIBE_DATA *curr;

    if (IS_NPC(ch) || IS_IMMORTAL(ch))
    {
        return;
    }
  
    prev = NULL;
    for ( curr = tribe_list; curr != NULL; prev = curr, curr = curr->next )
    {
        if ( !str_cmp( ch->name, curr->name ) )
        {
            if ( prev == NULL )
                tribe_list   = tribe_list->next;
            else
                prev->next = curr->next;

            free_tribe(curr);
            save_tribelist();
        }
    }
    if (tribe <= 0)
    {
        return;
    }
    curr = new_tribe();
    curr->name = str_dup(ch->name);
    curr->rank = rank;
    curr->tribe = tribe;
    curr->laston = laston;
    curr->level = level;
    curr->next = tribe_list;
    tribe_list = curr;
    save_tribelist();
    return;
}

void change_tribelist(CHAR_DATA *ch, bool add, int rank, char *argument, int 
tribe)
{
    char arg[MAX_INPUT_LENGTH];
    TRIBE_DATA *prev;
    TRIBE_DATA *curr;
     
    one_argument( argument, arg );

    if ( !add )
    {
                prev = NULL;
        for ( curr = tribe_list; curr != NULL; prev = curr, curr = curr->next)
        {
            if ( !str_cmp( capitalize( arg ), curr->name ) )
            {
                if ( prev == NULL )
                    tribe_list   = tribe_list->next;
                else
                    prev->next = curr->next;
 
                free_tribe(curr);
                save_tribelist();
            }
        }
    } else
    {
        curr = new_tribe();
        curr->name = str_dup( capitalize( arg ) );
        curr->rank = rank;
        curr->tribe = tribe;
        curr->next = tribe_list;
        tribe_list = curr;
        save_tribelist();
    }
    return;
}

Reply via email to