/
mythran/log/
mythran/player/
mythran/player/c/
mythran/player/m/
mythran/player/r/
mythran/player/t/
This snippet contains the mythran mud clan system, written on july 18, 1996
The system is very easy and expandable, and features clans with 10 levels
(from initiate and recruit allt the way to recruiter, leader and clan god.
It allows clans their own donation pit and recall room. And every clanmember
can use the clantalk channel (clantalk or '>') to communicate with the other
clan members. Each clan can have it's own restrictions for players who want
to join the clan (Think about alignment, race or class, amount of money,
level, age or sex, etc, etc...) And the system features a very ingenious
way for players to become clan members. I'll describe this below.

Let's say player 'clanner' would want to join clan 'Mythran'
Maniac is the clan leader of clan 'Mythran', and Mythran is the clan god
of clan mythran, we also have a recruiter, called 'Eclipse'

clanner would type: clan apply mythran, to notify the clan leaders he wants
th join the clan. This is done by sending a note to the clan.
Clanner must then be initiated for the clan. this can be done by any
clanmember of level initiater of above (recruiter, leader, god)
From that time clanner can hear the messages on the clantalk channel,
and can use some of the clan commands. He then needs to be made a full
clan-member. This can only he done by clan-recruiters (or above).
with the command: clan recruit clanner. Of course you could make the
to-be clan member do a quest to prove his worthyness to the clan
before recruiting him. once the player has been recruited into the clan,
he becomes a level 1 clan member.
Leaders (and above) can advance, demote and kick clan members they don't
like and who do not follow clan-rules. Leadership of the clan can be
given to another clan member if the leader decides it is time to do so.
Immortal leaders (clan gods) can make other players clan leader.

Copyright and Copying notice.
	-Everyone may use this code freely, as long as the original help
	 entries are included into the mud help, and my name and all comments
	 remain in the source code.
	-I am not responsible for any damage done to your mud code or anything
	 else (like players getting arguments over being power hungry and stuff)
	-If you find any buys, report them to me (i'll tell you when I have
	 email again... at the moment I have NO internet access what so ever)
	-I will not force you to remove this code from your mud ever, this
	 code was (like ALL my code) written for the public, and for
	 public use. If someone (in your mud, are via other ways) asks you
	 where you got your nice clan system, you MUST give them the code, or
	 directions on how to get it from me. We must all promote the writing
	 of code for the public, that's the only way great things will ever
	 be made.
	-New versions of this code can be found on my snippets page, which
	 URL I cannot tell you now, since my username will be changing shortly,
	 but I also allways release my code on the merc-l (merc-l@webnexus.com)
	 (the mails I send with source code in them always have the word
	 CODE: in the beginning of the subject, so you can easily find all the
	 interesting mails in your box.)

Well I think that was enuff bragging about it... let's see some code...

-------------------------------------------------------------------------------
MYTHRAN MUD CLAN SYSTEM version 1.0, written: july 18, 1996   rel: july 20 1996
Written by Maniac from Mythran Mud, currently running nowhere...
You can find me mostly on Crystal Unicorn: columbia.igc.net 4000
-------------------------------------------------------------------------------
Well first of all place the code below in the file clan.c and don't forget
to include clan.o in your O_FILES list in your Makefile

-------------clan.c------------------clan.c--------------clan.c----------------

/***************************************************************************
 *  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.                              *
 *                                                                         *
 *  Envy Diku Mud improvements copyright (C) 1994 by Michael Quan, David   *
 *  Love, Guilherme 'Willie' Arnold, and Mitchell Tse.                     *
 *                                                                         *
 *  EnvyMud 2.0 improvements copyright (C) 1995 by Michael Quan and        *
 *  Mitchell Tse.                                                          *
 *                                                                         *
 *  In order to use any part of this Envy Diku Mud, you must comply with   *
 *  the original Diku license in 'license.doc', the Merc license in        *
 *  'license.txt', as well as the Envy license in 'license.nvy'.           *
 *  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.                                                  *
 ***************************************************************************/

/*
 * Mythran Mud clan system
 * Version 0.1
 * Written by Maniac
 *
 * History:
 * july 17, 1996:	First version, features various clan commands, like
 *			apply, initiate, recruit, advance, kick, talk
 * july 18, 1996:	Added some minor commands, and fixed a few.
 *			Added clan donate, (in act_obj.c)
 * july 23, 1996:	Added clan recall (in act_move.c) and crecall command
 *
 */

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

/* External functions */
void    talk_channel    args( ( CHAR_DATA *ch, char *argument,
                            int channel, const char *verb ) );


int clan_lookup(const char *name)
{
	int clan;

	for (clan = 0; clan_table[clan].vnum != 0 ; clan++)
	{
		if (LOWER(name[0]) == LOWER(clan_table[clan].name[0])
		    &&  !str_prefix(name,clan_table[clan].name))
			return clan_table[clan].vnum;
	}

	return CLAN_NONE;
}

char * clan_name( int clan )
{
	int	i;

	if (clan == CLAN_NONE)
		return (char *)"None";
	if (clan == CLAN_EXILE)
		return (char *)"Exile";

	for(i = 0; clan_table[i].vnum != 0; i++)
		if (clan_table[i].vnum == clan)
			return (char *)clan_table[clan].name;

	return "Error";
}

/* Is same clan... written by Maniac */
bool is_same_clan( CHAR_DATA * ch, CHAR_DATA * victim )
{
	if (IS_NPC(victim) )	/* No npc's... */
		return FALSE;
	if (IS_NPC(ch) )
		return FALSE;

	/* 2x clan none or exile still doesn't make it a clan... */
	if (ch->pcdata->clan <= CLAN_NONE)
		return FALSE;
	if (victim->pcdata->clan <= CLAN_NONE)
		return FALSE;

	if (victim->pcdata->clan == ch->pcdata->clan)
		return TRUE;
	return FALSE;
}

bool is_in_clan( CHAR_DATA *ch )
{
	if (IS_NPC(ch) )
		return FALSE;

	if (ch->pcdata->clanlevel < CLAN_LEVEL_1 )
		return FALSE;		/* Only full members */

	if (ch->pcdata->clan > CLAN_NONE )
		return TRUE;

	return FALSE;
}

bool is_clan_member( CHAR_DATA *ch, int vnum )
{
	if (ch->pcdata->clan == vnum )
		return TRUE;
	return FALSE;
}


void do_clanrecall( CHAR_DATA *ch, char *argument)
{
        do_recall(ch, "clan");
}


void do_clantalk( CHAR_DATA *ch, char *argument )
{
	if (!is_in_clan(ch))
	{
		send_to_char ("You are not in a clan... so don't clantalk...\n\r", ch);
		return;
	}

	if ( IS_AFFECTED( ch, AFF_MUTE )
		|| IS_SET( ch->in_room->room_flags, ROOM_CONE_OF_SILENCE ) )
	{
		send_to_char( "You can't seem to break the silence.\n\r", ch );
		return;
	}

	if (argument[0] == '\0' )
	{
		TOGGLE_BIT( ch->deaf, CHANNEL_CLAN );
		send_to_char ("Clan channel toggled.\n\r", ch );
		return;
	}

	talk_channel( ch, argument, CHANNEL_CLAN, "clantalk" );
	return;
}


void do_clan( CHAR_DATA *ch, char *argument )
{
	char		buf[MAX_STRING_LENGTH];
	char		arg1[MAX_INPUT_LENGTH];
	char		arg2[MAX_INPUT_LENGTH];
	char		arg3[MAX_INPUT_LENGTH];
	CHAR_DATA *	victim;
	int		clan;
	int		level;

	if (IS_NPC( ch ) )
	{
		send_to_char ("You are not interested in clans.\n\r", ch);
		return;
	}

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

	if ( arg1[0] == '\0' )
	{
		send_to_char ("Syntax: clan [function] [parameters].\n\r", ch );
		send_to_char ("Functions: info, who, talk, apply, kick,\n\r", ch);
		send_to_char ("advance, recruit, initiate, leader, leave\n\r", ch );
		return;
	}

	if ( !str_prefix( arg1, "info" ) )
	{
		sprintf (buf, "You are member of clan %s (level %d).\n\r",
		    clan_name(ch->pcdata->clan),
		    (ch->pcdata->clanlevel - CLAN_INITIATE ) );
		send_to_char( buf, ch );
		return;
	}

	else if ( !str_prefix( arg1, "apply" ) )
	{
		if ( ch->pcdata->clan == CLAN_EXILE )
		{
    send_to_char ("You have already been in a clan, and have been exiled.\n\r", ch);
    send_to_char ("This means you can't join any clans anymore...\n\r", ch);
    send_to_char ("\t\tHave a nice day.\n\r", ch);
			return;
		}

		if ( is_in_clan (ch) )
		{
			send_to_char ("You are already in a clan...\n\r", ch);
			return;
		}

		if (arg2[0] == '\0' )
		{
			send_to_char ("Usage: clan apply <clanname>\n\r", ch);
			return;
		}

		if (( clan = clan_lookup(arg2)) <= CLAN_NONE )
		{
			send_to_char ("That is not a valid clan.\n\r", ch );
			return;
		}

		if ( ch->level < 10 )
		{
			send_to_char ("You have to be level 10 to join a clan.\n\r", ch );
			return;
		}

		if (!clan_accept(ch, clan ) )
		{
			send_to_char ("You do not have the right qualities the clan\n\r", ch );
			send_to_char ("Requires from you, you have not been accepted.\n\r", ch );
			return;
		}

		sprintf (buf, "note to %s", clan_name(clan) );
		interpret (ch, buf );
		interpret (ch, "note subject I want to join the clan");
		interpret (ch, "note + Please let me join...");
		interpret (ch, "note send" );

		send_to_char ("Your application has been accepted.\n\r", ch );
		send_to_char ("The clan leaders will discuss your membership at\n\r", ch);
		send_to_char ("next clan meeting, you will hear from us.\n\r", ch );
		ch->pcdata->clan = clan;
		ch->pcdata->clanlevel = CLAN_APPLICANT;
	} /* Apply */

	else if (!str_prefix( arg1, "initiate" ))
	{
		if ( !is_in_clan(ch) )
		{
			send_to_char ("You are not with a clan.\n\r", ch );
			return;
		}

		if ( ch->pcdata->clanlevel < CLAN_APPLICATOR )
		{
			send_to_char ("You have no power to initiate members.\n\r", ch );
			return;
		}

		if (arg2[0] == '\0' )
		{
			send_to_char ("Who do you wish to initiate.\n\r", ch );
			return;
		}

		if ((victim = get_char_world(ch, arg2 ) ) == NULL )
		{
			sprintf (buf, "You can't find %s.\n\r", arg2 );
			send_to_char(buf, ch );
			return;
		}

		if ( victim->pcdata->clanlevel != CLAN_APPLICANT )
		{
			sprintf (buf, "%s has not applied for a clan.\n\r",
			    victim->name);
			send_to_char(buf, ch );
			return;
		}

		if ( !is_same_clan (ch, victim) )
		{
			sprintf (buf, "%s hasn't applied for YOUR clan.\n\r",
			    victim->name );
			send_to_char(buf, ch );
			return;
		}

		victim->pcdata->clanlevel = CLAN_INITIATE;
		sprintf (buf, "Ok, %s has been accepted as applicant.\n\r", victim->name );
		send_to_char (buf, ch );
		send_to_char ("Your application has been acccepted, you are now a clan initiate.\n\r", victim);
		return;
	} /* initiate */

	else if (!str_prefix ( arg1, "advance" ) )
	{
		if ( !is_in_clan(ch) )
		{
			send_to_char ("You are not with a clan.\n\r", ch );
			return;
		}

		if ( ch->pcdata->clanlevel < CLAN_LEADER )
		{
			send_to_char ("You have no power to advance members.\n\r", ch );
			return;
		}

		if (arg2[0] == '\0' )
		{
			send_to_char ("Who do you wish to advance.\n\r", ch );
			return;
		}

		if ((victim = get_char_world(ch, arg2 ) ) == NULL )
		{
			sprintf (buf, "You can't find %s.\n\r", arg2 );
			send_to_char(buf, ch );
			return;
		}

		if ( !is_same_clan( ch, victim ) )
		{
			sprintf (buf, "%s isn't a member of YOUR clan.\n\r",
			    victim->name );
			send_to_char(buf, ch );
			return;
		}

		if (victim->pcdata->clanlevel >= ch->pcdata->clanlevel )
		{
			sprintf (buf, "You are not powerfull enough to advance %s.\n\r",
			    victim->name );
			send_to_char( buf, ch );
			return;
		}

		if (victim->pcdata->clanlevel >= CLAN_LEVEL_5 )
		{
			sprintf (buf, "%s is already at maximum clan level.\n\r",
				victim->name );
			send_to_char (buf, ch );
			return;
		}

		if (arg3[0] == '\0')
		{
			victim->pcdata->clanlevel++;
		}
		else
		{
			level = atoi(arg3);
			if ((level < 1 ) || (level > 5 ) )
			{
				send_to_char ("Levelrange is 1 to 4.\n\r", ch );
				return;
			}
			victim->pcdata->clanlevel = (CLAN_INITIATE + level);
		}
		sprintf (buf, "%s is now clanlevel %d.\n\r",
		    victim->name, (victim->pcdata->clanlevel - CLAN_INITIATE) );
		send_to_char (buf, ch );
		sprintf (buf, "You are now clanlevel %d.\n\r",
			(victim->pcdata->clanlevel - CLAN_INITIATE ) );
		send_to_char (buf, victim );
		return;
	} /* Advance */

        else if (!str_prefix( arg1, "recruit" ))
        {
                if ( !is_in_clan( ch ) )
                {
                        send_to_char ("You are not with a clan.\n\r", ch );
                        return;
                }

                if ( ch->pcdata->clanlevel < CLAN_RECRUITER )
                {
                        send_to_char ("You have no power to recruit members.\n\r", ch );
                        return;
                }

                if (arg2[0] == '\0' )
                {
                        send_to_char ("Who do you wish to recruit.\n\r", ch );
                        return;
                }

                if ((victim = get_char_world(ch, arg2 ) ) == NULL )
                {
                        sprintf (buf, "You can't find %s.\n\r", arg2 );
                        send_to_char(buf, ch );
                        return;
                }

                if ( victim->pcdata->clanlevel != CLAN_INITIATE )
                {
                        sprintf (buf, "%s has yet been initiated for the clan.\n\r",
                            victim->name);
                        send_to_char(buf, ch );
                        return;
                }

                if ( !is_same_clan( ch, victim ) )
                {
                        sprintf (buf, "%s isn't a member of YOUR clan.\n\r",
                            victim->name );
                        send_to_char(buf, ch );
                        return;
                }

                victim->pcdata->clanlevel++;
                sprintf (buf, "Ok, %s has been accepted as a full clan member.\n\r",
		    victim->name );
		send_to_char (buf, ch );
                send_to_char ("You are now a full clan member (level 1).\n\r", victim );
                return;
        } /* recruit */

	else if (!str_prefix ( arg1, "leader" ) )
	{
		if ( !is_in_clan(ch) )
		{
			send_to_char ("You are not with a clan.\n\r", ch );
			return;
		}

		if ( ch->pcdata->clanlevel < CLAN_LEADER )
		{
			send_to_char ("You have no power to make members leaders.\n\r", ch );
			return;
		}

		if (arg2[0] == '\0' )
		{
			send_to_char ("Who do you wish to advance to a leader.\n\r", ch );
			return;
		}

		if ((victim = get_char_world(ch, arg2 ) ) == NULL )
		{
			sprintf (buf, "You can't find %s.\n\r", arg2 );
			send_to_char(buf, ch );
			return;
		}

		if ( !is_same_clan( ch, victim ) )
		{
			sprintf (buf, "%s isn't a member of YOUR clan.\n\r",
			    victim->name );
			send_to_char(buf, ch );
			return;
		}

		if (victim->pcdata->clanlevel >= ch->pcdata->clanlevel )
		{
			sprintf (buf, "You are not powerfull enough to advance %s.\n\r",                    victim->name );
			send_to_char( buf, ch );
			return;
		}

		if (IS_IMMORTAL(ch) && (ch->pcdata->clanlevel == CLAN_GOD ) )
		{
			if (victim->pcdata->clanlevel == CLAN_LEADER)
			{
				victim->pcdata->clanlevel--;
				send_to_char ("Ok... done.\n\r", ch );
			}
			else
			{
				victim->pcdata->clanlevel = CLAN_LEADER;
				send_to_char ("Ok... done.\n\r", ch );
				send_to_char ("You are now a clan leader.\n\r", victim );
			}
			return;
		}
		else if (ch->pcdata->clanlevel == CLAN_LEADER )
		{
			send_to_char ("Ok... you are no longer a leader.\n\r", ch );
			if (victim->pcdata->clanlevel < CLAN_LEADER )
			{
				victim->pcdata->clanlevel = CLAN_LEADER;
				send_to_char ("You are now clan leader.\n\r", victim );
			}
			return;
		}
		else
		{
			send_to_char ("Something is wrong with leader, notify coders.\n\r", ch );
			return;
		}
	} /* Leader */

	else if (!str_cmp ( "leave", arg1 ) )
	{
		if (!is_in_clan(ch) )
		{
			send_to_char ("But you are not in a clan...\n\r", ch);
			return;
		}

		if (arg2[0] == '\0')
		{
			send_to_char ("Are you very sure you want to leave the clan ??\n\r", ch );
			send_to_char ("If so, type: clan leave, but with the string below as argument.\n\r", ch );
			sprintf ( buf, "%s\n\r", ch->pcdata->pwd );
			send_to_char (buf, ch);
			return;
		}
		else if (!str_cmp( arg2, ch->pcdata->pwd) )
		{
			send_to_char ("OK... you are now exiled.\n\r", ch );
			ch->pcdata->clan = CLAN_EXILE;
			ch->pcdata->clanlevel = CLAN_NOLEVEL;
			return;
		}
		else
		{
			send_to_char ("That was not the correct string.\n\r", ch );
			return;
		}
	}

	else if (!str_prefix (arg1, "kick" ) )
	{
		if ( !is_in_clan(ch) )
		{
			send_to_char ("You are not with a clan.\n\r", ch );
			return;
		}

		if ( ch->pcdata->clanlevel < CLAN_RECRUITER )
		{
			send_to_char ("You have no power to kick members.\n\r", ch );
			return;
		}

		if (arg2[0] == '\0' )
		{
			send_to_char ("Who do you wish to kick.\n\r", ch );
			return;
		}

		if ((victim = get_char_world(ch, arg2 ) ) == NULL )
		{
			sprintf (buf, "You can't find %s.\n\r", arg2 );
			send_to_char(buf, ch );
			return;
		}

		if ( !is_same_clan( ch, victim ) )
		{
			sprintf (buf, "%s isn't a member of YOUR clan.\n\r",
			    victim->name );
			send_to_char(buf, ch );
			return;
		}

		if (victim->pcdata->clanlevel >= ch->pcdata->clanlevel )
		{
			sprintf (buf, "You are not powerfull enough to kick %s.\n\r",                    victim->name );
			send_to_char( buf, ch );
			return;
		}

		/* Ok... do it... */
		victim->pcdata->clan = CLAN_EXILE;
		victim->pcdata->clanlevel = CLAN_NOLEVEL;
		send_to_char ("You have been kicked from the clan.\n\r", victim );
		send_to_char ("You are now exiled.\n\r", victim );
		sprintf (buf, "%s has been exiled.", victim->name );
		send_to_char (buf, ch );
		return;
	}

	else if (!str_prefix ( arg1, "who" ) )
	{
		return;
	}

	else
	{
		send_to_char ("Unknown option.\n\r", ch );
		return;
	}
}

void do_guild( CHAR_DATA *ch, char *argument )
{
	char		arg1[MAX_INPUT_LENGTH];
	char		arg2[MAX_INPUT_LENGTH];
	char		arg3[MAX_INPUT_LENGTH];
	char		buf[MAX_STRING_LENGTH];
	CHAR_DATA *	victim;
	int		clan;
	int		level;

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

	if ( arg1[0] == '\0' )
	{
		send_to_char( "Syntax: guild <char> <cln name> <level>\n\r",ch);
		return;
	}

	if ( ( victim = get_char_world( ch, arg1 ) ) == NULL )
	{
		send_to_char( "They aren't playing.\n\r", ch );
		return;
	}

	if (IS_NPC(victim))
	{
		send_to_char( "Only on players.\n\r", ch );
		return;
	}

	if ( arg2[0] == '\0' )
	{
		sprintf(buf,"%s is member of clan %s (level %d).\n\r",
		victim->name, capitalize(clan_table[ch->pcdata->clan].name),
		(victim->pcdata->clanlevel - CLAN_INITIATE) );
                send_to_char(buf,ch);
		return;
	}

	if (!str_prefix(arg2,"none"))
	{
		sprintf (buf, "%s is now clanless.\n\r", victim->name);
		send_to_char(buf, ch);
		send_to_char("You are now a member of no clan!\n\r",victim);
		victim->pcdata->clan = CLAN_NONE;
		victim->pcdata->clanlevel = CLAN_NOLEVEL;
		return;
	}

	if (!str_prefix(arg2,"exile"))
	{
		sprintf (buf, "%s is now exiled.\n\r", victim->name);
		send_to_char(buf, ch);
		send_to_char("You are now exiled\n\r",victim);
		victim->pcdata->clan = CLAN_EXILE;
		victim->pcdata->clanlevel = CLAN_NOLEVEL;
		return;
	}

	if (arg3[0] == '\0' )
		level = CLAN_APPLICANT;
	else
		level = (CLAN_INITIATE + atoi(arg3));

	if ((clan = clan_lookup(arg2)) == 0)
	{
		send_to_char("No such clan exists.\n\r",ch);
		return;
	}
	else
	{
		sprintf(buf,"%s is now a member of clan %s (level %d).\n\r",
		    victim->name, capitalize(clan_table[clan].name),
		    (level - CLAN_INITIATE) );
		send_to_char(buf,ch);
		sprintf(buf,"You are now a member of clan %s (level %d).\n\r",
		capitalize(clan_table[clan].name),
		    (level - CLAN_INITIATE ) );
	}

	victim->pcdata->clan = clan;
	victim->pcdata->clanlevel = level;
}

int clan_accept(CHAR_DATA *ch, int clan )
{
	if (clan == CLAN_MYTHRAN)
	{
		if (ch->alignment < 0 )	/* Accept good chars only */
		{
			send_to_char ("You must be of good alignment to join clan Mythran.\n\r", ch );
			return FALSE;
		}
		if (ch->level < 15 )
		{
			send_to_char ("You must be level 15 to join clan Mythran.\n\r", ch );
			return FALSE;	/* Must be level 15 */
		}
		if (ch->gold < 50000 )
		{
			send_to_char ("You don't have enough money to join clan Mythran.\n\r", ch );
			return FALSE;	/* only wealthy players... */
		}
	}
	return TRUE;
}


----------------end of clan.c-------------------end of clan.c-------------------

OK.. let's continue with some small snippets of code...

this goes in merc.h

Just add this somewhere near the classes defines..


/*
 * Clans
 */
/* The clans */
#define CLAN_EXILE              -1
#define CLAN_NONE               0
#define CLAN_MYTHRAN            1	/* Just as an example */
#define CLAN_DRAGON		2	/* Another example */

/* Clan levels */
#define CLAN_NOLEVEL            -1
#define CLAN_APPLICANT          0
#define CLAN_INITIATE           1
#define CLAN_LEVEL_1            2
#define CLAN_LEVEL_2            3
#define CLAN_LEVEL_3            4
#define CLAN_LEVEL_4            5
#define CLAN_LEVEL_5            6
#define CLAN_APPLICATOR         7
#define CLAN_RECRUITER          8
#define CLAN_LEADER             9
#define CLAN_GOD                10


Add this stuct after the race struct.

struct clan_type
{
        int     vnum;                   /* Clan number                  */
        char *  name;                   /* Clan name                    */
        char *  who_name;               /* CLan who name                */
        int     pit;                    /* Clan donation pit obj vnum   */
        int     pitroom;                /* Clan don pit room vnum       */
        int     rooms           [ 3 ];  /* Clan rooms                   */
        int     recall;                 /* Clan recall room             */
};

In the CHANNEL bits, add a CHANNEL_CLAN

In pcdata add these 2 lines
    int                 clan;
    int                 clanlevel;

Add this line under the heading 'global constants'
extern  const   struct  clan_type       clan_table      [ ];

Add these new DECLARE_DO_FUN 's
DECLARE_DO_FUN( do_clantalk     );      /* Clan talk */
DECLARE_DO_FUN( do_guild        );      /* Change chars clan options */
DECLARE_DO_FUN( do_clan         );      /* Clan command, manipulate clans */
DECLARE_DO_FUN( do_clanrecall	);	/* Clan recall */

Add this near the end of merc.h

/* clan.c */
int     clan_lookup     args( ( const char * name) );
char *  clan_name       args( ( int clan ) );
int     clan_accept     args( ( CHAR_DATA *ch, int clan ) );
bool    is_same_clan    args( ( CHAR_DATA *ch, CHAR_DATA *victim ) );
bool    is_in_clan      args( ( CHAR_DATA *ch ) );
bool    is_clan_member  args( ( CHAR_DATA *ch, int vnum ) );
void    guild           args( ( CHAR_DATA *ch, char * argument) );

Add this in const.c, under the class table...

/*
 * Clan table.
 */

/*
 *       int     vnum;                    Clan number
 *       char *  name;                    Clan name
 *       char *  who_name;                CLan who name
 *       int     pit;                     Clan donation pit obj vnum
 *       int     pitroom;                 Clan don pit room vnum
 *       int     rooms           [ 3 ];   Clan rooms
 *       int     recall;                  Clan recall room
 */

const   struct  clan_type       clan_table      []     =
{
        {
                -1, "None", "None", 0, 0, {0, 0, 0}, 0
        },

        {			/* Example clan 1 */
                1,
                "Mythran",
                "mythran",
                1240, 1240,
                { 1240, 1241, 1242 },
                1240
        },

        {
                2,		/* Example clan 2 */
                "Dragon",
                "dragon",
                1250, 1250,
                { 1250, 1251, 1252 },
                1250
        },

        /* Last entry */
        {
                0, "", "", 0, 0, {0, 0, 0}, 0
        }
};

Add the following entries in the command table in interp.c
    { "guild",          do_guild,       POS_DEAD,    L_JUN,  LOG_ALWAYS },
    { "clan",           do_clan,        POS_DEAD,        1,  LOG_NORMAL },
    { ">",              do_clantalk,    POS_DEAD,        0,  LOG_NORMAL },
    { "clantalk",       do_clantalk,    POS_DEAD,        0,  LOG_NORMAL },
    { "crecall",	do_clanrecall,	POS_FIGHTING,	 0,  LOG_NORMAL },


If you want clan donate, replace the standard envy donate by this modified
version.

/* Contributed by BoneCrusher of EnvyMud. */
/* Modyfied for clan's by Maniac from Mythran mud */
void do_donate( CHAR_DATA *ch, char *arg )
{
    OBJ_DATA *  container = NULL;
    OBJ_DATA *  obj;
    OBJ_DATA *  obj_next;
    ROOM_INDEX_DATA *   room;
    int         pitvnum = 0;
    int         roomvnum = 0;
    char        arg1[MAX_INPUT_LENGTH];

    arg = one_argument( arg, arg1 );

    if ( arg1[0] == '\0' )
    {
        send_to_char( "Donate what?\n\r", ch );
        return;
    }

    if (is_in_clan( ch ) )
    {
        pitvnum = clan_table[ch->pcdata->clan].pit;
        roomvnum = clan_table[ch->pcdata->clan].pitroom;

        room = get_room_index (roomvnum);
        for (container = room->contents ; container; container = container->next )
        {
                if (container->pIndexData->vnum == pitvnum )
                {
                        log_string ("Found clan donation pit");
                        break;
                }
        }
    }
    if (!container)
    {
        if ( ( container = get_obj_world( ch, "donation" ) ) == NULL )
        {
                send_to_char( "The donation pit is missing from the world.\n\r", ch );
                log_string ("Can't find donation pit");
                return;
        }
    }

    if ( str_cmp( arg1, "all" ) && str_prefix( "all.", arg1 ) )
    {
        if ( ( obj = get_obj_carry( ch, arg1 ) ) == NULL )
        {
            send_to_char( "You do not have that item.\n\r", ch );
            return;
        }

        if ( !can_drop_obj( ch, obj ) )
        {
            send_to_char( "You can't let go of it.\n\r", ch );
            return;
        }

        if ( get_obj_weight( obj ) + get_obj_weight( container )
          > container->value[0] )
        {
            send_to_char( "It won't fit.\n\r", ch );
            return;
        }

        if ( obj->item_type == ITEM_TRASH
            || obj->item_type == ITEM_FOOD
            || obj->item_type == ITEM_KEY
            || obj->item_type == ITEM_PILL )
        {
            act("You send $p flying to the $P.", ch, obj, container, TO_CHAR );
            act("$n sends $p flying to the $P.", ch, obj, container, TO_ROOM );
            extract_obj( obj );
            return;
        }

        obj_from_char( obj );
        obj_to_obj( obj, container );
        act( "$n sends $p flying to the $P.", ch, obj, container, TO_ROOM );
        act( "You send $p flying to the $P.", ch, obj, container, TO_CHAR );
        send_to_room( "A loud clank is heard from the pit!",
                     container->in_room );
    }
    else
    {
        for ( obj = ch->carrying; obj; obj = obj_next )
        {
            obj_next = obj->next_content;

            if ( ( arg1[3] == '\0' || is_name( &arg1[4], obj->name ) )
                && can_see_obj( ch, obj )
                && obj->wear_loc == WEAR_NONE
                && obj != container
                && can_drop_obj( ch, obj )
                && get_obj_weight( obj ) + get_obj_weight( container )
                <= container->value[0] )
            {

                if ( obj->item_type == ITEM_TRASH
                    || obj->item_type == ITEM_FOOD
                    || obj->item_type == ITEM_KEY
                    || obj->item_type == ITEM_PILL )
                {
                    act( "You send $p flying to the $P.", ch, obj, container,
                        TO_CHAR );
                    act( "$n sends $p flying to the $P.", ch, obj, container,
                        TO_ROOM );
                    extract_obj( obj );
                    continue;
                }

                obj_from_char( obj);
                obj_to_obj( obj, container );
                act( "$n sends $p flying to the $P.", ch, obj, container,
                    TO_ROOM );
                act( "You send $p flying to the $P.", ch, obj, container,
                    TO_CHAR );
                send_to_room( "A loud clank is heard from the pit!\n\r",
                     container->in_room );
            }
        }
    }

    return;

}


in act_comm.c, add this just before the end of is_note_to

    /* For clan mail, by Maniac */
    if ( is_name( clan_name(ch->pcdata->clan), pnote->to_list ) &&
                ( ch->pcdata->clanlevel >= CLAN_APPLICATOR ) )
        return TRUE;

In talk_channel, add this: (only the line with CHANNEL_CLAN, and continue)

            if ( channel == CHANNEL_IMMTALK && !IS_HERO( och ) )
                continue;
            if ( ( channel == CHANNEL_CLAN ) && ( !is_same_clan( ch, vch) ) )
                continue;
            if ( channel == CHANNEL_YELL

Add do_score, to display the clan, you'll have to do this yourself, since
by do score has been completely modyfied form standard. but here are some
hints:
clan_name(wch->pcdata->clan) 	/* This will give you the clan name, and
				exile or none if that is required)

Add this to do_channels:

        if ( is_in_clan(ch) )
        {
            send_to_char( !IS_SET( ch->deaf, CHANNEL_CLAN )
                        ? " +CLAN"
                        : " -clan",
                        ch );
        }

And add this a bit later on in that function (just one line)

        else if ( !str_cmp( arg+1, "yell"     ) ) bit = CHANNEL_YELL;
        else if ( !str_cmp( arg+1, "clan"     ) ) bit = CHANNEL_CLAN; /* This */
        else


And add this in save.c, in fwrite_char

    fprintf( fp, "Sx          %d\n",    ch->sex                 ); /*not this*/
    fprintf( fp, "Cla         %d\n",    ch->class               ); /*not this*/
    if (!IS_NPC(ch) )						/* THIS */
    {
        fprintf( fp, "Clan        %s~\n",       clan_name(ch->pcdata->clan) );
        fprintf( fp, "Clanlev     %d\n",        ch->pcdata->clanlevel );
    }
		/* leave the rest out... grin */
    fprintf( fp, "Race        %s~\n",   race_table[ ch->race ].name );

Add this in the fread_char function:

        case 'C':
            KEY( "Cla",         ch->class,              fread_number( fp ) );
/* this */ KEY( "Clan",        ch->pcdata->clan, clan_lookup(fread_string(fp));
/* this */ KEY( "Clanlev",     ch->pcdata->clanlevel,  fread_number( fp ) );

            if ( !str_cmp( word, "Cond" ) )
 

--------------------------------------------------------------------------------
Well... that's about it for now... more will follow shortly... i hope...


					-- Maniac --


Personal greets:

	Envymud staff:	I don't know is 2.2 is released, but feel free to
			include this code, i would be honored.
	Canth:		You got your new email ??? call me...
	CU-Mud Staff:	If you ever get this: i'll try to be back a.s.a.p
			after I do some more Envy coding.