atd/area/
atd/build/
atd/clans/
atd/log/
atd/player/store/
atd/site/
atd/src/bin/
#if defined(macintosh)
#include <types.h>
#else
#include <sys/types.h>
#endif
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include "merc.h"

/*
 * globals
 */
char * all_capitalize  args ( (const char * arg ) );

/*
 * New do_config by Dreimas
 */
struct plr_config
{
    char * name;
    int type;
    int bit;
    bool is_on;
    char * on_msg;
    char * off_msg;
};


const  struct wiznet_type wiznet_table[] =
{
    {
        "Logs",       WIZ_LOGS,   9, "{g", "LOGS",
        "[+LOGS      ] You see logged strings.\n\r",
        "[-logs      ] You do not see loged strings.\n\r"
    },

    {
        "Logins", WIZ_LOGINS, 8, "{B", "LOGIN",
        "[+LOGINS   ] Shows details of players connecting to the mud.\n\r",
        "[-logins   ] Not showing details of players connecting.\n\r"
    },

    {
        "Ticks", WIZ_TICKS, 8, "{D", "TICKS",
        "[+TICKS    ] Informs you of ALL area updates.\n\r",
        "[-ticks    ] You are not informed of area updates.\n\r"
    },

    {
        "Debug", WIZ_DEBUG, 8, "{m", "BUGS",
        "[+DEBUG    ] Notifies you of any errors.\n\r",
        "[-debug    ] You are not told of errors.\n\r"
    },

    {
        "Commands", WIZ_COMMANDS, 10, "{b", "CMDS",
        "[+COMMANDS ] You are notified of use of logged immortal commands.\n\r",
        "[-commands ] You are not told of the use of logged immortal commands.\n\r"
    },

    {
        "Create", WIZ_CREATE, 8, "{p", "CREATE",
        "[+CREATE   ] You are notified of use of logged mortal commands.\n\r",
        "[-create   ] You are not told of the use of logged mortal commands.\n\r"
    },

    {
        "Misc", WIZ_MISC, 8, "{c", "MISC",
        "[+MISC     ] Miscellaneous info is on.\n\r",
        "[-misc     ] Miscellaneous info is off.\n\r"
    },
	
    { NULL, 0, 0, NULL, NULL }
};


#define ACT_CONFIG 0
#define PLR_CONFIG 1


