ds2.9a12/bin/
ds2.9a12/extra/
ds2.9a12/extra/crat/
ds2.9a12/extra/creremote/
ds2.9a12/extra/mingw/
ds2.9a12/extra/wolfpaw/
ds2.9a12/fluffos-2.14-ds13/
ds2.9a12/fluffos-2.14-ds13/Win32/
ds2.9a12/fluffos-2.14-ds13/compat/
ds2.9a12/fluffos-2.14-ds13/compat/simuls/
ds2.9a12/fluffos-2.14-ds13/include/
ds2.9a12/fluffos-2.14-ds13/testsuite/
ds2.9a12/fluffos-2.14-ds13/testsuite/clone/
ds2.9a12/fluffos-2.14-ds13/testsuite/command/
ds2.9a12/fluffos-2.14-ds13/testsuite/data/
ds2.9a12/fluffos-2.14-ds13/testsuite/etc/
ds2.9a12/fluffos-2.14-ds13/testsuite/include/
ds2.9a12/fluffos-2.14-ds13/testsuite/inherit/
ds2.9a12/fluffos-2.14-ds13/testsuite/inherit/master/
ds2.9a12/fluffos-2.14-ds13/testsuite/log/
ds2.9a12/fluffos-2.14-ds13/testsuite/single/
ds2.9a12/fluffos-2.14-ds13/testsuite/single/tests/compiler/
ds2.9a12/fluffos-2.14-ds13/testsuite/single/tests/efuns/
ds2.9a12/fluffos-2.14-ds13/testsuite/single/tests/operators/
ds2.9a12/fluffos-2.14-ds13/testsuite/u/
ds2.9a12/lib/cmds/admins/
ds2.9a12/lib/cmds/common/
ds2.9a12/lib/cmds/creators/include/
ds2.9a12/lib/daemon/services/
ds2.9a12/lib/daemon/tmp/
ds2.9a12/lib/doc/
ds2.9a12/lib/doc/bguide/
ds2.9a12/lib/doc/efun/all/
ds2.9a12/lib/doc/efun/arrays/
ds2.9a12/lib/doc/efun/buffers/
ds2.9a12/lib/doc/efun/compile/
ds2.9a12/lib/doc/efun/floats/
ds2.9a12/lib/doc/efun/functions/
ds2.9a12/lib/doc/efun/general/
ds2.9a12/lib/doc/efun/mixed/
ds2.9a12/lib/doc/efun/numbers/
ds2.9a12/lib/doc/efun/parsing/
ds2.9a12/lib/doc/hbook/
ds2.9a12/lib/doc/help/classes/
ds2.9a12/lib/doc/help/races/
ds2.9a12/lib/doc/lfun/
ds2.9a12/lib/doc/lfun/all/
ds2.9a12/lib/doc/lfun/lib/abilities/
ds2.9a12/lib/doc/lfun/lib/armor/
ds2.9a12/lib/doc/lfun/lib/bank/
ds2.9a12/lib/doc/lfun/lib/bot/
ds2.9a12/lib/doc/lfun/lib/clay/
ds2.9a12/lib/doc/lfun/lib/clean/
ds2.9a12/lib/doc/lfun/lib/clerk/
ds2.9a12/lib/doc/lfun/lib/client/
ds2.9a12/lib/doc/lfun/lib/combat/
ds2.9a12/lib/doc/lfun/lib/connect/
ds2.9a12/lib/doc/lfun/lib/container/
ds2.9a12/lib/doc/lfun/lib/corpse/
ds2.9a12/lib/doc/lfun/lib/creator/
ds2.9a12/lib/doc/lfun/lib/daemon/
ds2.9a12/lib/doc/lfun/lib/damage/
ds2.9a12/lib/doc/lfun/lib/deterioration/
ds2.9a12/lib/doc/lfun/lib/donate/
ds2.9a12/lib/doc/lfun/lib/door/
ds2.9a12/lib/doc/lfun/lib/equip/
ds2.9a12/lib/doc/lfun/lib/file/
ds2.9a12/lib/doc/lfun/lib/fish/
ds2.9a12/lib/doc/lfun/lib/fishing/
ds2.9a12/lib/doc/lfun/lib/flashlight/
ds2.9a12/lib/doc/lfun/lib/follow/
ds2.9a12/lib/doc/lfun/lib/ftp_client/
ds2.9a12/lib/doc/lfun/lib/ftp_data_connection/
ds2.9a12/lib/doc/lfun/lib/fuel/
ds2.9a12/lib/doc/lfun/lib/furnace/
ds2.9a12/lib/doc/lfun/lib/genetics/
ds2.9a12/lib/doc/lfun/lib/holder/
ds2.9a12/lib/doc/lfun/lib/id/
ds2.9a12/lib/doc/lfun/lib/interactive/
ds2.9a12/lib/doc/lfun/lib/lamp/
ds2.9a12/lib/doc/lfun/lib/leader/
ds2.9a12/lib/doc/lfun/lib/light/
ds2.9a12/lib/doc/lfun/lib/limb/
ds2.9a12/lib/doc/lfun/lib/living/
ds2.9a12/lib/doc/lfun/lib/load/
ds2.9a12/lib/doc/lfun/lib/look/
ds2.9a12/lib/doc/lfun/lib/manipulate/
ds2.9a12/lib/doc/lfun/lib/meal/
ds2.9a12/lib/doc/lfun/lib/messages/
ds2.9a12/lib/doc/lfun/lib/player/
ds2.9a12/lib/doc/lfun/lib/poison/
ds2.9a12/lib/doc/lfun/lib/position/
ds2.9a12/lib/doc/lfun/lib/post_office/
ds2.9a12/lib/doc/lfun/lib/potion/
ds2.9a12/lib/doc/lfun/lib/room/
ds2.9a12/lib/doc/lfun/lib/server/
ds2.9a12/lib/doc/lfun/lib/spell/
ds2.9a12/lib/doc/lfun/lib/torch/
ds2.9a12/lib/doc/lfun/lib/vendor/
ds2.9a12/lib/doc/lfun/lib/virt_sky/
ds2.9a12/lib/doc/lfun/lib/weapon/
ds2.9a12/lib/doc/lfun/lib/worn_storage/
ds2.9a12/lib/doc/lpc/basic/
ds2.9a12/lib/doc/lpc/concepts/
ds2.9a12/lib/doc/lpc/constructs/
ds2.9a12/lib/doc/lpc/etc/
ds2.9a12/lib/doc/lpc/intermediate/
ds2.9a12/lib/doc/lpc/types/
ds2.9a12/lib/doc/misc/
ds2.9a12/lib/doc/old/
ds2.9a12/lib/domains/
ds2.9a12/lib/domains/Praxis/adm/
ds2.9a12/lib/domains/Praxis/attic/
ds2.9a12/lib/domains/Praxis/cemetery/mon/
ds2.9a12/lib/domains/Praxis/data/
ds2.9a12/lib/domains/Praxis/death/
ds2.9a12/lib/domains/Praxis/mountains/
ds2.9a12/lib/domains/Praxis/obj/armour/
ds2.9a12/lib/domains/Praxis/obj/magic/
ds2.9a12/lib/domains/Praxis/obj/weapon/
ds2.9a12/lib/domains/Praxis/orc_valley/
ds2.9a12/lib/domains/Ylsrim/
ds2.9a12/lib/domains/Ylsrim/adm/
ds2.9a12/lib/domains/Ylsrim/armor/
ds2.9a12/lib/domains/Ylsrim/broken/
ds2.9a12/lib/domains/Ylsrim/fish/
ds2.9a12/lib/domains/Ylsrim/meal/
ds2.9a12/lib/domains/Ylsrim/npc/
ds2.9a12/lib/domains/Ylsrim/obj/
ds2.9a12/lib/domains/Ylsrim/virtual/
ds2.9a12/lib/domains/Ylsrim/weapon/
ds2.9a12/lib/domains/campus/adm/
ds2.9a12/lib/domains/campus/etc/
ds2.9a12/lib/domains/campus/meals/
ds2.9a12/lib/domains/campus/save/
ds2.9a12/lib/domains/campus/txt/ai/charles/
ds2.9a12/lib/domains/campus/txt/ai/charles/bak2/
ds2.9a12/lib/domains/campus/txt/ai/charles/bak2/bak1/
ds2.9a12/lib/domains/campus/txt/ai/charly/
ds2.9a12/lib/domains/campus/txt/ai/charly/bak/
ds2.9a12/lib/domains/campus/txt/jenny/
ds2.9a12/lib/domains/cave/doors/
ds2.9a12/lib/domains/cave/etc/
ds2.9a12/lib/domains/cave/meals/
ds2.9a12/lib/domains/cave/weap/
ds2.9a12/lib/domains/default/creator/
ds2.9a12/lib/domains/default/doors/
ds2.9a12/lib/domains/default/etc/
ds2.9a12/lib/domains/default/vehicles/
ds2.9a12/lib/domains/default/virtual/
ds2.9a12/lib/domains/default/weap/
ds2.9a12/lib/domains/town/txt/shame/
ds2.9a12/lib/domains/town/virtual/
ds2.9a12/lib/domains/town/virtual/bottom/
ds2.9a12/lib/domains/town/virtual/space/
ds2.9a12/lib/estates/
ds2.9a12/lib/ftp/
ds2.9a12/lib/lib/comp/
ds2.9a12/lib/lib/daemons/
ds2.9a12/lib/lib/daemons/include/
ds2.9a12/lib/lib/lvs/
ds2.9a12/lib/lib/user/
ds2.9a12/lib/lib/virtual/
ds2.9a12/lib/log/
ds2.9a12/lib/log/adm/
ds2.9a12/lib/log/archive/
ds2.9a12/lib/log/chan/
ds2.9a12/lib/log/errors/
ds2.9a12/lib/log/law/adm/
ds2.9a12/lib/log/law/email/
ds2.9a12/lib/log/law/names/
ds2.9a12/lib/log/law/sites-misc/
ds2.9a12/lib/log/law/sites-register/
ds2.9a12/lib/log/law/sites-tempban/
ds2.9a12/lib/log/law/sites-watch/
ds2.9a12/lib/log/open/
ds2.9a12/lib/log/reports/
ds2.9a12/lib/log/router/
ds2.9a12/lib/log/secure/
ds2.9a12/lib/log/watch/
ds2.9a12/lib/obj/book_source/
ds2.9a12/lib/obj/include/
ds2.9a12/lib/powers/prayers/
ds2.9a12/lib/powers/spells/
ds2.9a12/lib/realms/template/adm/
ds2.9a12/lib/realms/template/area/armor/
ds2.9a12/lib/realms/template/area/npc/
ds2.9a12/lib/realms/template/area/obj/
ds2.9a12/lib/realms/template/area/room/
ds2.9a12/lib/realms/template/area/weap/
ds2.9a12/lib/realms/template/bak/
ds2.9a12/lib/realms/template/cmds/
ds2.9a12/lib/save/kills/o/
ds2.9a12/lib/secure/cfg/classes/
ds2.9a12/lib/secure/cmds/builders/
ds2.9a12/lib/secure/cmds/creators/include/
ds2.9a12/lib/secure/cmds/players/
ds2.9a12/lib/secure/cmds/players/include/
ds2.9a12/lib/secure/daemon/imc2server/
ds2.9a12/lib/secure/daemon/include/
ds2.9a12/lib/secure/lib/
ds2.9a12/lib/secure/lib/include/
ds2.9a12/lib/secure/lib/net/include/
ds2.9a12/lib/secure/lib/std/
ds2.9a12/lib/secure/log/adm/
ds2.9a12/lib/secure/log/bak/
ds2.9a12/lib/secure/log/intermud/
ds2.9a12/lib/secure/log/network/
ds2.9a12/lib/secure/modules/
ds2.9a12/lib/secure/npc/
ds2.9a12/lib/secure/obj/include/
ds2.9a12/lib/secure/room/
ds2.9a12/lib/secure/save/
ds2.9a12/lib/secure/save/backup/
ds2.9a12/lib/secure/save/boards/
ds2.9a12/lib/secure/tmp/
ds2.9a12/lib/secure/upgrades/files/
ds2.9a12/lib/secure/verbs/creators/
ds2.9a12/lib/std/board/
ds2.9a12/lib/std/lib/
ds2.9a12/lib/tmp/
ds2.9a12/lib/verbs/admins/include/
ds2.9a12/lib/verbs/builders/
ds2.9a12/lib/verbs/common/
ds2.9a12/lib/verbs/common/include/
ds2.9a12/lib/verbs/creators/
ds2.9a12/lib/verbs/creators/include/
ds2.9a12/lib/verbs/rooms/
ds2.9a12/lib/verbs/rooms/include/
ds2.9a12/lib/www/client/
ds2.9a12/lib/www/errors/
ds2.9a12/lib/www/images/
ds2.9a12/lib/www/lpmuds/downloads_files/
ds2.9a12/lib/www/lpmuds/intermud_files/
ds2.9a12/lib/www/lpmuds/links_files/
ds2.9a12/win32/
#include <daemons.h>

