/
lib/banish/
lib/d/coronos/
lib/d/coronos/w/alena/
lib/d/coronos/w/angel/
lib/d/coronos/w/angel/caves/
lib/d/coronos/w/angel/caves/monst/
lib/d/coronos/w/angel/city/chambers/
lib/d/coronos/w/angel/city/monst/
lib/d/coronos/w/angel/city/obj/
lib/d/coronos/w/angel/city/streets/
lib/d/coronos/w/angel/farms/plains/
lib/d/coronos/w/angel/monst/
lib/d/tempus/
lib/d/tempus/w/angel/
lib/d/tempus/w/kingbill/
lib/d/tempus/w/mirak/
lib/d/tempus/w/mirak/monst/
lib/d/tempus/w/mirak/obj/
lib/d/tempus/w/relgar/planes/baat/
lib/d/tempus/w/sarak/
lib/d/tempus/w/serepion/mon/
lib/d/tempus/w/valrejn/
lib/doc/
lib/doc/domains/
lib/doc/efun/
lib/include/fn_specs/
lib/info/
lib/inherit/base/
lib/log/
lib/log/mailbox/
lib/log/main/
lib/news/
lib/obj/party/
lib/objects/componen/
lib/open/
lib/open/party/
lib/open/paste/
lib/open/spells/
lib/open/valrejn/
lib/players/
lib/players/alena/
lib/players/alena/obj/
lib/players/alena/open/
lib/players/alena/private/
lib/players/angel/
lib/players/angel/obj/
lib/players/ash/
lib/players/biggs/
lib/players/biggs/food/
lib/players/biggs/gobkeep/
lib/players/biggs/mnstr/
lib/players/biggs/town/caves/
lib/players/biggs/town/tower/
lib/players/biggs/wpns/
lib/players/calris/
lib/players/deathurg/
lib/players/deathurg/open/
lib/players/deathurg/private/thief/
lib/players/dogberry/
lib/players/dogberry/library/
lib/players/dogberry/open/
lib/players/epsilon/
lib/players/epsilon/private/
lib/players/farewell/
lib/players/hippo/
lib/players/hippo/open/
lib/players/hippo/tools/
lib/players/jimpa/
lib/players/josh/
lib/players/josh/room/
lib/players/josh/room/mage/dungeon/
lib/players/josh/room/mage/dungeon/obj/
lib/players/josh/wep/
lib/players/kingbill/
lib/players/metatron/
lib/players/miette/
lib/players/mirak/
lib/players/mirak/open/
lib/players/parsilan/
lib/players/relgar/
lib/players/relgar/private/
lib/players/sarak/
lib/players/sarak/bugs/
lib/players/sarak/feelings/
lib/players/sarak/magical/
lib/players/sarak/minotaur/island/
lib/players/sarak/open/
lib/players/sarak/private/
lib/players/serepion/
lib/players/serepion/open/
lib/players/serepion/private/
lib/players/spike/
lib/players/spike/open/
lib/players/spike/private/
lib/players/spike/seaworld/
lib/players/valrejn/
lib/players/valrejn/open/
lib/players/valrejn/private/
lib/players/virus/
lib/players/wrath/
lib/players/wrath/arm/
lib/players/wrath/mon/
lib/players/wrath/room/
lib/players/wrath/room/entry/
lib/players/wrath/room/zolgath/
lib/players/wrath/weap/
lib/players/zil/
lib/room/
lib/room/city/arena/
lib/room/city/creator/
lib/room/city/garden/monst/
lib/room/city/library/
lib/room/city/library/open/books/
lib/room/city/shop/
lib/room/death/
lib/room/death/open/
lib/room/island/
lib/room/keeps/
lib/room/registry/
lib/room/ships/crew/
lib/room/ships/open/
lib/room/ships/open/types/bounty/
lib/room/ships/open/types/nebula/
lib/room/ships/open/types/phoenix/
lib/secure/udp_cmd_/
lib/skills/
lib/skills/fighter/
lib/skills/psionici/
lib/skills/thief/
lib/usr/
lib/usr/creators/
lib/usr/no_banis/
lib/usr/players/
// Coded by Arthur mainly for New and Appr wizzes on Holy Mission
// But, it also saves the hassle for those lazy wizzes when they want 
// to change something on themselves :) - Arthur
// Mangla: checked for consistency and reformatting
// Mangla: typedeffed all functions and placed some precautions
//         on some of the sets.
// Mangla: added a clone to appr command

