final_realms_fluffos_v1/
final_realms_fluffos_v1/bin/
final_realms_fluffos_v1/fluffos-2.9-ds2.11/
final_realms_fluffos_v1/fluffos-2.9-ds2.11/ChangeLog.old/
final_realms_fluffos_v1/fluffos-2.9-ds2.11/Win32/
final_realms_fluffos_v1/fluffos-2.9-ds2.11/compat/
final_realms_fluffos_v1/fluffos-2.9-ds2.11/compat/simuls/
final_realms_fluffos_v1/fluffos-2.9-ds2.11/include/
final_realms_fluffos_v1/fluffos-2.9-ds2.11/testsuite/
final_realms_fluffos_v1/fluffos-2.9-ds2.11/testsuite/clone/
final_realms_fluffos_v1/fluffos-2.9-ds2.11/testsuite/command/
final_realms_fluffos_v1/fluffos-2.9-ds2.11/testsuite/data/
final_realms_fluffos_v1/fluffos-2.9-ds2.11/testsuite/etc/
final_realms_fluffos_v1/fluffos-2.9-ds2.11/testsuite/include/
final_realms_fluffos_v1/fluffos-2.9-ds2.11/testsuite/inherit/
final_realms_fluffos_v1/fluffos-2.9-ds2.11/testsuite/inherit/master/
final_realms_fluffos_v1/fluffos-2.9-ds2.11/testsuite/log/
final_realms_fluffos_v1/fluffos-2.9-ds2.11/testsuite/single/
final_realms_fluffos_v1/fluffos-2.9-ds2.11/testsuite/single/tests/compiler/
final_realms_fluffos_v1/fluffos-2.9-ds2.11/testsuite/single/tests/efuns/
final_realms_fluffos_v1/fluffos-2.9-ds2.11/testsuite/single/tests/operators/
final_realms_fluffos_v1/fluffos-2.9-ds2.11/testsuite/u/
final_realms_fluffos_v1/fluffos-2.9-ds2.11/tmp/
final_realms_fluffos_v1/fluffos-2.9-ds2.11/windows/
final_realms_fluffos_v1/lib/baseobs/guilds/
final_realms_fluffos_v1/lib/baseobs/misc/
final_realms_fluffos_v1/lib/baseobs/races/shadows/
final_realms_fluffos_v1/lib/cmds/god/
final_realms_fluffos_v1/lib/cmds/handlers/
final_realms_fluffos_v1/lib/cmds/handlers/cmds/
final_realms_fluffos_v1/lib/d/heaven/
final_realms_fluffos_v1/lib/d/heaven/heaven/ave/
final_realms_fluffos_v1/lib/d/mudlib/
final_realms_fluffos_v1/lib/d/newbie/
final_realms_fluffos_v1/lib/d/newbie/docs/
final_realms_fluffos_v1/lib/d/newbie/drow/armour/
final_realms_fluffos_v1/lib/d/newbie/drow/items/
final_realms_fluffos_v1/lib/d/newbie/drow/mobs/
final_realms_fluffos_v1/lib/d/newbie/drow/oldmobs/
final_realms_fluffos_v1/lib/d/newbie/drow/weapons/
final_realms_fluffos_v1/lib/d/newbie/duergar/weapons/
final_realms_fluffos_v1/lib/d/newbie/dwarf/weapons/
final_realms_fluffos_v1/lib/d/newbie/elf/cafe/
final_realms_fluffos_v1/lib/d/newbie/elf/chars/equip/
final_realms_fluffos_v1/lib/d/newbie/elf/items/armours/
final_realms_fluffos_v1/lib/d/newbie/elf/items/obj/
final_realms_fluffos_v1/lib/d/newbie/elf/items/weapons/
final_realms_fluffos_v1/lib/d/newbie/elf/quick_fix/
final_realms_fluffos_v1/lib/d/newbie/gnome/armour/
final_realms_fluffos_v1/lib/d/newbie/gnome/buildings/
final_realms_fluffos_v1/lib/d/newbie/gnome/items/
final_realms_fluffos_v1/lib/d/newbie/gnome/npcs/clones/
final_realms_fluffos_v1/lib/d/newbie/gnome/rooms/northrooms/
final_realms_fluffos_v1/lib/d/newbie/gnome/weapons/
final_realms_fluffos_v1/lib/d/newbie/goblin/armour/
final_realms_fluffos_v1/lib/d/newbie/goblin/items/
final_realms_fluffos_v1/lib/d/newbie/grads/log/
final_realms_fluffos_v1/lib/d/newbie/grads/npcs/
final_realms_fluffos_v1/lib/d/newbie/grads/rooms/
final_realms_fluffos_v1/lib/d/newbie/grads/rooms/cave1/
final_realms_fluffos_v1/lib/d/newbie/grads/temp/
final_realms_fluffos_v1/lib/d/newbie/guests/weapons/
final_realms_fluffos_v1/lib/d/newbie/half-elf/items/
final_realms_fluffos_v1/lib/d/newbie/half-elf/newroomss/
final_realms_fluffos_v1/lib/d/newbie/half-elf/rooms/
final_realms_fluffos_v1/lib/d/newbie/half-elf/rooms/castle/
final_realms_fluffos_v1/lib/d/newbie/half-elf/rooms/drows/
final_realms_fluffos_v1/lib/d/newbie/half-elf/rooms/savannah/
final_realms_fluffos_v1/lib/d/newbie/half-elf/rooms/secret/
final_realms_fluffos_v1/lib/d/newbie/half-elf/rooms/town/
final_realms_fluffos_v1/lib/d/newbie/halfling/
final_realms_fluffos_v1/lib/d/newbie/halfling/misc/
final_realms_fluffos_v1/lib/d/newbie/halfling/rooms/cave/
final_realms_fluffos_v1/lib/d/newbie/human/
final_realms_fluffos_v1/lib/d/newbie/human/armour/
final_realms_fluffos_v1/lib/d/newbie/human/monsters/
final_realms_fluffos_v1/lib/d/newbie/human/obj/
final_realms_fluffos_v1/lib/d/newbie/human/weapons/
final_realms_fluffos_v1/lib/d/newbie/lizard/armour/
final_realms_fluffos_v1/lib/d/newbie/lizard/items/
final_realms_fluffos_v1/lib/d/newbie/lizard/underwater/
final_realms_fluffos_v1/lib/d/newbie/lizard/weapons/
final_realms_fluffos_v1/lib/d/newbie/logs/
final_realms_fluffos_v1/lib/d/newbie/new_halfelf/
final_realms_fluffos_v1/lib/d/newbie/new_halfelf/npcs/
final_realms_fluffos_v1/lib/d/newbie/newdrow/npcs/
final_realms_fluffos_v1/lib/d/newbie/newdrow/rooms/
final_realms_fluffos_v1/lib/d/newbie/newelf/
final_realms_fluffos_v1/lib/d/newbie/newelf/chars/
final_realms_fluffos_v1/lib/d/newbie/newelf/npcs/
final_realms_fluffos_v1/lib/d/newbie/newelf/npcs/recopied/
final_realms_fluffos_v1/lib/d/newbie/newelf/obj/
final_realms_fluffos_v1/lib/d/newbie/newelf/quest_docs./
final_realms_fluffos_v1/lib/d/newbie/newken/
final_realms_fluffos_v1/lib/d/newbie/newken/chars/
final_realms_fluffos_v1/lib/d/newbie/newken/misc/
final_realms_fluffos_v1/lib/d/newbie/newken/npcs/
final_realms_fluffos_v1/lib/d/newbie/newken/obj/
final_realms_fluffos_v1/lib/d/newbie/newliz/
final_realms_fluffos_v1/lib/d/newbie/newliz/cave/
final_realms_fluffos_v1/lib/d/newbie/newliz/npcs/
final_realms_fluffos_v1/lib/d/newbie/orc/items/misc/
final_realms_fluffos_v1/lib/d/newbie/orc/items/weapons/
final_realms_fluffos_v1/lib/d/newbie/orc/tower/
final_realms_fluffos_v1/lib/d/vehicle/
final_realms_fluffos_v1/lib/doc/
final_realms_fluffos_v1/lib/doc/driver/
final_realms_fluffos_v1/lib/doc/driver/concepts/
final_realms_fluffos_v1/lib/doc/driver/driver/
final_realms_fluffos_v1/lib/doc/driver/efuns/arrays/
final_realms_fluffos_v1/lib/doc/driver/efuns/bitstrings/
final_realms_fluffos_v1/lib/doc/driver/efuns/communication/
final_realms_fluffos_v1/lib/doc/driver/efuns/core/
final_realms_fluffos_v1/lib/doc/driver/efuns/debugging/
final_realms_fluffos_v1/lib/doc/driver/efuns/filesystem/
final_realms_fluffos_v1/lib/doc/driver/efuns/interactive/
final_realms_fluffos_v1/lib/doc/driver/efuns/mappings/
final_realms_fluffos_v1/lib/doc/driver/efuns/objects/
final_realms_fluffos_v1/lib/doc/driver/efuns/security/
final_realms_fluffos_v1/lib/doc/driver/efuns/strings/
final_realms_fluffos_v1/lib/doc/driver/efuns/system/
final_realms_fluffos_v1/lib/doc/driver/efuns/types/
final_realms_fluffos_v1/lib/doc/driver/lpc/constructs/
final_realms_fluffos_v1/lib/doc/driver/lpc/types/
final_realms_fluffos_v1/lib/doc/driver/platforms/
final_realms_fluffos_v1/lib/doc/lpc/
final_realms_fluffos_v1/lib/doc/mail/
final_realms_fluffos_v1/lib/doc/man/
final_realms_fluffos_v1/lib/doc/man/html/
final_realms_fluffos_v1/lib/doc/man/html/applies/
final_realms_fluffos_v1/lib/doc/man/html/applies/parsing/
final_realms_fluffos_v1/lib/doc/man/html/driver/
final_realms_fluffos_v1/lib/doc/man/html/efuns/
final_realms_fluffos_v1/lib/doc/man/html/efuns/arrays/
final_realms_fluffos_v1/lib/doc/man/html/efuns/buffers/
final_realms_fluffos_v1/lib/doc/man/html/efuns/compile/
final_realms_fluffos_v1/lib/doc/man/html/efuns/floats/
final_realms_fluffos_v1/lib/doc/man/html/efuns/functions/
final_realms_fluffos_v1/lib/doc/man/html/efuns/general/
final_realms_fluffos_v1/lib/doc/man/html/efuns/numbers/
final_realms_fluffos_v1/lib/doc/man/html/efuns/parsing/
final_realms_fluffos_v1/lib/doc/man/local/
final_realms_fluffos_v1/lib/doc/man/local/applies/
final_realms_fluffos_v1/lib/doc/man/local/applies/interactive/
final_realms_fluffos_v1/lib/doc/man/local/applies/master/
final_realms_fluffos_v1/lib/doc/man/local/concepts/
final_realms_fluffos_v1/lib/doc/man/local/defines/
final_realms_fluffos_v1/lib/doc/man/local/driver/
final_realms_fluffos_v1/lib/doc/man/local/efuns/
final_realms_fluffos_v1/lib/doc/man/local/efuns/arrays/
final_realms_fluffos_v1/lib/doc/man/local/efuns/buffers/
final_realms_fluffos_v1/lib/doc/man/local/efuns/calls/
final_realms_fluffos_v1/lib/doc/man/local/efuns/compile/
final_realms_fluffos_v1/lib/doc/man/local/efuns/filesystem/
final_realms_fluffos_v1/lib/doc/man/local/efuns/floats/
final_realms_fluffos_v1/lib/doc/man/local/efuns/functions/
final_realms_fluffos_v1/lib/doc/man/local/efuns/general/
final_realms_fluffos_v1/lib/doc/man/local/efuns/interactive/
final_realms_fluffos_v1/lib/doc/man/local/efuns/internals/
final_realms_fluffos_v1/lib/doc/man/local/efuns/mappings/
final_realms_fluffos_v1/lib/doc/man/local/efuns/mudlib/
final_realms_fluffos_v1/lib/doc/man/local/efuns/numbers/
final_realms_fluffos_v1/lib/doc/man/local/efuns/objects/
final_realms_fluffos_v1/lib/doc/man/local/efuns/parsing/
final_realms_fluffos_v1/lib/doc/man/local/efuns/sockets/
final_realms_fluffos_v1/lib/doc/man/local/efuns/strings/
final_realms_fluffos_v1/lib/doc/man/local/efuns/system/
final_realms_fluffos_v1/lib/doc/man/local/historical/
final_realms_fluffos_v1/lib/doc/man/local/lfun/QC/
final_realms_fluffos_v1/lib/doc/man/local/lfun/events/
final_realms_fluffos_v1/lib/doc/man/local/lfun/monster/
final_realms_fluffos_v1/lib/doc/man/local/lfun/properties/
final_realms_fluffos_v1/lib/doc/man/local/lpc/
final_realms_fluffos_v1/lib/doc/man/local/lpc/constructs/
final_realms_fluffos_v1/lib/doc/man/local/lpc/types/
final_realms_fluffos_v1/lib/doc/man/local/standards/
final_realms_fluffos_v1/lib/doc/man/local/tutorials/
final_realms_fluffos_v1/lib/doc/man/local/tutorials/basic/
final_realms_fluffos_v1/lib/doc/man/local/tutorials/intermediate/
final_realms_fluffos_v1/lib/doc/man/mudos/applies/
final_realms_fluffos_v1/lib/doc/man/mudos/applies/interactive/
final_realms_fluffos_v1/lib/doc/man/mudos/applies/parsing/
final_realms_fluffos_v1/lib/doc/man/mudos/concepts/
final_realms_fluffos_v1/lib/doc/man/mudos/driver/
final_realms_fluffos_v1/lib/doc/man/mudos/efuns/arrays/
final_realms_fluffos_v1/lib/doc/man/mudos/efuns/buffers/
final_realms_fluffos_v1/lib/doc/man/mudos/efuns/calls/
final_realms_fluffos_v1/lib/doc/man/mudos/efuns/compile/
final_realms_fluffos_v1/lib/doc/man/mudos/efuns/filesystem/
final_realms_fluffos_v1/lib/doc/man/mudos/efuns/floats/
final_realms_fluffos_v1/lib/doc/man/mudos/efuns/functions/
final_realms_fluffos_v1/lib/doc/man/mudos/efuns/general/
final_realms_fluffos_v1/lib/doc/man/mudos/efuns/mappings/
final_realms_fluffos_v1/lib/doc/man/mudos/efuns/mixed/
final_realms_fluffos_v1/lib/doc/man/mudos/efuns/mudlib/
final_realms_fluffos_v1/lib/doc/man/mudos/efuns/numbers/
final_realms_fluffos_v1/lib/doc/man/mudos/efuns/parsing/
final_realms_fluffos_v1/lib/doc/man/mudos/lpc/constructs/
final_realms_fluffos_v1/lib/doc/man/mudos/lpc/types/
final_realms_fluffos_v1/lib/doc/races/
final_realms_fluffos_v1/lib/doc/races/old_race/
final_realms_fluffos_v1/lib/global/virtual/
final_realms_fluffos_v1/lib/global/wiz_backup/
final_realms_fluffos_v1/lib/net/config/
final_realms_fluffos_v1/lib/net/daemon/chars/
final_realms_fluffos_v1/lib/net/inherit/
final_realms_fluffos_v1/lib/net/intermud3/
final_realms_fluffos_v1/lib/net/intermud3/cmds/
final_realms_fluffos_v1/lib/net/intermud3/save/
final_realms_fluffos_v1/lib/net/intermud3/services/
final_realms_fluffos_v1/lib/net/obj/
final_realms_fluffos_v1/lib/net/old/
final_realms_fluffos_v1/lib/net/old/intermud/
final_realms_fluffos_v1/lib/net/old/intermud/adm/
final_realms_fluffos_v1/lib/net/old/intermud/services/
final_realms_fluffos_v1/lib/net/old/intermud/udp/
final_realms_fluffos_v1/lib/net/virtual/
final_realms_fluffos_v1/lib/obj/b_day/
final_realms_fluffos_v1/lib/obj/chars/
final_realms_fluffos_v1/lib/obj/handlers/lists/
final_realms_fluffos_v1/lib/obj/handlers/useless/
final_realms_fluffos_v1/lib/obj/monsters/
final_realms_fluffos_v1/lib/obj/roomgen/
final_realms_fluffos_v1/lib/obj/soul/
final_realms_fluffos_v1/lib/obj/vegetation/
final_realms_fluffos_v1/lib/obj/weapons/oldsys/
final_realms_fluffos_v1/lib/open/
final_realms_fluffos_v1/lib/players/g/
final_realms_fluffos_v1/lib/releasefiles/d/heaven/
final_realms_fluffos_v1/lib/releasefiles/d/mudlib/
final_realms_fluffos_v1/lib/releasefiles/d/newbie/
final_realms_fluffos_v1/lib/releasefiles/doc/
final_realms_fluffos_v1/lib/releasefiles/players/g/
final_realms_fluffos_v1/lib/releasefiles/save/
final_realms_fluffos_v1/lib/releasefiles/save/environ/
final_realms_fluffos_v1/lib/releasefiles/save/roomgen/
final_realms_fluffos_v1/lib/releasefiles/secure/
final_realms_fluffos_v1/lib/releasefiles/w/
final_realms_fluffos_v1/lib/releasefiles/w/god/
final_realms_fluffos_v1/lib/room/
final_realms_fluffos_v1/lib/save/
final_realms_fluffos_v1/lib/save/environ/
final_realms_fluffos_v1/lib/save/roomgen/
final_realms_fluffos_v1/lib/scripts/
final_realms_fluffos_v1/lib/secure/crerem/
final_realms_fluffos_v1/lib/secure/dom/
final_realms_fluffos_v1/lib/secure/log/
final_realms_fluffos_v1/lib/secure/misc/
final_realms_fluffos_v1/lib/std/adnd/
final_realms_fluffos_v1/lib/std/commands/shadows/
final_realms_fluffos_v1/lib/std/creator/
final_realms_fluffos_v1/lib/std/curses/
final_realms_fluffos_v1/lib/std/curses/old_sys/
final_realms_fluffos_v1/lib/std/curses/shadows/
final_realms_fluffos_v1/lib/std/dom/
final_realms_fluffos_v1/lib/std/effects/
final_realms_fluffos_v1/lib/std/effects/healing/
final_realms_fluffos_v1/lib/std/effects/other/
final_realms_fluffos_v1/lib/std/effects/poisons/
final_realms_fluffos_v1/lib/std/environ/
final_realms_fluffos_v1/lib/std/guilds/
final_realms_fluffos_v1/lib/std/guilds/priests/samples/
final_realms_fluffos_v1/lib/std/guilds/wizards/
final_realms_fluffos_v1/lib/std/living/baldy/
final_realms_fluffos_v1/lib/std/living/divstuff/
final_realms_fluffos_v1/lib/std/paran/
final_realms_fluffos_v1/lib/std/poisons/
final_realms_fluffos_v1/lib/std/poisons/shadows/
final_realms_fluffos_v1/lib/std/poisons/weapons/
final_realms_fluffos_v1/lib/std/race_groups/
final_realms_fluffos_v1/lib/std/room/
final_realms_fluffos_v1/lib/std/room/old/
final_realms_fluffos_v1/lib/std/rooms/
final_realms_fluffos_v1/lib/std/shadows/
final_realms_fluffos_v1/lib/std/shadows/test_shad/
final_realms_fluffos_v1/lib/std/socket/
final_realms_fluffos_v1/lib/std/spells/
final_realms_fluffos_v1/lib/std/vaults/
final_realms_fluffos_v1/lib/tmp/
final_realms_fluffos_v1/lib/w/
final_realms_fluffos_v1/lib/w/god/
final_realms_fluffos_v1/old/
final_realms_fluffos_v1/win32/
/* do we use this one ? */
/* it's just a version of guild.c */