void do_config( CHAR_DATA *ch, char *argument )
{
    char arg[MAX_INPUT_LENGTH];
    int  x;
    bool fSet = FALSE;

    struct plr_config config [] =
    {
        {
            "ansi", ACT_CONFIG, PLR_ANSI, FALSE,
            "You have ansi colour on.\n\r",
            "You have ansi colour off.\n\r"
        },
        {
            "autoexit", ACT_CONFIG, PLR_AUTOEXIT, FALSE,
            "You automatically see exits.\n\r",
            "You don't automatically see exits.\n\r"
        },
        {
            "autoloot", ACT_CONFIG, PLR_AUTOLOOT, FALSE,
            "You automatically loot corpses.\n\r",
            "You don't automatically loot corpses.\n\r"
        },
        {
            "autosac", ACT_CONFIG, PLR_AUTOSAC, FALSE,
            "You automatically sacrifice corpses.\n\r",
            "You don't automatically sacrifice corpses.\n\r"
        },
        {
            "autocrack", ACT_CONFIG, PLR_AUTOCRACK, FALSE,
            "You automatically crack heads.\n\r",
            "You don't automatically crack heads.\n\r"
        },
        {
            "autohead", PLR_CONFIG, PLR_AUTOHEAD, FALSE,
            "You automatically sacrifice heads.\n\r",
            "You don't automatically sacrifice heads.\n\r"
        },
        {
            "automap", PLR_CONFIG, PLR_AUTOMAPPER, FALSE,
            "Automapper is currently working.\n\r",
            "Automapper is currently off.\n\r"
        },
        {
            "extrasc", PLR_CONFIG, PLR_AUTOLEVEL, FALSE,
            "More information will be displayed in score.\n\r",
            "Normal information will be displayed in score.\n\r"
        },
        {
            "blank", ACT_CONFIG,PLR_BLANK, FALSE,
            "You have a blank line before your prompt.\n\r",
            "You have no blank line before your prompt.\n\r"
        },
        {
            "brief", ACT_CONFIG, PLR_BRIEF, FALSE,
            "You see brief descriptions.\n\r",
            "You see long descriptions.\n\r"
        },
        {
            "batself", PLR_CONFIG, PLR_BATTLESELF, FALSE,
            "Your attacks are being shown in condensed format.\n\r",
            "You will see normal fights.\n\r"
        },
	{
	    "batother", PLR_CONFIG, PLR_BATTLEOTHER, FALSE,
	    "Others attacks are being shown in condensed format.\n\r",
	    "Others attacks are being shown normal style.\n\r"
	},
        {
	    "talkfast", PLR_CONFIG, PLR_SPEAKSLOW, FALSE,
	    "You are now talking without say or '.\n\r",
	    "You must talk with say or '.\n\r"
	},
        {
            "prompt", ACT_CONFIG, PLR_PROMPT, FALSE,
            "You have a prompt.\n\r",
            "You dont have a prompt.\n\r"
        },
        {
            "telnetga", ACT_CONFIG, PLR_TELNET_GA, FALSE,
            "You recieve a telnet GA sequence.\n\r",
            "You don't recieve a telnet GA sequence.\n\r"
        },
	{
	    "combine", ACT_CONFIG, PLR_COMBINE, FALSE,
	    "You see combined messages on look.\n\r",
	    "You dont see combined messages on look.\n\r"
        },
        {
            "", PLR_CONFIG, 0, FALSE,
            "",
            ""
        }
    };

#undef ACT_TYPE
#undef PLR_TYPE

    if ( IS_NPC(ch) )
	return;

    one_argument( argument, arg );

/*
 * Loop through and check off the ones that need to be checked.
 * Also does some error checking along the way -- Dreimas
 */
    for( x = 0; *config[x].name; x++ )
    {
	switch( config[x].type )
	{
	default:
	   bugf( "Invalid type in do_config.(%d)", config[x].type );
	   return;
	case ACT_CONFIG:
	   config[x].is_on = IS_SET(ch->act,config[x].bit);
	   break;
	case PLR_CONFIG:
	   config[x].is_on = xIS_SET(PC(ch,plr_flags),config[x].bit);
	   break;
	}
    }	
    if ( arg[0] == '\0' )
    {
        const char * on_color  = "{n";
        const char * off_color = "{D";
        
        send_to_char( "[ Keyword  ] Option\n\r", ch );

        for( x = 0; *config[x].name; x++ )
        {
            ch_printf( ch, "[ %s%8.8s {x] %s",
                       config[x].is_on ? on_color : off_color,
                       config[x].is_on
                          ? all_capitalize(config[x].name) : config[x].name,
                       config[x].is_on ? config[x].on_msg : config[x].off_msg );
        }
        if ( IS_SET( ch->act, PLR_SILENCE ) )
            stc("{RYou are silenced.{x\n\r", ch );
        if ( IS_SET( ch->act, PLR_NO_EMOTE ) )
            stc( "{RYou can't 'emote'.{x\n\r", ch );
        if ( IS_SET( ch->act, PLR_NO_TELL ) )
            stc( "{RYou can't use 'tell'.\n\r", ch );
	ch_printf( ch, "Your page length is set to 40 lines.\n\r", ch);
        return;
    }

         if( arg[0] == '+' ) fSet = TRUE;
    else if( arg[0] == '-' ) fSet = FALSE;
    else
    {
        send_to_char( "Config -option or +option?\n\r", ch );
        send_to_char( "See 'help config' for more information.\n\r", ch );
        return;
    }
    
    for( x = 0; *config[x].name; x++ )
    {
        if( !str_cmp( arg+1, config[x].name ) )
        {
            switch( config[x].type )
            {
            default:
                ch_printf( ch, "{RInvalid configuration type for %s.  Please inform Immortals.\n\r",
                           config[x].name );
                return;
            case ACT_CONFIG:
                if( fSet )
                    SET_BIT( ch->act, config[x].bit );
                else
                    REMOVE_BIT( ch->act, config[x].bit );
                break;
            case PLR_CONFIG:
                if( fSet )
                    xSET_BIT( PC(ch,plr_flags), config[x].bit );
                else
                    xREMOVE_BIT( PC(ch,plr_flags), config[x].bit );
                break;
            }
            send_to_char( "Ok.\n\r", ch );
            return;
        }
    }
    return;
}