inherit "/lib/std/room";

#define COST    money/bonus
#define MAX_DONATION 600

mapping blood;

void init() {
    ::init();
    add_action("new_body", "renew");
    add_action("clean_poison", "clean");
    add_action("regenerate", "regenerate");
    add_action("read", "read");
    add_action("donate", "donate");
    add_action("transfuse", "transfuse");
}

void create() {
    seteuid(getuid());
    SetProperty("light", 2);
    SetProperty("indoors", 1);
    SetShort("Cleric's Hospital of Praxis");
    SetLong(
	"You are in the local hospital run by the town's clerics.\n"+
	"Here they specialize in the regeneration of lost limbs.\n"+
	"A list of all services they perform is posted on the wall.\n"
    );
    set_item_descriptions(
	({
	"list", "hospital", "clerics", "cleric"
	}),
	({
	"You can read all the services by typing <read list>.\n",
	"The clerics here specialize in regenerating lost limbs.\n",
	"They are mending the wounds of patients.\n",
	"He is mending a patient's wounds.\n"
	})
    );
    SetExits( ([
      	"east"	 : 	"/domains/Praxis/n_centre2"	,
      ]) );
    blood = ([ "who": ([]), "hp":200, "mp":200 ]);
    SetProperty("no teleport", 1);
}