inherit "/std/room";

#include "skills.h"
#include "tune.h"
#include "money.h"

string our_guild,
       guild_path,
       *spec;
mixed *spells,
      *memspells,
      *commands;
object teaching_person;

void check_spells_commands(string *sk, int lvl);
int query_specialization(string name);

void create() {
  spells = ({ });
  spec = ({ });
  memspells = ({ });
  commands = ({ });
  ::create();
} /* create() */

void init() {
  ::init();
  add_action("do_advance", "advance");
  add_action("do_join", "join");
  add_action("do_info", "info");
  add_action("do_cost", "cost");
  add_action("do_specialize", "specialize");
} /* init() */

void set_guild(string str) { our_guild = "/std/guilds/"+str; } 

int do_advance() 
{
  string skill;
  string *bits;
  int cost, i, xp, lvl, total_xp, p_val;
  string guild;

  lvl = (int)this_player()->query_level();
  guild=this_player()->query_guild_ob();

  if (!guild)             /* Have we joined any guild at all ? */
  {
    notify_fail("If you 'join' you can advance here.\n");
    return 0;
  }

/***** Remember to add path for specializing!!!! *******/
  /* If so, is it this_guild ? */
  if (guild != our_guild && !query_specialization(guild))
  {
    write(guild+" = guild  AND "+our_guild+" = our_guild.\n");
    notify_fail("You cannot advance here! Go to your own guild.\n");
    return 0;
  }

/* The following bit is removed awaiting code from Dan.  He'll produce code
 * to compute the actual computing of raising in skill-levels.  I've declared
 * string *bits; for dividing up the skill-bits, but can do no more since I
 * honestly don't know how it'll work.
 * 7.1.93: Put back so that we can test other things while waiting.  
 */
  xp = (int)this_player()->query_xp_cost();  /* How much xp/lvl it will cost */
  if((int)this_player()->query_xp() < xp*(lvl+1)) 
  {
      notify_fail("Your lack of experience prevents you from advancing.\n");
      return 0;
  }

/* Checks for racial max levels not yet implemented   *************
  max_lvl = (int)my_race_ob->query_max_level(guild);
  if (lvl == max_lvl) 
  {
    notify_fail("You can advance higher than "+lvl+" because you're a "+
                 my_race+".\n");
    return 0;
  }
*/

/*  Monetary payment to advance in level   */
  cost = (int)our_guild->query_advance_cost();
    /* Default cost if not defined.  Thought 500 GP/level was OK  */
  cost *= lvl;           /* Total monetary cost of advancing */
 
  p_val = (int)this_player()->query_value(); /* How much money do we have */

  if (cost > p_val)  /* What happens if we can't pay */ 
  {
     notify_fail("Due to your sad lack of money the guild refuses to train "
                 "you.  It would have cost you "+
                 MONEY_HAND->money_value_string(cost)+".\n");
     return 0;
  }
  this_player()->pay_money(MONEY_HAND->create_money_array(cost));
  this_player()->set_level(++lvl);
  this_player()->reset_all();
/*  event(this_object(), "guild_advance", bits, lvl, lvl+1); */
  this_player()->reset_all();
  write("You advance to level "+lvl+" for "+ 
        MONEY_HAND->money_value_string(cost)+".\n");
  say(this_player()->query_cap_name()+" advances "+
      this_player()->query_possessive()+" level.\n");
  return 1;
} /* do_advance() */