void do_autoexit( CHAR_DATA *ch, char *argument )
{
    if ( IS_NPC(ch) ) return;
    if ( IS_SET(ch->act, PLR_AUTOEXIT))
        do_config(ch,"-autoexit");
    else
        do_config(ch,"+autoexit");
    return;
}

void do_autoloot( CHAR_DATA *ch, char *argument )
{
    if ( IS_NPC(ch) ) return;
    if (IS_SET(ch->act, PLR_AUTOLOOT)) do_config(ch,"-autoloot");
    else do_config(ch,"+autoloot");
    return;
}

void do_autosac( CHAR_DATA *ch, char *argument )
{
    if ( IS_NPC(ch) ) return;
    if (IS_SET(ch->act, PLR_AUTOSAC)) do_config(ch,"-autosac");
    else do_config(ch,"+autosac");
    return;
}

void do_autohead( CHAR_DATA *ch, char *argument )
{
    if ( IS_NPC(ch) ) return;
    if (PLR_FLAGS(ch,PLR_AUTOHEAD)) do_config(ch,"-autohead");
    else do_config(ch,"+autohead");
    return;
}

void do_autocrack( CHAR_DATA *ch, char *argument )
{
    if ( IS_NPC(ch) ) return;
    if (IS_SET(ch->act, PLR_AUTOCRACK)) do_config(ch,"-autocrack");
    else do_config(ch,"+autocrack");
    return;
}

void do_blank( CHAR_DATA *ch, char *argument )
{
    if ( IS_NPC(ch) ) return;
    if (IS_SET(ch->act, PLR_BLANK)) do_config(ch,"-blank");
    else do_config(ch,"+blank");
    return;
}

void do_ansi( CHAR_DATA *ch, char *argument )
{
    if( IS_NPC(ch) ) return;
    if( IS_SET(ch->act, PLR_ANSI ) )
	do_config( ch, "-ansi" );
    else
	do_config( ch, "+ansi" );
    return;
}
void do_brief( CHAR_DATA *ch, char *argument )
{
    if ( IS_NPC(ch) ) return;
    if (IS_SET(ch->act, PLR_BRIEF)) do_config(ch,"-brief");
    else do_config(ch,"+brief");
    return;
}

/* Do_prompt from Morgenes from Aldara Mud */
void do_prompt( CHAR_DATA *ch, char *argument )
{
   char buf [ MAX_STRING_LENGTH ];

   buf[0] = '\0';
   if ( IS_NPC(ch) ) return;

   if ( argument[0] == '\0' )
   {
       do_help( ch, "prompt" );
       return;
   }

   if( !str_cmp( argument, "on" ) )
   {
      if (IS_EXTRA(ch, EXTRA_PROMPT))
         send_to_char("But you already have customised prompt on!\n\r",ch);
      else
      {
         send_to_char("Ok.\n\r",ch);
         SET_BIT(ch->extra, EXTRA_PROMPT);
      }
      return;
   }
   else if( !str_cmp( argument, "off" ) )
   {
      if (!IS_EXTRA(ch, EXTRA_PROMPT))
         send_to_char("But you already have customised prompt off!\n\r",ch);
      else
      {
         send_to_char("Ok.\n\r",ch);
         REMOVE_BIT(ch->extra, EXTRA_PROMPT);
      }
      return;
   }
   else if( !str_cmp( argument, "clear" ) )
   {
      free_string(ch->prompt);
      ch->prompt = str_dup( "" );
      return;
   }
   else
   {
      if ( strlen( argument ) > 50 )
	  argument[50] = '\0';
      smash_tilde( argument );
      strcat( buf, argument );
   }

   free_string( ch->prompt );
   ch->prompt = str_dup( buf );
   send_to_char( "Ok.\n\r", ch );
   return;
} 

/* Do_prompt from Morgenes from Aldara Mud */
void do_cprompt( CHAR_DATA *ch, char *argument )
{
   char buf [ MAX_STRING_LENGTH ];

   buf[0] = '\0';
   if ( IS_NPC(ch) ) return;

   if ( argument[0] == '\0' )
   {
       do_help( ch, "cprompt" );
       return;
   }

   if( !str_cmp( argument, "clear" ) )
   {
      free_string(ch->cprompt);
      ch->cprompt = str_dup( "" );
      return;
   }
   else
   {
      if ( strlen( argument ) > 50 )
	  argument[50] = '\0';
      smash_tilde( argument );
      strcat( buf, argument );
   }

   free_string( ch->cprompt );
   ch->cprompt = str_dup( buf );
   send_to_char( "Ok.\n\r", ch );
   return;
}


