/*
 * /cmd/wiz/keeper.c
 *
 * This object holds the commands reserved for administrators.
 */

#pragma save_binary

inherit "/cmd/std/command_driver";

#include <filepath.h>
#include <language.h>
#include <macros.h>
#include <std.h>
#include <stdproperties.h>

#define CHECK_SO_KEEPER	if (WIZ_CHECK < WIZ_KEEPER) return 0; \
			if (this_interactive() != this_player()) return 0

/* **************************************************************************
 * Return a list of which souls are to be loaded.
 * The souls are listed in order of command search.
 */
get_soul_list()
{
    return ({ WIZ_CMD_KEEPER,
	      WIZ_CMD_ARCH,
	      WIZ_CMD_LORD,
	      WIZ_CMD_HELPER,
	      WIZ_CMD_NORMAL,
	      WIZ_CMD_PILGRIM,
	      WIZ_CMD_APPRENTICE,
	      MBS_SOUL });
}

/* **************************************************************************
 * Return a proper name of the soul in order to get a nice printout.
 */
get_soul_id()
{
    return WIZNAME_KEEPER;
}

/* **************************************************************************
 * The list of verbs and functions. Please add new in alfabetical order.
 */
mapping
query_cmdlist()
{
    return ([
	     "keeper":"keeper"
	     ]);
}
    
/* **************************************************************************
 * Here follows the actual functions. Please add new functions in the 
 * same order as in the function name list.
 * **************************************************************************/

/* **************************************************************************
 * keeper - make an archwizard into keeper or vice versa.
 */
int
keeper(string str)
{
    string *parts;

    CHECK_SO_KEEPER;

    if (!strlen(str))
    {
	notify_fail("Syntax: keeper <name> [arch/keeper]\n");
	return 0;
    }

    if (sizeof(parts = explode(lower_case(str), " ")) != 2)
    {
	notify_fail("Syntax: keeper <name> [arch/keeper]\n");
	return 0;
    }

    switch(parts[1])
    {
    case "arch":
	if (SECURITY->query_wiz_rank(parts[0]) != WIZ_KEEPER)
	{
	    write("Only a keeper can be made into an arch this way!\n");
	    return 1;
	}


	if (SECURITY->set_keeper(parts[0], 0))
	{
	    write("Made keeper " + capitalize(parts[0]) + " an arch.\n");
	    return 1;
	}

	notify_fail("Failed to make " + capitalize(parts[0]) + " an arch.\n");
	return 0;

    case "keeper":
	if (SECURITY->query_wiz_rank(parts[0]) != WIZ_ARCH)
	{
	    write("Only an arch can be made into a keeper this way!\n");
	    return 1;
	}

	if (parts[0]->query_real_name() != "vic")
	    {
	    write("Only an arch can be made into a keeper this way!\n");
	    return 1;
	    }

	if (SECURITY->set_keeper(parts[0], 1))
	{
	    write("Made archwizard " + capitalize(parts[0]) + " a keeper.\n");
	    return 1;
	}

	notify_fail("Failed to make " + capitalize(parts[0]) + " a keeper.\n");
	return 0;

    default:
	notify_fail("Syntax: keeper <name> [arch/keeper]?\n");
	return 0;
    }

    write("Fatal end in switch() in 'keeper'!\n");
    return 1;
}

int
czy_wiz(object wiz)
{
    return wiz->query_wiz_level();
}
/*
public void
chor_cd(int faza, object *wizowie)
{
    switch (faza)
    {
         case 0: find_player("lewy")->catch_msg("\n\nNa twoja czesc, wspanialy " +
             "Chor Wizow Arkadii intonuje piesc z oddali:\n");
                 (wizowie - ({ find_player("lewy") }))->catch_msg(
             "\n\nNa czesc Prezesa Lewego Namiestnika Arkadii, ktory wlasnie " +
             "nas nawiedzil, Wspanialy Chor Wizow Arkadii intonuje:\n");
             set_alarm(3.5, 0.0, "chor_cd", ++faza, wizowie);
             return ;
         case 1: wizowie->catch_msg("\n\tLubu-dubu, lubu-dubu,\n");
             set_alarm(1.5, 0.0, "chor_cd", ++faza, wizowie);
             return ;
         case 2: wizowie->catch_msg("\tniech nam zyje,\n");
             set_alarm(1.5, 0.0, "chor_cd", ++faza, wizowie);
             return ;
         case 3: wizowie->catch_msg("\tPrezes naszego kluubu,\n");
             set_alarm(4.5, 0.0, "chor_cd", ++faza, wizowie);
             return ;
         case 4: wizowie->catch_msg("\nChor kontynuuje... :\n" +
                  "\tNieeeeeeech Zyyyyyjeeeee Naaaaaaaaaaaaaaam!!!\n");
             set_alarm(1.5, 0.0, "chor_cd", ++faza, wizowie);
             return ;
         case 5: (wizowie - ({ find_player("lewy") }))->catch_msg(
             "\n@ Lewy jest wyraznie dumny.\n");
             find_player("lewy")->catch_msg("Twe serce wypelnia sie duma " +
                 "z tego, jak Wspanialy I WIelki Chor Wizow Arkadii uraczyl "+
                 "cie na powitanie!\n");
      }
}

public void
using_soul(object live)
{
    object *wizowie;
    
    wizowie = filter(users(), czy_wiz);
    
    live->catch_msg("\n\nNa twoja czesc, wspanialy chor wizow Arkadii " +
        "intonuje z oddali:\n");
    
    
    set_alarm(4.0, 0.0, "chor_cd", 0, wizowie);
        
    return ;
}

*/