/*  Some of the code I planned to use for proficiencies.  Just left some of 
 * it here in case it's of any use to Dank
 */  
int train(string str) 
{
  string skill_name, sk, guild;
  int cost, lvl;

  if (!(skill_name = (string)SKILL_OB->query_skill(sk))) 
  {
    notify_fail("I am sorry but the " + sk + " skill does not exist.\n");
    return 0;
  }
  if ((guild=(string)this_player()->query_guild_ob()) != our_guild && guild) 
  {
    notify_fail("You cannot train here! Go to your own guild.\n");
    return 0;
  }
  if(!str) 
  {
    notify_fail("Syntax: train <skill>.\n");
    return 0;
  }
  if(!guild)
    cost = DEFAULT_COST; /* Cheaper training in skill for members. */
  else
    cost = (int)our_guild->query_skill_cost(skill_name);
  cost *= (int)SKILL_OB->query_skill_cost(skill_name);
} /* Will be used for proficiencies */

int do_join(string str) 
{
  string guild;
  string race;
  guild = (string)this_player()->query_guild_ob();
  race  = (string)this_player()->query_race();

  if(guild == our_guild) 
  {
    notify_fail("You're already in this guild.\n");
    return 0;
  }

  if(guild) 
  {
    notify_fail("You cannot join a guild while a member of another.\n");
    return 0;
  }

  if(!our_guild->query_legal_race(race))
  {
    notify_fail("Sorry, but a "+race+" can't become a "+
     our_guild->query_name()+".\n");
    return 0;
  }

  write("You will only ever get to join one guild.  Are you sure? ");
  input_to("join2");
  return 1;
} /* do_join() */