/*
 * Stock channels code in LoW 4
 */
void do_channels( CHAR_DATA *ch, char *argument )
{
    char arg[MAX_INPUT_LENGTH];

    one_argument( argument, arg );

    if (IS_NPC(ch)) return;
    if ( arg[0] == '\0' )
    {
	if ( !IS_NPC(ch) && IS_SET(ch->act, PLR_SILENCE) )
	{
	    send_to_char( "You are silenced.\n\r", ch );
	    return;
	}

	send_to_char( "Channels:", ch );

/*	send_to_char( !IS_SET(ch->deaf, CHANNEL_AUCTION)
	    ? " +AUCTION"
	    : " -auction",
	    ch );
*/
	send_to_char( !IS_SET(ch->deaf, CHANNEL_CHAT)
	    ? " +CHAT"
	    : " -chat",
	    ch );

        send_to_char( !IS_SET(ch->deaf, CHANNEL_BITCH)
            ? " +BITCH"
            : " -bitch",
            ch );

        send_to_char( !IS_SET(ch->deaf, CHANNEL_GSOCIAL)
            ? " +GSOCIAL"
            : " -gsocial",
            ch );

        send_to_char( !IS_SET(ch->deaf, CHANNEL_HINT)
           ? " +HINT"
           : " -hint",
           ch );

        send_to_char( !IS_SET(ch->deaf, CHANNEL_QTALK)
           ? " +QTALK"
           : " -qtalk",
           ch );

        send_to_char( !IS_SET(ch->deaf, CHANNEL_NEWBIE)
           ? " +NEWBIE"
           : " -newbie",
           ch );

#if 0
	send_to_char( !IS_SET(ch->deaf, CHANNEL_HACKER)
	    ? " +HACKER"
	    : " -hacker",
	    ch );
#endif

	if ( IS_IMMORTAL(ch) )
	{
	    send_to_char( !IS_SET(ch->deaf, CHANNEL_IMMTALK)
		? " +IMMTALK"
		: " -immtalk",
		ch );
	}

	send_to_char( !IS_SET(ch->deaf, CHANNEL_MUSIC)
	    ? " +MUSIC"
	    : " -music",
	    ch );

	send_to_char( !IS_SET(ch->deaf, CHANNEL_QUESTION)
	    ? " +QUESTION"
	    : " -question",
	    ch );

	send_to_char( !IS_SET(ch->deaf, CHANNEL_SHOUT)
	    ? " +SHOUT"
	    : " -shout",
	    ch );

	send_to_char( !IS_SET(ch->deaf, CHANNEL_HOWL)
	    ? " +HOWL"
	    : " -howl",
	    ch );

	if (IS_IMMORTAL(ch))
	{
	    send_to_char( !IS_SET(ch->deaf, CHANNEL_LOG)
		? " +LOG"
		: " -log",
		ch );
	}

    if (IS_CLASS( ch, CLASS_MAGE) || IS_IMMORTAL(ch))
    {
        send_to_char( !IS_SET(ch->deaf, CHANNEL_MAGETALK)
        ? " +MAGE"
        : " -mage",
        ch );
    }

        if (IS_CLASS( ch, CLASS_MONK) || IS_IMMORTAL(ch))
        {
            send_to_char( !IS_SET(ch->deaf, CHANNEL_MONK)
                ? " +MONK"
                : " -monk",
                ch );
        }

        if (IS_CLASS(ch, CLASS_ANGEL) || IS_IMMORTAL(ch))
        {
            send_to_char( !IS_SET(ch->deaf, CHANNEL_ANGTALK)
                ? " +ANGTALK"
                : " -ANGTALK",
                ch );
        }

	if (IS_CLASS(ch, CLASS_DEMON) || IS_IMMORTAL(ch))
	{
	    send_to_char( !IS_SET(ch->deaf, CHANNEL_PRAY)
		? " +PRAY"
		: " -pray",
		ch );
	}
	
    if (IS_CLASS( ch, CLASS_NINJA) || IS_IMMORTAL(ch))
    {
        send_to_char( !IS_SET(ch->deaf, CHANNEL_MIKT)
        ? " +MIKT"
        : " -mikt",
        ch );
    }
       
    if (IS_CLASS( ch, CLASS_PALADIN) || IS_IMMORTAL(ch))
    {
        send_to_char( !IS_SET(ch->deaf, CHANNEL_PALADIN)
        ? " +PALADIN"
        : " -paladin",
        ch );
    }

	send_to_char( !IS_SET(ch->deaf, CHANNEL_INFO)
	    ? " +INFO"
	    : " -info",
	    ch );

	if (IS_CLASS(ch, CLASS_VAMPIRE) || IS_IMMORTAL(ch))
	{
	    send_to_char( !IS_SET(ch->deaf, CHANNEL_VAMPTALK)
		? " +VAMP"
		: " -vamp",
		ch );
	}

	if (IS_CLASS(ch, CLASS_HIGHLANDER) || IS_IMMORTAL(ch)) {
		send_to_char( !IS_SET(ch->deaf, CHANNEL_HIGHTALK)
			? " +HIGH"
			: " -high",
			ch ); }

	if (IS_CLASS(ch, CLASS_DROW) || IS_IMMORTAL(ch)) {
	send_to_char(!IS_SET(ch->deaf, CHANNEL_SIGN)
		? " +SIGN"
		: " -sign",
		ch ); }

        if (IS_CLASS(ch, CLASS_PRIEST) || IS_IMMORTAL(ch)) {
        send_to_char(!IS_SET(ch->deaf, CHANNEL_PTALK)
                ? " +PTALK"
                : " -ptalk",
                ch ); }

	send_to_char( !IS_SET(ch->deaf, CHANNEL_TELL)
	    ? " +TELL"
	    : " -tell",
	    ch );

	send_to_char( ".\n\r", ch );
    }
    else
    {
	bool fClear;
	int bit;

	     if ( arg[0] == '+' ) fClear = TRUE;
	else if ( arg[0] == '-' ) fClear = FALSE;
	else
	{
	    send_to_char( "Channels -channel or +channel?\n\r", ch );
	    return;
	}

/*	     if ( !str_cmp( arg+1, "auction"  ) ) bit = CHANNEL_AUCTION;*/
        if ( !str_cmp( arg+1, "chat"     ) ) bit = CHANNEL_CHAT;
#if 0
	else if ( !str_cmp( arg+1, "hacker"   ) ) bit = CHANNEL_HACKER;
#endif
	else if ( !str_cmp( arg+1, "immtalk"  ) ) bit = CHANNEL_IMMTALK;
	else if ( !str_cmp( arg+1, "high"     ) ) bit = CHANNEL_HIGHTALK;
        else if ( !str_cmp( arg+1, "gsocial"  ) ) bit = CHANNEL_GSOCIAL;
	else if ( !str_cmp( arg+1, "sign" ) ) bit = CHANNEL_SIGN;
        else if ( !str_cmp( arg+1, "hint"     ) ) bit = CHANNEL_HINT;
        else if ( !str_cmp( arg+1, "qtalk"    ) ) bit = CHANNEL_QTALK;
        else if ( !str_cmp( arg+1, "newbie"   ) ) bit = CHANNEL_NEWBIE;
	else if ( !str_cmp( arg+1, "music"    ) ) bit = CHANNEL_MUSIC;
	else if ( !str_cmp( arg+1, "question" ) ) bit = CHANNEL_QUESTION;
	else if ( !str_cmp( arg+1, "shout"    ) ) bit = CHANNEL_SHOUT;
	else if ( !str_cmp( arg+1, "yell"     ) ) bit = CHANNEL_YELL;
	else if ( !str_cmp( arg+1, "mikt"  ) ) bit = CHANNEL_MIKT;
	else if ( !str_cmp( arg+1, "paladin"  ) ) bit = CHANNEL_PALADIN;
	else if ( !str_cmp( arg+1, "howl"     ) ) bit = CHANNEL_HOWL;
	else if (IS_IMMORTAL(ch) && !str_cmp( arg+1, "log") ) bit = CHANNEL_LOG;
	else if ( !str_cmp( arg+1, "monk"     ) ) bit = CHANNEL_MONK;
        else if ( !str_cmp( arg+1, "mage"     ) ) bit = CHANNEL_MAGETALK;
	else if ((IS_SET(ch->special, SPC_CHAMPION) || (IS_IMMORTAL(ch))) && !str_cmp( arg+1, "pray") ) 
	    bit = CHANNEL_PRAY;
	else if ( !str_cmp( arg+1, "info"     ) ) bit = CHANNEL_INFO;
	else if ( !str_cmp( arg+1, "vamp"     ) ) bit = CHANNEL_VAMPTALK;
        else if ( !str_cmp( arg+1, "ptalk"    ) ) bit = CHANNEL_PTALK;
	else if ( !str_cmp( arg+1, "tell"     ) ) bit = CHANNEL_TELL;
        else if ( !str_cmp( arg+1, "bitch"    ) ) bit = CHANNEL_BITCH;   
	else
	{
	    send_to_char( "Set or clear which channel?\n\r", ch );
	    return;
	}

	if ( fClear )
	    REMOVE_BIT (ch->deaf, bit);
	else
	    SET_BIT    (ch->deaf, bit);

	send_to_char( "Ok.\n\r", ch );
    }

    return;
}


