nightmare4_fluffos_v1/
nightmare4_fluffos_v1/bin/
nightmare4_fluffos_v1/fluffos-2.9-ds2.14/
nightmare4_fluffos_v1/fluffos-2.9-ds2.14/ChangeLog.old/
nightmare4_fluffos_v1/fluffos-2.9-ds2.14/Win32/
nightmare4_fluffos_v1/fluffos-2.9-ds2.14/compat/
nightmare4_fluffos_v1/fluffos-2.9-ds2.14/compat/simuls/
nightmare4_fluffos_v1/fluffos-2.9-ds2.14/include/
nightmare4_fluffos_v1/fluffos-2.9-ds2.14/testsuite/
nightmare4_fluffos_v1/fluffos-2.9-ds2.14/testsuite/clone/
nightmare4_fluffos_v1/fluffos-2.9-ds2.14/testsuite/command/
nightmare4_fluffos_v1/fluffos-2.9-ds2.14/testsuite/data/
nightmare4_fluffos_v1/fluffos-2.9-ds2.14/testsuite/etc/
nightmare4_fluffos_v1/fluffos-2.9-ds2.14/testsuite/include/
nightmare4_fluffos_v1/fluffos-2.9-ds2.14/testsuite/inherit/
nightmare4_fluffos_v1/fluffos-2.9-ds2.14/testsuite/inherit/master/
nightmare4_fluffos_v1/fluffos-2.9-ds2.14/testsuite/log/
nightmare4_fluffos_v1/fluffos-2.9-ds2.14/testsuite/single/
nightmare4_fluffos_v1/fluffos-2.9-ds2.14/testsuite/single/tests/compiler/
nightmare4_fluffos_v1/fluffos-2.9-ds2.14/testsuite/single/tests/efuns/
nightmare4_fluffos_v1/fluffos-2.9-ds2.14/testsuite/single/tests/operators/
nightmare4_fluffos_v1/fluffos-2.9-ds2.14/testsuite/u/
nightmare4_fluffos_v1/fluffos-2.9-ds2.14/tmp/
nightmare4_fluffos_v1/fluffos-2.9-ds2.14/windows/
nightmare4_fluffos_v1/lib/cfg/
nightmare4_fluffos_v1/lib/cmds/admins/
nightmare4_fluffos_v1/lib/cmds/common/
nightmare4_fluffos_v1/lib/cmds/creators/include/
nightmare4_fluffos_v1/lib/cmds/creators/include/SCCS/
nightmare4_fluffos_v1/lib/cmds/hm/
nightmare4_fluffos_v1/lib/daemon/services/
nightmare4_fluffos_v1/lib/doc/
nightmare4_fluffos_v1/lib/doc/faq/
nightmare4_fluffos_v1/lib/doc/help/classes/
nightmare4_fluffos_v1/lib/doc/help/creators/
nightmare4_fluffos_v1/lib/doc/help/hm/
nightmare4_fluffos_v1/lib/doc/help/players/
nightmare4_fluffos_v1/lib/doc/help/races/
nightmare4_fluffos_v1/lib/doc/help/religion/
nightmare4_fluffos_v1/lib/doc/mudlib/
nightmare4_fluffos_v1/lib/doc/mudlib/cfg/
nightmare4_fluffos_v1/lib/domains/Ylsrim/
nightmare4_fluffos_v1/lib/domains/Ylsrim/adm/
nightmare4_fluffos_v1/lib/domains/Ylsrim/armour/
nightmare4_fluffos_v1/lib/domains/Ylsrim/fish/
nightmare4_fluffos_v1/lib/domains/Ylsrim/meal/
nightmare4_fluffos_v1/lib/domains/Ylsrim/npc/
nightmare4_fluffos_v1/lib/domains/Ylsrim/virtual/
nightmare4_fluffos_v1/lib/domains/Ylsrim/weapon/
nightmare4_fluffos_v1/lib/domains/Ylsrim/xtra/
nightmare4_fluffos_v1/lib/lib/comp/
nightmare4_fluffos_v1/lib/lib/lvs/
nightmare4_fluffos_v1/lib/lib/std/
nightmare4_fluffos_v1/lib/lib/user/
nightmare4_fluffos_v1/lib/news/
nightmare4_fluffos_v1/lib/obj/
nightmare4_fluffos_v1/lib/obj/include/
nightmare4_fluffos_v1/lib/save/
nightmare4_fluffos_v1/lib/save/kills/a/
nightmare4_fluffos_v1/lib/save/kills/b/
nightmare4_fluffos_v1/lib/save/kills/f/
nightmare4_fluffos_v1/lib/save/kills/m/
nightmare4_fluffos_v1/lib/save/kills/q/
nightmare4_fluffos_v1/lib/save/kills/r/
nightmare4_fluffos_v1/lib/secure/cfg/
nightmare4_fluffos_v1/lib/secure/cfg/classes/
nightmare4_fluffos_v1/lib/secure/cfg/races/SCCS/
nightmare4_fluffos_v1/lib/secure/cmds/creators/include/
nightmare4_fluffos_v1/lib/secure/cmds/players/
nightmare4_fluffos_v1/lib/secure/cmds/players/include/
nightmare4_fluffos_v1/lib/secure/daemon/include/
nightmare4_fluffos_v1/lib/secure/lib/
nightmare4_fluffos_v1/lib/secure/lib/include/
nightmare4_fluffos_v1/lib/secure/lib/net/
nightmare4_fluffos_v1/lib/secure/lib/std/
nightmare4_fluffos_v1/lib/secure/obj/
nightmare4_fluffos_v1/lib/secure/obj/include/
nightmare4_fluffos_v1/lib/secure/save/
nightmare4_fluffos_v1/lib/secure/save/boards/
nightmare4_fluffos_v1/lib/secure/save/votes/
nightmare4_fluffos_v1/lib/spells/
nightmare4_fluffos_v1/lib/verbs/admins/include/
nightmare4_fluffos_v1/lib/verbs/common/
nightmare4_fluffos_v1/lib/verbs/common/include/
nightmare4_fluffos_v1/lib/verbs/creators/
nightmare4_fluffos_v1/lib/verbs/creators/include/
nightmare4_fluffos_v1/lib/verbs/players/include/SCCS/
nightmare4_fluffos_v1/lib/verbs/rooms/
nightmare4_fluffos_v1/lib/verbs/rooms/include/
nightmare4_fluffos_v1/lib/www/
nightmare4_fluffos_v1/old/
nightmare4_fluffos_v1/old/tools/
nightmare4_fluffos_v1/win32/
/*    /lib/meal.c
 *    from the Nightmare IV LPC Library
 *    standard food and drink code
 *    created by descartes of Borg 950603
 *    Version: @(#) meal.c 1.3@(#)
 *    Last modified: 97/01/03
 */
 