/*  Not quite finished converting this.  Waiting for Dank's skills system */
int join2(string str) {
  mixed skills;
  int i;

  str = lower_case(str);
  if (str[0] != 'n' && str[0] != 'y') {
    write("I do not understand.  Yes or no? ");
    input_to("join2");
    return 1;
  }
  if (str[0] == 'n') {
    write("Ok, not joining the "+ our_guild->query_name()+" guild.\n");
    return 1;
  }
  this_player()->set_guild_ob(our_guild);
  this_player()->race_guild_commands();
write("You are now a member of the "+our_guild->query_cap_name()+"'s guild.\n");
  say(this_player()->query_cap_name()+" joins the "+our_guild->query_name()+
          " guild.\n");
  event(this_object(), "guild_join");
  event(users(), "inform", this_player()->query_cap_name()+" is now a member "
            "of "+our_guild->query_name(), "join");

  skills = (mixed *)this_player()->query_skills();
  for (i=0;i<sizeof(skills);i+=SKILL_ARR_SIZE) {
/* This will only set up the outer skill-bits (str, dec, con etc.) */
    check_spells_commands(skills[i+SKILL_NAM..i+SKILL_NAM],
                          skills[i+SKILL_LVL]);
  }
  this_player()->set_level(1);
  return 1;
} /* join2() */