void do_wiznet( CHAR_DATA *ch, char *argument )
{

    char arg [MAX_INPUT_LENGTH];
    int a;

    if( IS_NPC( ch ) )
	return;

    smash_tilde( argument );
    argument = one_argument( argument, arg );

    if ( arg[0] == '\0' || arg[0] == '?' )
    {
        char buf [ MAX_STRING_LENGTH ];

        send_to_char( "{YWiznet Channel Details:{x\n\r\n\r", ch );
        for ( a = 0; wiznet_table[a].min_level != 0; a++ )
        {

            if ( wiznet_table[a].min_level > get_trust( ch ) )

                buf[0] = '\0';
            if( IS_SET( PC(ch,wiznet), wiznet_table[a].channel))
                send_to_char( wiznet_table[a].on_name,ch);
            else
                send_to_char( wiznet_table[a].off_name,ch);
        }

        send_to_char( "\n\r{YWiznet <name> toggles the monitor channels.{n\n\r", ch );
        return;
    }
    else
    {
        char buf [ MSL ];
	int  bit = -1;
	bool fSet;

	if( arg[0] == '+' ) fSet = TRUE;
	else if( arg[0] == '-' ) fSet = FALSE;
	else
	{
	    send_to_char( "Wiznet: config -option or +option?\n\r", ch );
	    return;
	}

        if( !str_cmp( arg+1, "ALL" ) )
            bit = WIZ_LOGS | WIZ_LOGINS | WIZ_COMMANDS
                | WIZ_MISC | WIZ_CREATE | WIZ_DEBUG;
        else
            for ( a = 0; wiznet_table[a].min_level != 0; a++ )
            {
                if ( !str_prefix( arg+1, wiznet_table[a].name ) )
                {
                    bit = wiznet_table[a].channel;
                        break;
                }
            }

        if( bit < 1 )
        {
            do_wiznet( ch, "" );
            return;
        }

        if( fSet )
	{
	    SET_BIT( PC(ch,wiznet), bit );
            sprintf( buf, "{Y%s is now ON.\n\r", arg+1 );
	    buf[3] = UPPER( buf[3] );
	    send_to_char( buf, ch );
	}
	else
	{
	    REMOVE_BIT( PC(ch,wiznet), bit );
            sprintf( buf, "{Y%s is now OFF.\n\r", arg+1 );
	    buf[3] = UPPER( buf[3] );
	    send_to_char( buf, ch );
        }
    }

    return;
}