#pragma strict_types;

#include "/obj/masters.h"

inherit "/obj/treasure";

let,which,what,name;
int amm,invis;

#define TP this_player()
#define TPRN this_player()->query_real_name()
#define QN query_name()
#define CP capitalize
#define WR write
#define TO this_object
#define AA add_action
#define PATH "/tools/"

int done();
int done2();
int done3();
void reset(int arg) {

    if(arg) return;
    name=TPRN;
    set_id("wizards rock");
    set_alias("rock");
    set_long("This very sturdy looking rock was probably coded by Arthur.\n"+
             "It has many neat funtions built into it. To learn more about"+
 set function\nType 'help set', and to learn more about"+
             " the add function type 'help add'.\n");
    set_value(0);
    set_weight(0);
}

string short() {
    if(invis) return "";
    else return environment(TO())->query_real_name()+"'s wiz rock";
}

void init() {
    /* Arthur: These next lines are commented because they do not 
               work with the mages soul
       if(!TP()->query_immortal()) {
           WR("You're not supposed to have me. BYE!\n");
           destruct(TO());
           return 1;

    */   
    AA("_add","add");
    AA("_set","set");
    AA("_help","help");
    AA("_move","rockto");
    ::init();
}

int _help(string str) {

    if(str == "set") {

        WR("The current functions of Arthurs wiz rock are:\n\n"+
          "set <argument> <number or string>\n"+
          "\nThis is the list of current <argument>'s for the set function.\n"+
          "str <number> - sets the strength to between 1 and 40\n"+
          "wis <number> - sets the wisdom to between 1 and 40\n"+
          "int <number> - sets the intellegence to between 1 and 40\n"+
          "dex <number> - sets the dexterity to between 1 and 40\n"+
          "chr <number> - sets the chrisma to between 1 and 40\n"+
          "con <number> - sets the constitution to between 1 and 40\n"+
          "al <number> - sets your alignment\n"+
          "n_ac <number> - sets your natural armour class\n"+
          "n_wc <number> - sets your natural weapon class\n"+
          "religion <string> - sets your religion to <string>\n"+
          "race <string> - sets your race to <string>\n"+
          "smell <string> - sets your smell to <string>\n"+
          "rock <str> - <str> can be invisible or visible\n");
        return 1;
    }
    if(str =="add") {
        WR("The current add functions for Arthur's Wiz rock are:\n\n"+
          "This is the list of current <argument>'s for the add function.\n\n"+
          "hp <num> - adds <num> ammount of hit-points to you\n"+
          "xp <num> - adds <num> ammount of experience to you\n");
        return 1;
    }
    if(str == "rock") {
        WR("The wiz rock says: I have two functions. Set and add. You can\n"+
	"get help on either of them. Use 'rockto <appr>' to send rock\n"+
	"to an appr wiz.\n");
        return 1;
    }
    else
        return 0;
}

int _add(string str) {

    if( !TP->query_immortal() ) {
        destruct(this_object());
        return 1;
    }
    if(TPRN != name) {
        WR("This is not your rock, you must seek your own!\n");
        destruct(this_object());
        return 1;
    }
    if(!str) return 0;
    if(sscanf(str,"%s",which) == 1)
        amm = 0;
    sscanf(str,"%s %d",which,amm);

    switch(which) {
    case "xp": 
        if(!amm) {
            WR("To add xp type 'add xp <number>'.\n");
            return 1;
        }
        // Mangla: limit placed in here to stop ridiculous XP             
        if((int)TP->query_exp() > 10000000) break;
        TP->add_experience(amm);
        done2();
        return 1;  
        break;
    case "hp":
        if(!amm) {
            WR("To add hp it would be 'add hp <number>'.\n");
            return 1;
        }
        if(TP->query_hp() >= TP->query_max_hp()) break;
        if( (TP->query_max_hp()) - (TP->query_hp()) < amm) break;
        TP->reduce_hit_point(-amm);
        done2();
        return 1;
        break;
    default:
        return 0;
    } 
}