#include <lib.h>
#include <function.h>
#include <meal_types.h>
#include <rounds.h>
#include <vendor_types.h>
#include "include/meal.h"
 
inherit LIB_BAIT_WITH;
inherit LIB_ITEM;
 
private int MealStrength, MealType;
private string EmptyItem, EmptyName, OtherMessage;
private mixed EmptyShort, EmptyLong, MyMessage;
 
static void create() {
    item::create();
    MealType = MEAL_ALCOHOL;
    EmptyItem = 0;
    EmptyName = "bottle";
    EmptyShort = "an empty bottle";
    EmptyLong = "This empty bottle once contained some alcohol.";
    MyMessage = "You drink your drink.";
    OtherMessage = "$N drinks $P drink.";
    SetVendorType(VT_DRINK);
    AddSave( ({ "MealStrength", "MealType", "BaitStrength" }) );
}

mixed direct_drink_obj() { 
    if( environment() != this_player() ) return "#You don't have that!";
    if( MealType & MEAL_FOOD ) return "Wouldn't you rather eat it?";
    return (int)this_player()->CanDrink(this_object());
}

mixed direct_drink_from_obj() {
    if( MealType & MEAL_FOOD ) return 0;
    if( environment() != this_player() ) return "#You don't have that!";
    return (int)this_player()->CanDrink(this_object());
}

mixed direct_eat_obj() {
    if( environment() != this_player() ) return "#You don't have that!";
    if( !(MealType & MEAL_FOOD) ) return "Wouldn't you rather drink it?";
    return (int)this_player()->CanEat(this_object());
}

static mixed AddSave(mixed *vars) { return item::AddSave(vars); }

string GetShort() { return item::GetShort(); }

int eventDestruct() { return item::eventDestruct(); }