/* This is not supposed to be possible until we allow for dual-classes.
 * I moved the leave code here since I felt you should have to be in the 
 * room of your guild when you leave.  It's easily moved back to the guild-
 * object if most of you prefer it that way.  
 */
int do_leave(string str) 
{
  if(str != "guild") {
    notify_fail("Syntax : leave guild\n");
    return 0;
  }
  if ((string)this_player()->query_guild_ob() != our_guild) {
    notify_fail("How can you leave a guild if you aren't in it.\n");
    return 0;
  }
  if ((int)this_player()->query_level() > 5) {
    notify_fail("You are too high a level to leave this guild.\n");
    return 0;
  }
  write("Are you sure you want to leave the guild (Y/N) : ");
  input_to("confirm_leave");
  return 1;
} /* do_leave() */

void confirm_leave(string str) {
  str = lower_case(str);
  if(str != "y") {
    write("You are still in the guild.\n");
    return;
  }
  write("You left your guild.\n");
  call_other(our_guild, "leaving_guild");
  this_player()->set_guild_ob(0);
  this_player()->set_guild_data(0);
  this_player()->guild_commands();
  this_player()->save_me();
} /* confirm_leave() */

/*  Will have to be rewritten a lot if we choose tell players how much xp 
 * they'll need to advance in each skill/subskill
 */