int new_body(string str) {
    object *inv;
    int i;


    if( (int)this_player()->query_level() != 1) {
	notify_fail("The clerics only perform this service for the inexperienced.\n");
	return 0;
    }
    inv = all_inventory(this_player());
    for(i=0; i<sizeof(inv); i++) {
	inv[i]->unequip();
    }
    write("A cleric comes over to you and mutters a small prayer.\n");
    write("You again have the all the limbs you were born with!\n");
    say("A cleric mutters a small prayer for the novice "+this_player()->query_cap_name()+".\n", this_player());
    this_player()->new_body();
    return 1;
}

int read(string str) {
    if(!str) {
	notify_fail("Read what?\n");
	return 0;
    }
    if(str != "list") {
	notify_fail("That is not here for reading.\n");
	return 0;
    }
    write("Welcome to the Cleric's Hospital of Praxis!\n"+
	"The clerics perform the following services:\n"+
	"------------------------------------------------------------------\n"+
	"<renew body>: This is a charity service the clerics perform for\n"+
	"	novice adventurers who have lost limbs while adventuring.\n"+
	"	All limbs are replaced.\n\n"+
	"<regenerate [limb]>: This service is for the experienced adventurer\n"+
	"	who has lost limbs.  The limb is replaced and acts like new.\n"+
	"	Tithe schedule for regeneration:\n"+
	"               hands and feet-     400 gold\n");
    write("               arms and legs-      600 gold\n"+
	"<clean poison>: Helps remove some of the poison from your body.\n"+
	"\ttithe: 50 gold\n"+
	"<donate # (hp or mp) of blood>: Donates some of your blood in\n"+
	"\texchange for gold.\n"+
	"<transfuse # (hp or mp)>: Transfuse some blood int hp or mp into your body\n"+
	"\ttithe: amount * 3 gold coins.\n"+
	"Currently: "+blood["hp"]+" hp blood and "+blood["mp"]+" mp blood free.\n"+
	"------------------------------------------------------------------\n"+
        "Half off all regenerations with the severed limb!\n"+
 	"Your tithe is used only toward good causes.\n");
    return 1;
}

