nightmare3_fluffos_v2/
nightmare3_fluffos_v2/bin/
nightmare3_fluffos_v2/fluffos-2.9-ds2.08/
nightmare3_fluffos_v2/fluffos-2.9-ds2.08/ChangeLog.old/
nightmare3_fluffos_v2/fluffos-2.9-ds2.08/Win32/
nightmare3_fluffos_v2/fluffos-2.9-ds2.08/compat/
nightmare3_fluffos_v2/fluffos-2.9-ds2.08/compat/simuls/
nightmare3_fluffos_v2/fluffos-2.9-ds2.08/include/
nightmare3_fluffos_v2/fluffos-2.9-ds2.08/testsuite/
nightmare3_fluffos_v2/fluffos-2.9-ds2.08/testsuite/clone/
nightmare3_fluffos_v2/fluffos-2.9-ds2.08/testsuite/command/
nightmare3_fluffos_v2/fluffos-2.9-ds2.08/testsuite/data/
nightmare3_fluffos_v2/fluffos-2.9-ds2.08/testsuite/etc/
nightmare3_fluffos_v2/fluffos-2.9-ds2.08/testsuite/include/
nightmare3_fluffos_v2/fluffos-2.9-ds2.08/testsuite/inherit/
nightmare3_fluffos_v2/fluffos-2.9-ds2.08/testsuite/inherit/master/
nightmare3_fluffos_v2/fluffos-2.9-ds2.08/testsuite/log/
nightmare3_fluffos_v2/fluffos-2.9-ds2.08/testsuite/single/
nightmare3_fluffos_v2/fluffos-2.9-ds2.08/testsuite/single/tests/compiler/
nightmare3_fluffos_v2/fluffos-2.9-ds2.08/testsuite/single/tests/efuns/
nightmare3_fluffos_v2/fluffos-2.9-ds2.08/testsuite/single/tests/operators/
nightmare3_fluffos_v2/fluffos-2.9-ds2.08/testsuite/u/
nightmare3_fluffos_v2/fluffos-2.9-ds2.08/tmp/
nightmare3_fluffos_v2/fluffos-2.9-ds2.08/windows/
nightmare3_fluffos_v2/lib/cmds/ambassador/
nightmare3_fluffos_v2/lib/cmds/database/
nightmare3_fluffos_v2/lib/cmds/hm/
nightmare3_fluffos_v2/lib/cmds/soul/
nightmare3_fluffos_v2/lib/daemon/cfg/
nightmare3_fluffos_v2/lib/daemon/cfg/mon_races/
nightmare3_fluffos_v2/lib/daemon/cfg/races/
nightmare3_fluffos_v2/lib/daemon/include/
nightmare3_fluffos_v2/lib/daemon/save/
nightmare3_fluffos_v2/lib/daemon/services/
nightmare3_fluffos_v2/lib/daemon/soul/
nightmare3_fluffos_v2/lib/doc/
nightmare3_fluffos_v2/lib/doc/TestPlans/
nightmare3_fluffos_v2/lib/doc/approval/
nightmare3_fluffos_v2/lib/doc/approval/QC/
nightmare3_fluffos_v2/lib/doc/approval/balance/
nightmare3_fluffos_v2/lib/doc/build/
nightmare3_fluffos_v2/lib/doc/build/armours/
nightmare3_fluffos_v2/lib/doc/build/economy/
nightmare3_fluffos_v2/lib/doc/build/etc/
nightmare3_fluffos_v2/lib/doc/build/monster/
nightmare3_fluffos_v2/lib/doc/build/room/
nightmare3_fluffos_v2/lib/doc/build/virtual/
nightmare3_fluffos_v2/lib/doc/build/weapon/
nightmare3_fluffos_v2/lib/doc/classes/
nightmare3_fluffos_v2/lib/doc/efun/
nightmare3_fluffos_v2/lib/doc/etc/
nightmare3_fluffos_v2/lib/doc/help/creator/
nightmare3_fluffos_v2/lib/doc/help/hm/
nightmare3_fluffos_v2/lib/doc/law/
nightmare3_fluffos_v2/lib/doc/lpc/basic/
nightmare3_fluffos_v2/lib/doc/lpc/data_types/
nightmare3_fluffos_v2/lib/doc/lpc/etc/
nightmare3_fluffos_v2/lib/doc/lpc/intermediate/
nightmare3_fluffos_v2/lib/doc/lpc/types/
nightmare3_fluffos_v2/lib/doc/mudlib/
nightmare3_fluffos_v2/lib/doc/mudlib/features/
nightmare3_fluffos_v2/lib/domains/Examples/etc/
nightmare3_fluffos_v2/lib/domains/Examples/room/
nightmare3_fluffos_v2/lib/domains/Examples/virtual/
nightmare3_fluffos_v2/lib/domains/Examples/virtual/exaA/
nightmare3_fluffos_v2/lib/domains/Examples/virtual/exaB/
nightmare3_fluffos_v2/lib/domains/Examples/weapon/
nightmare3_fluffos_v2/lib/domains/Praxis/
nightmare3_fluffos_v2/lib/domains/Praxis/adm/
nightmare3_fluffos_v2/lib/domains/Praxis/attic/
nightmare3_fluffos_v2/lib/domains/Praxis/cemetary/
nightmare3_fluffos_v2/lib/domains/Praxis/cemetary/mon/
nightmare3_fluffos_v2/lib/domains/Praxis/data/
nightmare3_fluffos_v2/lib/domains/Praxis/death/
nightmare3_fluffos_v2/lib/domains/Praxis/mountains/
nightmare3_fluffos_v2/lib/domains/Praxis/obj/armour/
nightmare3_fluffos_v2/lib/domains/Praxis/obj/magic/
nightmare3_fluffos_v2/lib/domains/Praxis/obj/weapon/
nightmare3_fluffos_v2/lib/domains/Praxis/orc_valley/
nightmare3_fluffos_v2/lib/domains/Praxis/quests/
nightmare3_fluffos_v2/lib/domains/Praxis/standardOld/
nightmare3_fluffos_v2/lib/include/
nightmare3_fluffos_v2/lib/log/
nightmare3_fluffos_v2/lib/log/errors/
nightmare3_fluffos_v2/lib/log/reports/
nightmare3_fluffos_v2/lib/log/watch/
nightmare3_fluffos_v2/lib/news/
nightmare3_fluffos_v2/lib/secure/cfg/
nightmare3_fluffos_v2/lib/secure/cmds/ambassador/
nightmare3_fluffos_v2/lib/secure/cmds/mortal/
nightmare3_fluffos_v2/lib/secure/save/users/d/
nightmare3_fluffos_v2/lib/secure/std/
nightmare3_fluffos_v2/lib/std/hm/
nightmare3_fluffos_v2/lib/std/living/
nightmare3_fluffos_v2/lib/std/room/
nightmare3_fluffos_v2/lib/std/user/
nightmare3_fluffos_v2/lib/std/virtual/
nightmare3_fluffos_v2/lib/www/
nightmare3_fluffos_v2/lib/www/errors/
nightmare3_fluffos_v2/lib/www/gateways/
nightmare3_fluffos_v2/win32/
#include <std.h>
#include <daemons.h>