int do_cost() 
{
  string guild, cost;
  int xp_cost, lvl;

  guild = (string)this_player()->query_guild_ob();
  xp_cost = (int)our_guild->query_xp_cost();
  cost = MONEY_HAND->money_value_string((int)our_guild->query_advance_cost());
  lvl = this_player()->query_level();

  if(!guild)
  {
    notify_fail("If you join this guild you will have to earn "+
     xp_cost+" XP, and expect to pay "+cost+" to reach 2nd level.\n");
    return 0;
  }
    
  if (guild != our_guild) 
  {
    notify_fail("You are not a member of this guild.\n");
    return 0;
  }

/* Checks for racial max levels not yet implemented   *************
  max_lvl = (int)my_race_ob->query_max_level(guild);
  if (lvl == max_lvl)
  {
    notify_fail("You can advance higher than "+lvl+" because you're a "+
                 my_race+".\n");
    return 0;
  }
*/

  write("You will need "+xp_cost*lvl+" XP and "+cost+
        " to advance to level "+(lvl+1)+".\n");
  return 1;
} /* do_cost() */

/* The same goes for do_info() as for do_cost() of course */
int do_info() 
{
  write(our_guild->long());
  do_cost();
  return 1;
} /* do_info() */

/*
 * From here on are the changes to make level gaining hopefully more
 * realistic...  (Note the more :)
 */
