dsI/bin/
dsI/extra/creremote/
dsI/extra/mingw/
dsI/extra/wolfpaw/
dsI/fluffos-2.7-ds2.018/
dsI/fluffos-2.7-ds2.018/ChangeLog.old/
dsI/fluffos-2.7-ds2.018/Win32/
dsI/fluffos-2.7-ds2.018/compat/
dsI/fluffos-2.7-ds2.018/compat/simuls/
dsI/fluffos-2.7-ds2.018/testsuite/
dsI/fluffos-2.7-ds2.018/testsuite/clone/
dsI/fluffos-2.7-ds2.018/testsuite/command/
dsI/fluffos-2.7-ds2.018/testsuite/data/
dsI/fluffos-2.7-ds2.018/testsuite/etc/
dsI/fluffos-2.7-ds2.018/testsuite/include/
dsI/fluffos-2.7-ds2.018/testsuite/inherit/
dsI/fluffos-2.7-ds2.018/testsuite/inherit/master/
dsI/fluffos-2.7-ds2.018/testsuite/log/
dsI/fluffos-2.7-ds2.018/testsuite/single/
dsI/fluffos-2.7-ds2.018/testsuite/single/tests/compiler/
dsI/fluffos-2.7-ds2.018/testsuite/single/tests/efuns/
dsI/fluffos-2.7-ds2.018/testsuite/single/tests/operators/
dsI/fluffos-2.7-ds2.018/testsuite/u/
dsI/fluffos-2.7-ds2.018/tmp/
dsI/lib/cfg/
dsI/lib/cmds/common/
dsI/lib/cmds/creators/include/
dsI/lib/cmds/creators/include/SCCS/
dsI/lib/daemon/services/
dsI/lib/doc/
dsI/lib/domains/Ylsrim/
dsI/lib/domains/Ylsrim/adm/
dsI/lib/domains/Ylsrim/armour/
dsI/lib/domains/Ylsrim/broken/
dsI/lib/domains/Ylsrim/fish/
dsI/lib/domains/Ylsrim/meal/
dsI/lib/domains/Ylsrim/npc/
dsI/lib/domains/Ylsrim/virtual/
dsI/lib/domains/Ylsrim/weapon/
dsI/lib/domains/default/creator/
dsI/lib/domains/default/etc/
dsI/lib/domains/default/room/
dsI/lib/lib/comp/
dsI/lib/lib/lvs/
dsI/lib/lib/user/
dsI/lib/lib/virtual/
dsI/lib/obj/
dsI/lib/obj/include/
dsI/lib/realms/
dsI/lib/save/kills/a/
dsI/lib/save/kills/b/
dsI/lib/save/kills/f/
dsI/lib/save/kills/m/
dsI/lib/save/kills/q/
dsI/lib/save/kills/r/
dsI/lib/secure/cfg/
dsI/lib/secure/cfg/classes/
dsI/lib/secure/cfg/races/SCCS/
dsI/lib/secure/cmds/creators/include/
dsI/lib/secure/cmds/players/
dsI/lib/secure/cmds/players/include/
dsI/lib/secure/daemon/include/
dsI/lib/secure/lib/
dsI/lib/secure/lib/include/
dsI/lib/secure/lib/net/
dsI/lib/secure/lib/net/include/
dsI/lib/secure/lib/std/
dsI/lib/secure/obj/
dsI/lib/secure/obj/include/
dsI/lib/secure/save/
dsI/lib/spells/
dsI/lib/verbs/admins/include/
dsI/lib/verbs/common/
dsI/lib/verbs/common/include/
dsI/lib/verbs/creators/
dsI/lib/verbs/creators/include/
dsI/lib/verbs/players/include/SCCS/
dsI/lib/verbs/rooms/
dsI/lib/verbs/rooms/include/
dsI/lib/www/
dsI/v22.2b14/
dsI/win32/
/*    /lib/chapel.c
 *    from the Dead Souls  Object Library
 *    allows people to marry
 *    created by Descartes of Borg 951210
 *    Version: @(#) chapel.c 1.2@(#)
 *    Last modified: 96/10/09
 */

