SMAUG WIZNDUCT
Snippet

[download]
Wizinduct
This is really just a shameless hack of the induct/outcast code
to allow
wizards to quickly manage a players clan affiliation. The nice
aspect of
this code is that you won't have to fiddle with the number of
clan members
after induction/outcast nor will you have to manually get rid
of skills
that the player will no longer possess (which happens next time
the player
saves anyway, but, oh well).
The following changes will need to be made throughout the code:
1.Add the following line into DO_FUN *skill_function( char *name
) in
tables.c under case 'w':
if ( !str_cmp( name, "do_wizinduct" )) return
do_wizinduct;
2.Add the following line into char *skill_name( DO_FUN *skill
) in
tables.c:
if ( skill == do_wizinduct ) return "do_wizinduct";
3.Add the following command declaration in mud.h:
DECLARE_DO_FUN( do_wizinduct );
4.Add the code found in the accompianing snippet file:
If using UNIX, one recommended way is to use the following
commands:
cat clans.c snippet.c > clans.new
mv clans.c clans.old
mv clans.new clans.c
(Note from Thoric -- being a "wiz" command, you could
also place
this command in act_wiz.c)
5.Add the following lines into system\commands.dat:
#COMMAND
Name wizinduct~
Code do_wizinduct
Position 8
Level 61
Log 1
End
These settings are only recommended.
6.Add this entry into your local help file:
61 WIZINDUCT WIZOUTCAST~
Syntax: wizinduct <clan name|outcast> <player>
Wizinduct is a clan command. This command allows for immortals
to
manipulate clan membership while insuring that membership numbers
change correctly and clan affiliations are set/reset fully. This
includes speaking bits and guild-skills. Wizinduct outcast will
remove a character from a clan, while wizinduct clan name will
bring the designated character into the clan.
~
7.Recompile and restart.
This code has been tested upon both SaltWind MUD and Vanilla
SMAUG,
without any recognizable errors or memory leaks. The recommended
level of
command execution within Vanilla SMAUG would be 61, as this command
will
erase and clan affiliation. I am reluctant to create a 'patch',
as
SaltWind is a HEAVILY modified environment, but I will consider
such
distribution if the demand is heavy.
The code for this command can be found in the accompianing winduct.txt
file. Only the code of the function itself is included within
this file,
and other changes will have to made manually as per this document.
If you have any questions, you can e-mail Rjael at the following
e-mail
address:
mud@dredge.axcomp.com
This code is located on the SaltWind home page, found at the
following
address:
http://www.axcomp.com/~myrkatz/mud/winduct.html
Hope you have fun with this,
Rjael
/*
* Wizinduct code by Rjael (mud@dredge.axcomp.com) of SaltWind
MUD
* (Some minor fixes and safeguarding added by Thoric)
*/
void do_wizinduct ( CHAR_DATA *ch, char *argument)
{
char arg1[MAX_INPUT_LENGTH];
char arg2[MAX_INPUT_LENGTH];
char buf[MAX_STRING_LENGTH];
CHAR_DATA *victim;
CLAN_DATA *clan;
if ( IS_NPC(ch) || !IS_IMMORTAL(ch) )
{
send_to_char( "Huh?\n\r", ch );
return;
}
argument = one_argument( argument, arg1 );
argument = one_argument( argument, arg2 );
if ( arg1[0] == '\0' )
{
send_to_char( "Usage: wizinduct <clan|outcast> <player>\n\r",
ch );
return;
}
if ( !strcmp( arg1, "outcast" ) )
{
if ( arg2[0] == '\0' )
{
send_to_char( "Outcast whom?\n\r", ch );
return;
}
else
{
if ( (victim=get_char_room(ch, arg2)) == NULL )
{
send_to_char( "That player is not present.\n\r", ch
);
return;
}
if ( IS_NPC(victim) )
{
send_to_char( "They don't really care for clans anyway.\n\r",
ch );
return;
}
if ( victim->level > ch->level )
{
send_to_char( "They may not like you doing that.\n\r",
ch );
return;
}
if ( (clan=victim->pcdata->clan) == NULL )
{
sent_to_char( "They are not a member of any clan.\n\r",
ch );
return;
}
if ( clan->clan_type == CLAN_GUILD )
{
int sn;
for ( sn = 0; sn < top_sn; sn++ )
if ( skill_table[sn]->guild == victim->pcdata->clan->class
&& skill_table[sn]->name != NULL )
{
victim->pcdata->learned[sn] = 0;
ch_printf( ch, "You forget the ways of %s.\n\r", skill_table[sn]->name
);
}
}
if ( victim->speaking & LANG_CLAN )
victim->speaking = LANG_COMMON;
REMOVE_BIT( victim->speaks, LANG_CLAN );
--clan->members;
if ( !str_cmp(victim->name, clan->deity) )
{
STRFREE( clan->deity );
clan->deity = STRALLOC( "" );
}
if ( !str_cmp(victim->name, clan->leader) )
{
STRFREE( clan->leader );
clan->leader = STRALLOC( "" );
}
if ( !str_cmp(victim->name, clan->number1) )
{
STRFREE( clan->number1 );
clan->number1 = STRALLOC( "" );
}
if ( !str_cmp(victim->name, clan->number2) )
{
STRFREE( clan->number2 );
clan->number2 = STRALLOC( "" );
}
victim->pcdata->clan = NULL;
STRFREE(victim->pcdata->clan_name);
victim->pcdata->clan_name = STRALLOC( "" );
act( AT_MAGIC, "You remove $N from $t", ch, clan->name,
victim, TO_CHAR );
act( AT_MAGIC, "$n totally removes $N from $t", ch,
clan->name, victim, TO_ROOM );
act( AT_MAGIC, "$n totally removes you from $t", ch,
clan->name, victim, TO_VICT );
sprintf(buf, "The Immortal %s has removed %s from their clan!",
ch->name, victim->name);
echo_to_all(AT_MAGIC, buf, ECHOTAR_ALL);
save_char_obj( victim );
return;
}
}
else
{
clan = get_clan( arg1 );
if ( !clan )
{
send_to_char( "That clan does not exist.\n\r", ch );
return;
}
if ( arg2[0] == '\0' )
{
send_to_char( "Induct whom?\n\r", ch );
return;
}
else
{
if ( (victim=get_char_room(ch, arg2)) == NULL )
{
send_to_char( "That player is not present.\n\r", ch
);
return;
}
if ( IS_NPC(victim) )
{
send_to_char( "They dont really care for clans anyway.\n\r",
ch );
return;
}
if ( victim->pcdata->clan )
{
sent_to_char( "They are already a member of a clan/guild!\n\r",
ch );
return;
}
if ( clan->clan_type == CLAN_GUILD )
{
if ( victim->class != clan->class)
send_to_char( "Note: This player is not of the same class
as this guild.\n\rProceeding.\n\r", ch);
}
else
{
if ( victim->level < 10 )
{
send_to_char( "This player has yet to eat their Wheaties.\n\r",
ch);
return;
}
if ( victim->level > ch->level )
{
send_to_char( "They may not like you doing that.\n\r",
ch);
return;
}
}
++clan->members;
if ( clan->clan_type != CLAN_ORDER && clan->clan_type
!= CLAN_GUILD )
SET_BIT(victim->speaks, LANG_CLAN);
if ( clan->clan_type != CLAN_NOKILL && clan->clan_type
!= CLAN_ORDER
&& clan->clan_type != CLAN_GUILD )
SET_BIT( victim->pcdata->flags, PCFLAG_DEADLY );
if ( clan->clan_type == CLAN_GUILD )
{
int sn;
for ( sn = 0; sn < top_sn; sn++ )
{
if ( skill_table[sn]->guild == clan->class
&& skill_table[sn]->name != NULL )
{
victim->pcdata->learned[sn] = GET_ADEPT(victim, sn);
ch_printf( victim, "%s instructs you in the ways of %s.\n\r",
ch->name, skill_table[sn]->name);
}
}
}
victim->pcdata->clan = clan;
STRFREE(victim->pcdata->clan_name);
victim->pcdata->clan_name = QUICKLINK( clan->name );
act( AT_MAGIC, "You induct $N into $t", ch, clan->name,
victim, TO_CHAR );
act( AT_MAGIC, "$n inducts $N into $t", ch, clan->name,
victim, TO_ROOM );
act( AT_MAGIC, "$n adds you into $t", ch, clan->name,
victim, TO_VICT );
save_char_obj ( victim );
return;
}
}
}