/
lib/banish/
lib/d/
lib/doc/
lib/doc/domains/
lib/doc/efun/
lib/doc/examples/
lib/doc/examples/armour/
lib/doc/examples/contain/
lib/doc/examples/food/
lib/doc/examples/magic/
lib/doc/examples/monster/
lib/doc/examples/room/
lib/doc/examples/weapons/
lib/function/
lib/include/
lib/include/fn_specs/
lib/include/skills/
lib/info/
lib/inherit/base/
lib/log/
lib/manuals/312/
lib/news/
lib/obj/party/
lib/objects/components/
lib/open/
lib/open/library/
lib/open/party/
lib/players/
lib/players/zilanthius/
lib/room/
lib/room/city/arena/
lib/room/city/creator/
lib/room/city/garden/monst/
lib/room/city/obj/
lib/room/city/shop/
lib/room/death/
lib/room/registry/
lib/secure/
lib/secure/UDP_CMD_DIR/
lib/skills/
lib/skills/fighter/
lib/skills/thief/
lib/usr/
lib/usr/creators/
lib/usr/players/
/* Quest Room, Ramses 1993. Revisions by Angel 1994
 * Original code by Lemat(-jj), 1992.
 */

inherit "inherit/room2";
#define ELDER        60
 
void reset(status arg) {
  if(!present("Search For The Guyvers")) {
    move_object(clone_object("room/registry/crombie1"),this_object());
  }
  if(!present("Myphon")) {
    move_object(clone_object("room/registry/cassidy1"),this_object());
  }
  if(arg) return;

  set_weather(2, 1, 0);
  set_short("The Quest Room");
  set_long(
     "-=[  The Quest Room  ]=-                                         \n"+
     "Inside this room are all the quest objects required for the game.\n"+
     "To find out how a quest works, please check ~doc/guidelines and  \n"+
     "read everything inside there. Before you can have a quest object \n"+
     "placed in here, it must be checked by the head of the QC team.   \n");
  set_exits(({
     "room/adv_inner",   "inner",
     "room/city/square", "square",
     "room/void",        "void",
  }));
}
 
string get_new_quest(object pl) {   
  object *obj;
  string *quests_done;
  int level, i;
  string *quests_can_do;

  quests_can_do = ({});
  quests_done = (string *)this_player()->query_done_quests();
  if(!pl) pl = this_player();
  level = (int)pl->query_level();
  obj = all_inventory(this_object());

  for(i=0; i<sizeof(obj); i++) {
    if(member_array(obj[i]->query_name(), quests_done) == -1)
      if(!obj[i]->query_test())
      if((level >= obj[i]->query_min_level()) && 
         (level <= obj[i]->query_max_level())) {
        if((string)obj[i]->query_object_type() == "Quest_object")
          quests_can_do += ({ obj[i]->query_name(), });
      }
  }
  if(!sizeof(quests_can_do)) return 0;
  i = random(sizeof(quests_can_do));
  return quests_can_do[i];
}

 
int finish_quest(string quest_name, object caller, object who) { 
  object quest;
  string tmp, caller_file, caller_room;
  int i;

  if(present(quest_name), this_object()) 
    quest = present(quest_name, this_object());
  if(!quest) {
    write("Error! Quest object missing!\n");
    return 0;
  }
  if(quest->query_test()) {
    write("Quest completed for quest phaze Alpha.\n");
    return 0;
  }
  /* must still be his current quest to finish it */
  if((string)who->query_curr_quest() != quest_name) return 0;

  /* so an Elder can force a complete a quest */
  if(caller->query_security_level() >= 60) {
    if(interactive(caller))
      return (int)quest->query_qpoints();
  }

  sscanf(file_name(caller), "%s", tmp);
  sscanf(file_name(caller), "%s#%d", tmp, i);
  if(tmp != (string)quest->query_req_caller()) {
    return 0;
  }
  if(file_name(environment(who)) != (string)quest->query_req_place()) return 0;

  i = (int)quest->query_qpoints();
  return i;
  return (int)quest->query_qpoints();
}


status get_quest_hint(string quest_name) {
  object quest;

  if(!quest_name) return 0;
  quest = present(quest_name, this_object());
  if(!quest) return 0;

  write(quest->query_hint());
  return 1;
}