#include <lib.h>
#include "include/chapel.h"

inherit LIB_ROOM;

private int AllowSacrifice, SacrificeType;
private string array Classes, Religion, Deities, DeityIds;

/*     **********  /lib/chapel.c apply methods  **********     */
static void create() {
    room::create();
    Classes = ({});
    Religion = allocate(2);
    Deities = ({});
    DeityIds = ({});
    AllowSacrifice = 0;
    SacrificeType = 0;
}

/*     **********  /lib/chapel.c modal methods  **********     */
mixed CanMarry(object who, object spouse1, object spouse2) {
    mixed tmp;
    string cls;

    if( (tmp = spouse1->CanMarry(who, spouse2)) != 1 ) {
	if( tmp ) return tmp;
	else return (string)spouse1->GetName() + " cannot be married.";
    }
    if( (tmp = spouse2->CanMarry(who, spouse1)) != 1 ) {
	if( tmp ) return tmp;
	else return (string)spouse2->GetName() + " cannot be married.";
    }
    if( archp(who) ) {
	return 1;
    }
    if( (string)who->GetReligion(1) == Religion[1] ) {
	foreach(cls in Classes)
	  if( (int)who->ClassMember(cls) ) return 1;
    }
    return "You are not allowed to perform marriages here.";
}

mixed CanSacrifice(object who, object what, string deus) {
    if( (string)who->GetReligion(1) != Religion[1] )
      return "You must hold the beliefs of " + Religion[1] + " to do that.";
    if( !((int)what->GetVendorType() & SacrificeType) )
      return "You cannot sacrifice that here.";
    if( member_array(deus, DeityIds) == -1 )
      return "You do not worship anything called \"" + deus + "\".";
    return AllowSacrifice;
}

mixed eventMarry(object who, object spouse1, object spouse2) {
    mixed tmp;

    if( (tmp = spouse1->eventMarry(who, spouse2)) != 1 ) return tmp;
    if( (tmp = spouse2->eventMarry(who, spouse1)) != 1 ) {
	spouse1->SetMarried(0);
	return tmp;
    }
   spouse1->eventPrint((string)who->GetName() + " weds you to " +
		       (string)spouse2->GetName() + ".");
   spouse2->eventPrint((string)who->GetName() + " weds you to " +
		       (string)spouse1->GetName() + ".");
   who->eventPrint("You join " + (string)spouse1->GetName() + " to " +
		   (string)spouse2->GetName() + " in marriage.");
   this_object()->eventPrint((string)who->GetName() + " joins " +
			     (string)spouse1->GetName() + " and " +
			     (string)spouse2->GetName() + ".",
			     ({ spouse1, spouse2, who }));
   who->AddSkillPoints("faith", random(100));
   return 1;
}

mixed eventSacrifice(object who, object what, string deus) {
    who->eventPrint("You attempt to make a sacrifice, but nothing happens.");
    return 1;
}

/*     **********  /lib/chapel.c event methods  **********     */
int SetAllowSacrifice(int x) { return (AllowSacrifice = x); }

int GetAllowSacrifice() { return AllowSacrifice; }

string *SetClasses(string *rc) { return (Classes = rc); }

string *GetClasses() { return Classes; }

string *SetDeities(string *deities) {
    string *ids = ({});
    
    Deities = deities;
    foreach(string deus in deities)
      ids += explode(lower_case(deus), " ");
    DeityIds = ids;
    return Deities;
}

string *GetDeities() { return Deities; }

string *SetReligion(string adj, string noun) {
    Religion[0] = adj;
    Religion[1] = noun;
    return Religion;
}

varargs string GetReligion(int flag) { return Religion[flag]; }

int SetSacrificeType(int x) { return (SacrificeType = x); }

int AddSacrificeType(int x) { return (SacrificeType |= x); }

int GetSacrificeType() { return SacrificeType; }