int clean_poison(string str) {
    object tp;

    if(!str) return 0;
    if(str != "poison") return 0;
    tp = this_player();
    if((int)tp->query_poisoning()<1) {
	notify_fail("A cleric whispers to you: But you are not poisoned!\n");
	return 0;
    }
    if((int)tp->query_money("gold") < 50) {
	notify_fail("You do not have enough gold for the tithe.\n");
	return 0;
    }
    tp->add_money("gold", -50);
    tp->add_poisoning(-10);
    write("A cleric casts a spell of healing upon you.\n");
    say("A cleric casts a spell of healing on "+tp->query_cap_name()+".\n", tp);
    return 1;
}

int regenerate(string limb) {
    int money, bonus;
    mapping limb_info;
    object tp;
    string *there, *missing;

    tp = this_player();
    if(present(limb, this_player())) bonus = 2;
    else bonus = 1;
    there = (string *)tp->query_limbs();
    missing = (string *)this_player()->query_severed_limbs() +
      (string *)RACE_D->query_limbs((string)this_player()->query_race());
/*
   checking with the race_d is allowing compatibility with old
   versions of the mudlib
*/
    if(!missing) {
	notify_fail("You aren't missing any limbs!\n");
	return 0;
    }
    if(member_array(limb, missing) == -1) {
	notify_fail("You are not missing that limb!\n");
	return 0;
    }
    if(member_array(limb, there) != -1) {
	notify_fail("You already have that one back!\n");
	return 0;
    }
    limb_info= (mapping)RACE_D->query_limb_info(limb,(string)tp->query_race());
    if(!limb_info) {
        notify_fail("That limb cannot be replaced!\n");
        return 0;
    }
    if(limb_info["ref"] != "") {
        if(member_array(limb_info["ref"], there) == -1) {
            notify_fail("You would need a "+limb_info["ref"]+" for that!\n");
	    return 0;
	}
    }
    if((string)this_player()->query_class() == "cleric") money = 1200;
    else money = 1600;
    money = money / limb_info["max"];
    if((int)tp->query_money("gold") < COST) {
	notify_fail("The cleric tells you:  You do not have enough gold.\n");
	return 0;
    }
    tp->AddLimb(limb, limb_info["ref"], (int)tp->query_max_hp()/limb_info["max"], 0, 0);
    if(member_array(limb, (string *)RACE_D->query_wielding_limbs((string)tp->qyery_race())) != -1) 
        tp->add_wielding_limb(limb);
	tp->add_money("gold", -COST);
    if(limb == "left hand") {
	if(member_array("left arm", there) == -1) {
	    notify_fail("You would need a left arm for that!\n");
	    return 0;
	}
        money = 400;
	if((int)tp->query_money("gold") < COST) {
	    notify_fail("The cleric tells you: You do not have enough gold for that.\n");
	    return 0;
	}
	tp->AddLimb(limb, "", (int)tp->query_max_hp()/4, 0, 0);
        tp->add_wielding_limb(limb);
	tp->add_money("gold", -COST);
    }
    else if(limb == "left foot" || limb == "right foot") {
        money = 400;
        if((int)tp->query_money("gold") < COST) {
            notify_fail("The cleric says: You don't have enough gold for the tithe.\n");
            return 0;
        }
        if( (limb == "left foot" && member_array("left leg", there) == -1) || (limb == "right foot" && member_array("right leg", there) == -1) ) {
            notify_fail("You need a limb to attatch it to!\n");
            return 0;
        }
        tp->AddLimb(limb, "", (int)tp->query_max_hp()/4, 0, 0);
        tp->add_money("gold", -COST);
    }
    else if(limb == "left arm" || limb == "left leg" || limb == "right arm" || limb == "right leg") {
        money = 600;
	if((int)tp->query_money("gold") < COST) {
	    notify_fail("The cleric tells you:  You do not have enough gold for the tithe.\n");
	    return 0;
	}
	if(limb == "left arm") tp->AddLimb(limb, "left hand", (int)tp->query_max_hp()/3, 0, 0);
        else if(limb == "left leg") tp->AddLimb(limb, "left foot", (int)tp->query_max_hp()/3, 0, 0);
        else if(limb == "right leg") tp->AddLimb(limb, "right foot", (int)tp->query_max_hp()/3, 0, 0);
	else tp->AddLimb(limb, "right hand", (int)tp->query_max_hp()/3, 0, 0);
	tp->add_money("gold", -COST);
    }
    else {
	write("The cleric says: Sorry, but we do not have the ability to do that.\n");
	say("A cleric looks sadly at "+tp->query_cap_name()+".\n", tp);
	return 1;
    }
    say(tp->query_cap_name()+" asks the clerics for some help with "+tp->query_possessive()+" missing "+limb+".\n", tp);
    write("The clerics restore your "+limb+"!\n");
    return 1;
}