mixed eventDrink(object who) {
    mixed tmp;
    int x;
 
    if( (tmp = (mixed)who->eventDrink(this_object())) != 1 ) return tmp;
    if( (x = functionp(MyMessage)) && !(x & FP_OWNER_DESTED) ) {
	evaluate(MyMessage, who);
    }
    else {
        string mymsg, othermsg;
 
        mymsg = replace_string(MyMessage, "$P", "your");
        othermsg = replace_string(OtherMessage, "$P", possessive(who));
        mymsg = replace_string(mymsg, "$N", "you");
        othermsg = replace_string(othermsg, "$N", (string)who->GetName());
        who->eventPrint( capitalize(mymsg) );
        environment(who)->eventPrint( capitalize(othermsg), who );
    }
    if( GetEmptyItem() ) {
        object ob;
 
        ob = new(GetEmptyItem() || LIB_ITEM);
        if( base_name(ob) == LIB_ITEM ) {
            ob->SetKeyName(GetEmptyName());
            ob->SetId( ({ GetEmptyName(), "container", "empty container" }) );
            ob->SetShort(GetEmptyShort());
            ob->SetLong(GetEmptyLong());
            ob->SetValue(10);
            ob->SetMass(100);
            ob->SetDestroyOnSell();
        }
        if( !((int)ob->eventMove(who)) ) {
            who->eventPrint("You drop " + (string)ob->GetShort() + ".");
            environment(who)->eventPrint((string)who->GetName() +
                             " drops " + (string)ob->GetShort() + ".", who);
            ob->eventMove(environment(who));
        }
    }
    if( x = GetPoison() ) {
        if( random((int)who->GetStatLevel("luck")) > 35 )
            who->eventPrint("That didn't seem to taste quite right.");
        who->AddPoison(x);
    }
    Destruct();
    return 1;
}
 
mixed eventEat(object who) {
    mixed tmp;
    int x;
 
    if( (tmp = (mixed)who->eventEat(this_object())) != 1 ) return tmp;
    if( (x = functionp(MyMessage)) && !(x & FP_OWNER_DESTED) ) {
	evaluate(MyMessage, who);
    }
    else {
        string mymsg, othermsg;
 
        mymsg = replace_string(MyMessage, "$P", "your");
        othermsg = replace_string(OtherMessage, "$P",
                                  possessive(who));
        mymsg = replace_string(mymsg, "$N", "you");
        othermsg = replace_string(othermsg, "$N", (string)who->GetName());
        who->eventPrint( capitalize(mymsg) );
        environment(who)->eventPrint( capitalize(othermsg), who );
    }
    if( x = GetPoison() ) {
        if( random((int)who->GetStatLevel("luck")) > 35 )
            who->eventPrint("You notice a strange aftertaste.");
        who->AddPoison(x);
    }
    Destruct();
    return 1;
}
 
int eventPoison(object who, object agent, int x) {
    who->eventPrint("You put some poison "
                    "in " + add_article(GetShort()) + ".");
    environment(who)->eventPrint( (string)who->GetName()+" puts something "
                      "in " + add_article(GetShort()) + ".", who);
    AddPoison(x);
    return 1;
}
 
string SetEmptyItem(string file) { return (EmptyItem = file); }
 
string GetEmptyItem() { return EmptyItem; }
 
string SetEmptyName(string str) { return (EmptyName = str); }
 
string GetEmptyName() { return EmptyName; }
 
mixed SetEmptyShort(mixed val) { return (EmptyShort = val); }
 
mixed GetEmptyShort() { return EmptyShort; }
 
mixed SetEmptyLong(mixed val) { return (EmptyLong = val); }
 
mixed GetEmptyLong() { return EmptyLong; }
 
int SetMealType(int x) {
    int vt = 0;
 
    if( x & MEAL_FOOD ) {
        vt |= VT_FOOD;
        MyMessage = "You eat your food.";
        OtherMessage = "$N eats $P food.";
    }
    if( x & MEAL_DRINK ) vt |= VT_DRINK;
    SetVendorType(vt);
    return (MealType = x);
}
 
int GetMealType() { return MealType; }
 
int SetStrength(int x) { return (MealStrength = x); }
 
int GetStrength() { return MealStrength; }
 
varargs void SetMealMessages(mixed array val...) {
    if( !arrayp(val) ) {
	error(sprintf("Bad argument 1 to SetMealMessages(): %O\n", val));
    }
    if( sizeof(val) == 1 ) {
	if( arrayp(val[0]) ) SetMealMessages(val[0]...);
	else if( stringp(val[0]) || functionp(val[0]) ) MyMessage = val[0];
	else error(sprintf("Bad argument 1 to SetMealMessages(): %O\n",
			   val[0]));
	return;
    }
    if( !stringp(val[0]) )
      error(sprintf("Bad argument 1 to SetMealMessages(): %O\n", val[0]));
    else if( !stringp(val[1]) ) 
      error(sprintf("Bad argument 2 to SetMealMessages(): %O\n", val[1]));
    MyMessage = val[0];
    OtherMessage = val[1];
}
 
mixed *GetMealMessages() { return ({ MyMessage, OtherMessage }); }
 
int GetValue() {
    int x;
 
    x = GetStrength();
    return (x * (6 + x)) / 10 + 10;
}