void do_godless( CHAR_DATA *ch, char *argument )
{
    char arg[MAX_INPUT_LENGTH];
    char buf[MAX_STRING_LENGTH];

    one_argument( argument, arg );

    if (IS_NPC(ch)) return;

    if ( arg[0] == '\0')
    {
	send_to_char( "Do you wish to switch it ON or OFF?\n\r", ch );
	return;
    }

    if ( ( (ch->level > 3)
	|| (ch->level < 2)
	|| (ch->trust > 3) )
	&& !IS_SET(ch->act, PLR_GODLESS))
    {
	send_to_char( "Sorry, you must be level 3.\n\r", ch );
	return;
    }

    if (!IS_SET(ch->act, PLR_GODLESS) && !str_cmp(arg,"off"))
    {
        send_to_char("But you already obey the gods!\n\r", ch);
        return;
    }
    else if (!IS_SET(ch->act, PLR_GODLESS) && !str_cmp(arg,"on"))
    {
        SET_BIT(ch->act, PLR_GODLESS);
        send_to_char("You no longer obey the gods.\n\r", ch);
        sprintf(buf,"%s has rejected the gods.",ch->name);
        do_info(ch,buf);
    }
    else if (IS_SET(ch->act, PLR_GODLESS) && !str_cmp(arg,"on"))
    {
        send_to_char("But you have already rejected the gods!\n\r", ch);
        return;
    }
    else
        send_to_char( "Do you wish to switch it ON or OFF?\n\r", ch );
    return;
}