inherit 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() {
    ::create();
 set_properties( (["light" :2 , "indoors" :1 , "castle" : 1 ]) );
    set_short( "the hospital of Praxis");
    set_long(
        "You are in the hospital of Praxis. It basically consists "
"of one large single room, with several crude beds placed in rows. "
"The hospital doesn't look to be to clean, you might want to think "
"twice before engaging their services. A list of all the services "
"that can be performed is posted on the far wall. The exit back to the "
"main road is east.");
    set_items(
	(["list" : "You can read all the services by typing <read list>.",
	  "hospital" : "The clerics here specialize in regenerating "
	    "lost limbs.",
	  "clerics" : "They are mending the wounds of patients.",
	  "cleric" : "He is mending a patient's wounds."]));
    set_exits( 
	      (["east" : "/domains/Praxis/n_centre2"]) );
    blood = ([ "who": ([]), "hp":200, "mp":200 ]);
    set_property("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.");
    write("You again have all the limbs you were born with!");
    say("A cleric mutters a small prayer for the novice "+this_player()->query_cap_name()+".", 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;
    }
    message("info", "Welcome to the Cleric's Hospital of Praxis!",this_player());
    message("Ninfo",
	"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"
	"<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"
        "            from "+currency_value(320, "gold")+" gold for minor limbs (non-clerics)\n"
        "            to "+currency_value(800, "gold")+" gold for major limbs (non-clerics)\n"
        "            "+currency_value(240, "gold")+" to "+currency_value(600, "gold")+" gold for clerics\n"
	"<clean poison>: Helps remove some of the poison from your body.\n"
        "\ttithe: "+currency_value(50, "gold")+" 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 times "+currency_value(3, "gold")+" gold.\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", this_player());
    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") < currency_value(50, "gold")) {
	notify_fail("You do not have enough gold for the tithe.\n");
	return 0;
    }
    tp->add_money("gold", -currency_value(50, "gold"));
    tp->add_poisoning(-10);
    write("A cleric casts a spell of healing upon you.");
    say("A cleric casts a spell of healing on "+tp->query_cap_name()+".", 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["attach"] != "0") {
        if(member_array(limb_info["attach"], there) == -1) {
            notify_fail("You would need a "+limb_info["attach"]+" for that!\n");
	    return 0;
	}
    }
    if(strsrch(limb, "hand") != -1 || strsrch(limb, "foot") != -1 || 
      strsrch(limb, "hoof") != -1) {
        money = ((string)this_player()->query_class() == "cleric" ? 
          currency_value(240, "gold") : currency_value(320, "gold"));
    }
    else money = ((string)this_player()->query_class() == "cleric" ? 
      currency_value(600, "gold") : currency_value(800, "gold"));
    if((int)tp->query_money("gold") < COST) {
	notify_fail("The cleric tells you:  You do not have enough gold.\n");
	return 0;
    }
    tp->add_limb(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->query_race())) != -1) 
        tp->add_wielding_limb(limb);
    this_player()->add_money("gold", -COST);
    say(sprintf("%s asks the clerics for some help with %s missing %s.",
      this_player()->query_cap_name(), possessive(this_player()), limb));
    write("The clerics restore your "+limb+"!");
    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.");
	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", currency_value(amount/5, "gold"));
    blood[what] += amount;
    blood["who"][(string)this_player()->query_name()] += amount;
    write("You donate some blood for "+(currency_value(amount/5, "gold"))+" gold coins.");
    say(this_player()->query_cap_name()+" donates some blood for some gold.", 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") < currency_value(amount*3, "gold")) {
	notify_fail("You do not have enough gold for the tithe.\n");
	return 0;
    }
    this_player()->add_money("gold", -currency_value(amount*3, "gold"));
    call_other(this_player(), "add_"+what, amount);
    write("You receive a blood transfusion");
    say(this_player()->query_cap_name()+" receives a blood transfusion.", 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]);
}