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/
/*    /lib/item.c
 *    from the Dead Souls LPC Library
 *    inheritable object for all tangible game objects
 *    created by Descartes of Borg 950207
 *    Version: @(#) item.c 1.30@(#)
 *    Last Modified: 97/01/01
 */

#include <lib.h>
#include <dirs.h>
#include <daemons.h>

inherit LIB_BURY;
inherit LIB_DETECT;
inherit LIB_DETERIORATION;
inherit LIB_DROP;
inherit LIB_GET;
inherit LIB_GIVE;
inherit LIB_LOCK_WITH;
inherit LIB_MASS;
inherit LIB_MOVE;
inherit LIB_OBJECT;
inherit LIB_PERSIST;
inherit LIB_PUT;
inherit LIB_READ;
inherit LIB_SELL;
inherit LIB_SHOW;
inherit LIB_STEAL;
inherit LIB_UNIQUENESS;
inherit LIB_VALUE;
inherit LIB_WEAPON;
inherit LIB_MONEY;
inherit LIB_FALL;
inherit LIB_SINK;

private int RetainOnDeath, nocondition;
private string QuestId = "";

/* ******************** item.c attributes ******************** */
string GetExternalDesc(object who){
    string desc = object::GetExternalDesc(who);
    string tmp;

    if( desc == "" ){
        return "";
    }
    if( tmp = GetEquippedDescription(who) ){
        desc += tmp + "\n";
    }
    if( GetBroken() ){
        desc += "It appears to be broken.";
    }
    else if( tmp = GetItemCondition() ){
        desc += tmp;
    }
    return desc;
}

int SetNoCondition(int i){
    nocondition = i;
}

string SetQuestId(string name){
    QuestId = name;
    return QuestId;
}

string GetQuestId(){
    return QuestId;
}

string GetItemCondition(){

    if(nocondition) return "";

    if( GetMaxClass() ){
        float i = to_float(GetClass()) / GetMaxClass() * 100.0;

        if( i > 95.0 ){
            return " It is as good as new.";
        }
        else if( i > 80.0 ){
            return " It is in good condition.";
        }
        else if( i > 70.0 ){
            return " It is in decent condition.";
        }
        else if( i > 50.0 ){
            return " It is somewhat worn and battered.";
        }
        else if( i > 30.0 ){
            return " It is worn down and dented.";
        }
        else if( i > 10.0 ){
            return " It is very worn down and in bad shape.";
        }
        else {
            return " It has worn down completely.";
        }
    }
    else {
        return deterioration::GetItemCondition();
    }
}

int GetRetainOnDeath(){
    return RetainOnDeath;
}

int SetRetainOnDeath(int x){
    return (RetainOnDeath = x);
}

static mixed array AddSave(mixed array vars){
    if(!vars) vars = ({});
    vars += ({ "Properties" });
    return persist::AddSave(vars);
}

string array GetSave(){
    return persist::GetSave();
}

/* ************************ item.c modals *********************** */ 
mixed CanRepair(object who){
    if( GetBroken() ) return 1;
    else if( !GetMaxClass() ) return "It doesn't need repairing.";
    else return 1;
}

mixed CanSteal(object who){
    if( GetWorn() ){
        return "You can't steal something equipped!";
    }
    return steal::CanSteal(who);
}

varargs mixed CanThrow(object who, object target){
    return 1;
}

/* ********************* item.c events ************************ */ 
static int Destruct(){
    if( GetWorn() && environment() ){
        eventUnequip(environment());
    }
    return object::Destruct();
}

int eventMove(mixed dest){
    if(!this_object()) return 0;
    if( !environment() && GetWorn() ){
        mixed array limbs = GetWorn();

        SetWorn(0);
        call_out((: eventRestoreEquip :), 0, limbs);
    }
    if( GetWorn() && environment() ){
        eventUnequip(environment());
    }
    return move::eventMove(dest);
}

void eventDeteriorate(int type){
    weapon::eventDeteriorate();
    SetDestroyOnSell(1);
    SetValue(GetValue()/2);
}

void eventRemoveBlessing(){
    SetProperty("blessed", 0);
    if( living(environment()) ){
        environment()->eventPrint("%^YELLOW%^"
          + capitalize((string)GetDefiniteShort()) +
          " returns to its normal state.");
    }
}

int eventBless(int amount, int time){
    if(!amount || !time) return 0;
    if(GetProperty("blessed")) return 0;
    SetProperty("blessed", amount);
    call_out( (: eventRemoveBlessing :), time);
    if(GetProperty("blessed") > 0){
        SetProperty("magic item", "blessed");
    }
    if(GetProperty("blessed") < 0){
        SetProperty("magic item", "cursed");
    }
    return 1;
}