int donate(string str) {
    string what;
    int amount, tmp;
 
    if(!str) {
	notify_fail("Donate what?\n");
	return 0;
    }
    if(sscanf(str, "%d %s of blood", amount, what) !=2) {
	notify_fail("Correct syntax: <donate [#] [hp | mp] of blood>\n");
	return 0;
    }
    if(what != "mp" && what != "hp") {
	notify_fail("Donate what?\n");
	return 0;
    }
    if(blood[(string)this_player()->query_name()]+amount > MAX_DONATION) {
	write("You will have to wait before giving that much blood.\n");
	return 1;
    }
    tmp = (int)call_other(this_player(), "query_"+what);
    if(tmp < amount + 5) {
	notify_fail("You must have at least 5 more than you plan to give!\n");
	return 0;
    }
    call_other(this_player(), "add_"+what, -amount);
    this_player()->add_money("gold", amount/2);
    blood[what] += amount;
    blood["who"][(string)this_player()->query_name()] += amount;
    write("You donate some blood for "+(amount/2)+" gold coins.\n");
    say(this_player()->query_cap_name()+" donates some blood for some gold.\n", this_player());
    call_out("reduce_donation", 900, ({ this_player(), amount }));
    return 1;
}

int transfuse(string str) {
    string what;
    int amount;

    if(!str) {
	notify_fail("Transfuse what?\n");
	return 0;
    }
    if(sscanf(str, "%d %s", amount, what) != 2) {
	notify_fail("Correct syntax: <transfuse [#] [mp | hp]>\n");
	return 0;
    }
    if(what != "hp" && what != "mp") {
	notify_fail("You cannot do that!\n");
	return 0;
    }
    if(amount < 1) {
        notify_fail("Are you crazy?!?\n");
        return 0;
    }
    if(blood[what] < amount) {
	notify_fail("We do not have that much blood in right now.\n");
	return 0;
    }
    if((int)this_player()->query_money("gold") < amount*3) {
	notify_fail("You do not have enough gold for the tithe.\n");
	return 0;
    }
    this_player()->add_money("gold", -(amount*3));
    call_other(this_player(), "add_"+what, amount);
    write("You receive a blood transfusion\n");
    say(this_player()->query_cap_name()+" receives a blood transfusion.\n", this_player());
    return 1;
}

void reduce_donation(mixed *tmp) {
    blood["who"][tmp[0]] -= tmp[1];
    if(blood["who"][tmp[0]] < 1) map_delete(blood, tmp[0]);
}