void do_summon( CHAR_DATA *ch, char *argument )
{
    char arg[MAX_INPUT_LENGTH];

    one_argument( argument, arg );

    if (IS_NPC(ch)) return;

    if ( arg[0] == '\0')
    {
	send_to_char( "Do you wish to switch summon ON or OFF?\n\r", ch );
	return;
    }

    if (IS_IMMUNE(ch, IMM_SUMMON) && !str_cmp(arg,"off"))
    {
	REMOVE_BIT(ch->immune, IMM_SUMMON);
	send_to_char("You can no longer be the target of summon and portal.\n\r", ch);
    }
    else if (!IS_IMMUNE(ch, IMM_SUMMON) && !str_cmp(arg,"off"))
    {
	send_to_char("But it is already off!\n\r", ch);
        return;
    }
    else if (!IS_IMMUNE(ch, IMM_SUMMON) && !str_cmp(arg,"on"))
    {
	SET_BIT(ch->immune, IMM_SUMMON);
        send_to_char("You can now be the target of summon and portal.\n\r", ch);
    }
    else if (IS_IMMUNE(ch, IMM_SUMMON) && !str_cmp(arg,"on"))
    {
        send_to_char("But it is already on!\n\r", ch);
        return;
    }
    else
	send_to_char( "Do you wish to switch it ON or OFF?\n\r", ch );
    return;
}

void do_transport( CHAR_DATA *ch, char *argument )
{
    char arg[MAX_INPUT_LENGTH];

    one_argument( argument, arg );

    if (IS_NPC(ch)) return;

    if ( arg[0] == '\0')
    {
	send_to_char( "Do you wish to switch transport ON or OFF?\n\r", ch );
	return;
    }

    if (IS_IMMUNE(ch, IMM_TRANSPORT) && !str_cmp(arg,"off"))
    {
	REMOVE_BIT(ch->immune, IMM_TRANSPORT);
	send_to_char("You can no longer be the target of transport spells.\n\r", ch);
    }
    else if (!IS_IMMUNE(ch, IMM_TRANSPORT) && !str_cmp(arg,"off"))
    {
	send_to_char("But it is already off!\n\r", ch);
        return;
    }
    else if (!IS_IMMUNE(ch, IMM_TRANSPORT) && !str_cmp(arg,"on"))
    {
	SET_BIT(ch->immune, IMM_TRANSPORT);
	send_to_char("You can now be the target of transport spells.\n\r", ch);
    }
    else if (IS_IMMUNE(ch, IMM_TRANSPORT) && !str_cmp(arg,"on"))
    {
	send_to_char("But it is already on!\n\r", ch);
        return;
    }
    else
	send_to_char( "Do you wish to switch it ON or OFF?\n\r", ch );
    return;
}

/*
 * Syntax:  pager
 *          pager [number]
 */
void do_pager ( CHAR_DATA *ch, char *argument )
{
    char arg[MAX_INPUT_LENGTH];
    int lines;

    if( IS_NPC(ch) )
	return;

    one_argument( argument, arg );

    if ( arg[0] == '\0' )
    {
        if ( PC(ch,pagelen) == 0 )
        {
            PC(ch,pagelen) = 22;
            send_to_char( "Pager on; defaulted to 22 lines per page.\n\r", ch );
            return;
        }

        send_to_char( "Pager off.\n\r", ch );
        PC(ch,pagelen) = 0;
        return;
    }

	lines = atoi( arg );

    if ( lines < 0 || lines > 500 )
    {
    send_to_char( "Invalid page length value.\n\r", ch );
	return;
    }

    PC(ch,pagelen) = lines;
    ch_printf(ch, "Pager set to %d lines.\n\r", lines );
    return;
}