void add_spell(string name, string *path, int lvl) {
  spells += ({ name, path, lvl });
} /* add_spell() */

void add_command(string name, string *path, int lvl) {
  commands += ({ name, path, lvl });
} /* add_command() */

int query_specialization(string name)
{ 
  if(member_array(name,spec) != -1)
    return 1;
  return 0;
}

void add_specialization(string name) 
{ 
    spec += ({ name });
}  /* add_specialization() */

int do_specialize(string name)
{
  string path;
  if((string)this_player()->query_guild_ob() != our_guild) 
  {
    notify_fail("You can't specialize in this guild since you're not a "
                "member.\n");
    return 0;
  }

  if((int)this_player()->query_level() != 1)
  {
    notify_fail("You can't specialize after you've already advanced in "
                "level.\n");
    return 0;
  }

  if (query_specialization(name))
  {
    path = "/std/race"->query_guild_path(name);
    tell_room(this_player(), this_player()->query_cap_name()+" specialices "
      "and becomes a "+name+".\n", this_player());
    write("You're accepted as a "+name+" specialist.  CONGRATULATIONS!!!\n");
    this_player()->set_guild_ob(path); 
    return 1;
  }
  notify_fail("That's not a valid specialization.\n");
  return 0;
}  /* do_specialize() */