mixed eventThrow(object who, object target){
    if( target && living(target) ){
        int skill;

        who->eventPrint("You throw " + GetShort() + " at " +
          target->GetName() + ".");
        target->eventPrint(who->GetName() + " throws " + GetShort() +" at you.");
        environment(who)->eventPrint(who->GetName() + " throws " +
          GetShort() + " at " + target->GetName() +
          ".", ({ who, target }) );
        skill = (who->GetSkillLevel("projectile attack") +
          who->GetStatLevel("coordination"));
        skill -= (target->GetSkillLevel("projectile defense") +
          target->GetStatLevel("agility"))/2;
        if( GetWeaponType() != "projectile" ){
            skill = skill/2;
        }
        if( skill > random(100) + 1 ){
            who->AddSkillPoints("projectile attack",
              target->GetSkillLevel("projectile defense") *
              target->GetLevel() + 10);
            target->AddSkillPoints("projectile defense", 10);
            target->eventReceiveThrow(who, this_object());
        }
        else {
            target->AddSkillPoints("projectile defense",
              who->GetSkillLevel("projectile attack") *
              who->GetLevel() + 10);
            who->AddSkillPoints("projectile attack", 10);
            environment(who)->eventPrint(capitalize(GetShort()) + " does not "
              "hit "+target->GetName() + ".",({ target, who }));
            write("Your throw misses its mark.");
            tell_object(target, capitalize(GetShort()) + " does not hit you.");
            eventMove(environment(who));
        }
        return 1;
    }
    else if( target ){
        who->eventPrint("You throw " + GetShort() + " at " +
          target->GetShort() + ".");
        environment(who)->eventPrint(who->GetName() + " throws " +
          GetShort() + " at " + target->GetShort() +
          ".", ({ who, target }));	
        tell_object(target, capitalize(GetShort()) + " throws " +
          GetShort() + " at you.");
        return target->eventReceiveThrow(who, this_object());
    }
    if( !eventMove(environment(who)) ){
        who->eventPrint("You are not too good at throwing things.");
        return 1;
    }
    who->eventPrint("You throw " + GetShort() + ".");
    environment(who)->eventPrint(who->GetName() + " throws " +
      GetShort() + ".", who);
    return 1;
}

varargs mixed eventRepair(object who, int strength, int type){
    if( !who || !strength ) return 0;
    if( !GetMaxClass() ) return 0;
    while(strength--){
        if( GetClass() < GetMaxClass() ){
            SetClass(GetClass() + 1);
            SetValue(GetValue() + (GetValue() / 3));
        }
        else break;
    }
    return 1;
}

mixed eventShow(object who, string component){
    mixed tmp = object::eventShow(who, component);

    if( component || tmp != 1 ){
        return tmp;
    }
    if( GetPoison() ){
        if( random(100) < who->GetSkillLevel("stealth") ){
            who->eventPrint("You notice a strange substance on it.");
        }
    }
    return 1;
}

/* ***************** item.c driver applies ****************** */
static void create(){
    AddSave(weapon::GetSave() + value::GetSave() + mass::GetSave() +
      deterioration::GetSave());
    steal::create();
    object::create();
}

varargs mixed direct_get_obj_from_obj(object item, mixed gamma,mixed alfa, mixed beta, mixed epsilon){
    if(answers_to(beta,environment(this_object()))) return 1;
    return 0;
}

mixed direct_cast_str_on_obj(){
    return 1;
}

mixed direct_cast_str_on_str_of_obj(){
    return 1;
}

mixed direct_balance_obj_to_obj(){
    return 1;
}

mixed indirect_balance_obj_to_obj(){
    return 1;
}

mixed direct_compare_obj_to_obj(){
    return 1;
}

mixed indirect_compare_obj_to_obj(){
    return 1;
}

mixed direct_judge_obj_to_obj(){
    return 1;
}

mixed indirect_judge_obj_to_obj(){
    return 1;
}

mixed direct_use_obj_to_str(){
    if( environment() != this_player() )
        return "#You need better access to it.";
    else return 1;
}

mixed direct_use_obj(){
    return direct_use_obj_to_str();
}

mixed direct_throw_obj_word_obj(){
    if( environment() != this_player() ){
        return "#Throw something you are not holding?";
    }
    else return 1;
}

mixed indirect_throw_obj_into_obj(){
    return 1;
}

int direct_sacrifice_obj_to_str(string deus){
    mixed tmp;
    object env;

    if( !sizeof(deus) ) return 0;
    deus = lower_case(remove_article(deus));
    if( !env = environment(this_player()) ) return 0;
    tmp = (mixed)env->CanSacrifice(this_player(), this_object(), deus);
    if( !tmp ){
        this_player()->eventPrint("This is not the place for sacrifices.");
        return 0;
    }
    else return 1;
}


mixed direct_bless_obj(){
    if( environment() != this_player() ){
        return "#You don't have that!";
    }
    return 1;
}

mixed direct_curse_obj(){
    if( environment() != this_player() ){
        return "#You don't have that!";
    }
    return 1;
}

void init(){ }