int _set(string str) {

    if( !TP->query_immortal() ) {
        destruct(this_object());
        return 1;
    }
    if(TPRN != name) {
        WR("This is not your wiz rock! Go get your own.\n");
        destruct(this_object());
        return 1;
    }
    if(!str) {
        WR("what do you want to set, and to what?\n");
        return 1;
    }
    if(sscanf(str, "%s", which) == 1)
        what = 0;
    sscanf(str,"%s %s",which,what);
    switch(which) {
    case "rock":
        if(!what) {
            WR("To set the rock invisible type 'set rock invisible', for it to be visible\ntype 'set rock visible'.\n");
            return 1;
        }
        if(what =="invisible") invis = 1;
        else invis = 0;
        write("Your rock is now visible.\n");
        return 1;
        break;
    case "race":
        if(!what) {
            WR("To set your race type 'set race <string>'.\n");
            return 1;
        }
        TP->set_race(what);
        done3();
        return 1;
        break;
    case "religion":
        if(!what) {
            WR("To set your religion type 'set religion <string>'.\n");
            return 1;
        }
        TP->set_religion(what);
        done3();
        return 1;
        break;
    case "smell":
        if(!what) {
            WR("To set your smell type 'set smell' <string>'.\n");
            return 1;
        }
        TP->set_smell(what);
        done3();
        return 1;
        break;
    default:
        which = 0;
    }


    if(sscanf(str, "%s", which) == 1)
        amm=0;
    sscanf(str,"%s %d",which,amm);
    switch(which) {
    case "dex": 
        if(!amm) {
            WR("To set your dex type 'set dex <number>'.\n");
            return 1;
        }
        if(amm < 41)
            TP->set_dex(amm);
        done();
        return 1;
        break;
    case "con":
        if(!amm) {
            WR("To set your con type 'set con <number>'.\n");
            return 1;
        }
        if(amm < 41)
            TP->set_con(amm);
        done();
        return 1;
        break;
    case "str":
        if(!amm) {
            WR("To set your str type 'set str <number>'.\n");
            return 1;
        }
        if(amm < 41)
            TP->set_str(amm);
        done();
        return 1;
        break;
    case "wis":
        if(!amm) {
	    WR("To set your wis type 'set wis <number>'.\n");
            return 1;
        }
        if(amm < 41)
            TP->set_wis(amm);
        done();
        return 1;
        break;
    case "chr": 
        if(!amm) {
            WR("To set your chr type 'set chr <number>'.\n");
            return 1;
        }
        if(amm < 41)
            TP->set_chr(amm);
        done();
        return 1;
        break;
    case "int": 
        if(!amm) {
            WR("To set your int type 'set int <number>'.\n");
            return 1;
        }
        if(amm < 41)
            TP->set_int(amm);
        done();
        return 1;
        break;
    case "al":
        if(!amm) {
            WR("To set your al type 'set al <number>'.\n");
            return 1;
        }
        if( (amm < 1000)  &&  (amm > -1000) )
            TP->set_al(amm);
        done();
        return 1;
        break;
    case "n_ac":
        if(!amm) {
            WR("To set your n_ac type 'set n_ac <number>'.\n");
            return 1;
        }
        if(amm < 20)
            TP->set_n_ac(amm);
        done();
        return 1;
        break;
    case "n_wc":
        if(!amm) {
            WR("To set your n_wc type 'set n_wc <number>'.\n");
            return 1;
        }
        if (amm < 20)
            TP->set_n_wc(amm);
        done();
        return 1;
        break;
    default:  
        return 0;
        break;
    }
}

int done(){
    WR("I set your "+which+" to: "+amm+".\n");
    log_file("arthur.rock",TPRN+" used the rock to set "+
      which+" to: "+amm+".\n");
    return 1;
}

int done2() {
    WR("I added "+amm+" to your "+which+".\n");
    log_file("arthur.rock",TPRN+" used the rock to add "+
      amm+" to "+which+".\n");
    return 1;
}

int done3() {
    WR("I Changed "+which+" to: "+what+".\n");
    log_file("arthur.rock",TPRN+" used the rock to change "+
      which+" to "+what+".\n");
    return 1;
}

int drop() {
    WR("You would never want a player to get their "+
      "grubby hands on your wiz rock!\n");
    return 1;
}

string query_auto_load() {
    return PATH+"wizrock:"+invis;
}

#if 0
init_arg(int arg) {
    invis=arg;
}
#endif

int _move(string arg) {

    object ob;
    object dest;

    dest = find_living(arg);
    if(dest && interactive(dest)
      && dest->query_level()==30
      && !present("wizrock",dest) ) {
        ob = clone_object("/tools/wizrock");
        ob->reset_name(dest->query_real_name());
        transfer(ob,dest);
    }
    else {
        write("You can only give a rock to an apprentice wizard.\n");
    }
    return 1;
}

void reset_name(string str) {
    name = str;
}