void set_teaching_person(object ob) { teaching_person = ob; }
object query_teaching_person() { return teaching_person; }

void check_spells_commands(string *path, int lvl) {
  int i, j;

  if (!teaching_person || member_array(this_player(), 
      (object *)teaching_person->query_attacker_list()) != -1)
    return ;

  for (i=0;i<sizeof(spells);i+=3)
    for (j=0;j<sizeof(spells[i+1]);j++)
      if (j >= sizeof(path)) {  /* got through the skill path ok */
        if (spells[i+2] <= lvl)
           teaching_person->init_command("teach "+spells[i]+" to "+
                                         this_player()->query_name());
      } else
        if (spells[i+1][j] != path[j])
          break;

  for (i=0;i<sizeof(commands);i+=3)
    for (j=0;j<sizeof(commands[i+1]);j++)
      if (j >= sizeof(path)) {  /* got through the skill path ok */
        if (commands[i+2] <= lvl)
           teaching_person->init_command("teach "+commands[i]+" to "+
                                         this_player()->query_name());
      } else
        if (commands[i+1][j] != path[j])
          break;
} /* check_spell_commands() */

mixed * query_spells() { return spells + ({ }); }
mixed * query_commands() { return commands + ({ }); }

/* This is not pretty, but I added it in case Dank feel like giving the players
 * some info of how much xp it will cost to advance in skills.
 */
string rec_cost_old(mixed *arr, string path, int depth) {
  int i;
  int cost;
  string str, lpath;

  str = "";
  for (i=0;i<sizeof(arr);i+=SKILL_ARR_SIZE) {
    lpath = path + "." + arr[i];
    cost = (int)SKILL_OB->query_skill_cost((lpath)[1..500]);
    cost *= (int)our_guild->query_skill_cost((lpath)[1..500]);
    str += sprintf("%*'| 's%-*'.'s costs %d xp.\n", (depth-1)*2, "",
             20-(depth-1)*2, arr[i],
             cost*STD_COST*(((int)this_player()->query_skill(lpath)
                  /LEVEL_DIV)+1));
    if (this_player()->query_skill(lpath) >= depth*5)
      str += rec_cost_old(arr[i+SKILL_BIT], path+"."+arr[i], depth+1);
  }
  return str;
} /* rec_cost_old() */

string rec_cost(mixed *arr, string path, int depth, string g_o)
{ /* use lots of variables...so we only work things out minimum times */
  int i, depth_gap, ndots;
  int cost, lvl, max_lvl;
  string str, lpath;

  str = "";
  depth_gap = (depth - 1) * 2;
  ndots = 18 - depth_gap;

  for (i=0;i<sizeof(arr);i+=SKILL_ARR_SIZE) {
    if (path != "")
      lpath = path + "." + arr[i];
    else
      lpath = arr[i];
    lvl = (int)this_player()->query_skill(lpath);
    if (!g_o)
      max_lvl = 5;
    else
      max_lvl = (int)g_o->query_skill_max_level(lpath);
    if(lvl >= max_lvl) {
      str += sprintf("%*'| 's%-*'.'s %3d/%3d  mastered\n", depth_gap, "",
                     ndots, arr[i], lvl, max_lvl);
    } else {
      if (!g_o)
        cost = DEFAULT_COST;
      else
        cost = (int)g_o->query_skill_cost(lpath);
      cost *=  (int)SKILL_OB->query_skill_cost(lpath);
      cost *= (STD_COST/5)*((lvl/LEVEL_DIV)+1);
      str += sprintf("%*'| 's%-*'.'s %3d/%3d %6d xp\n", depth_gap, "",
               ndots, arr[i], lvl, max_lvl, cost);
    }
    if (lvl >= depth*5)
      str += rec_cost(arr[i+SKILL_BIT], lpath, depth+1, g_o);
  }
  return str;
} /* rec_cost() */