/
lib/banish/
lib/d/coronos/
lib/d/coronos/w/alena/
lib/d/coronos/w/angel/
lib/d/coronos/w/angel/caves/
lib/d/coronos/w/angel/caves/monst/
lib/d/coronos/w/angel/city/chambers/
lib/d/coronos/w/angel/city/monst/
lib/d/coronos/w/angel/city/obj/
lib/d/coronos/w/angel/city/streets/
lib/d/coronos/w/angel/farms/plains/
lib/d/coronos/w/angel/monst/
lib/d/tempus/
lib/d/tempus/w/angel/
lib/d/tempus/w/kingbill/
lib/d/tempus/w/mirak/
lib/d/tempus/w/mirak/monst/
lib/d/tempus/w/mirak/obj/
lib/d/tempus/w/relgar/planes/baat/
lib/d/tempus/w/sarak/
lib/d/tempus/w/serepion/mon/
lib/d/tempus/w/valrejn/
lib/doc/
lib/doc/domains/
lib/doc/efun/
lib/include/fn_specs/
lib/info/
lib/inherit/base/
lib/log/
lib/log/mailbox/
lib/log/main/
lib/news/
lib/obj/party/
lib/objects/componen/
lib/open/
lib/open/party/
lib/open/paste/
lib/open/spells/
lib/open/valrejn/
lib/players/
lib/players/alena/
lib/players/alena/obj/
lib/players/alena/open/
lib/players/alena/private/
lib/players/angel/
lib/players/angel/obj/
lib/players/ash/
lib/players/biggs/
lib/players/biggs/food/
lib/players/biggs/gobkeep/
lib/players/biggs/mnstr/
lib/players/biggs/town/caves/
lib/players/biggs/town/tower/
lib/players/biggs/wpns/
lib/players/calris/
lib/players/deathurg/
lib/players/deathurg/open/
lib/players/deathurg/private/thief/
lib/players/dogberry/
lib/players/dogberry/library/
lib/players/dogberry/open/
lib/players/epsilon/
lib/players/epsilon/private/
lib/players/farewell/
lib/players/hippo/
lib/players/hippo/open/
lib/players/hippo/tools/
lib/players/jimpa/
lib/players/josh/
lib/players/josh/room/
lib/players/josh/room/mage/dungeon/
lib/players/josh/room/mage/dungeon/obj/
lib/players/josh/wep/
lib/players/kingbill/
lib/players/metatron/
lib/players/miette/
lib/players/mirak/
lib/players/mirak/open/
lib/players/parsilan/
lib/players/relgar/
lib/players/relgar/private/
lib/players/sarak/
lib/players/sarak/bugs/
lib/players/sarak/feelings/
lib/players/sarak/magical/
lib/players/sarak/minotaur/island/
lib/players/sarak/open/
lib/players/sarak/private/
lib/players/serepion/
lib/players/serepion/open/
lib/players/serepion/private/
lib/players/spike/
lib/players/spike/open/
lib/players/spike/private/
lib/players/spike/seaworld/
lib/players/valrejn/
lib/players/valrejn/open/
lib/players/valrejn/private/
lib/players/virus/
lib/players/wrath/
lib/players/wrath/arm/
lib/players/wrath/mon/
lib/players/wrath/room/
lib/players/wrath/room/entry/
lib/players/wrath/room/zolgath/
lib/players/wrath/weap/
lib/players/zil/
lib/room/
lib/room/city/arena/
lib/room/city/creator/
lib/room/city/garden/monst/
lib/room/city/library/
lib/room/city/library/open/books/
lib/room/city/shop/
lib/room/death/
lib/room/death/open/
lib/room/island/
lib/room/keeps/
lib/room/registry/
lib/room/ships/crew/
lib/room/ships/open/
lib/room/ships/open/types/bounty/
lib/room/ships/open/types/nebula/
lib/room/ships/open/types/phoenix/
lib/secure/udp_cmd_/
lib/skills/
lib/skills/fighter/
lib/skills/psionici/
lib/skills/thief/
lib/usr/
lib/usr/creators/
lib/usr/no_banis/
lib/usr/players/
#include <mudlib.h>
#define NAME   capitalize((string)this_player()->query_name(1))
#define SCROLL "room/city/obj/scroll"
inherit ROOM;

static string quester;
static int counter;

void quest_hint();
void reset(status arg) {
  object obj;
  if(!present("clerk") && !this_player()->query_npc()) {
    obj = clone_object("room/city/monst/clerk");
    move_object(obj,this_object());
  }

  load_door(({
    "file", "room/city/t_hall3",
    "direction", "north door",
    "long", "A solid door made of oak.\n",
    "key id", "city key",
  }));

  reset_doors(arg);
  if(arg) return;
  set_short("the city clerk's office");
  set_long(
     "Littering the large wooden desk of fine old pine are papers and \n"+
     "parchments listing many assignments and proclamations set by the\n"+
     "Tempus city council, and sponsored by the mayor. Adventurers come\n"+
     "here to seek advice and gain sponsored quests by the clerk.\n");

  set_items(({
    "desk#wooden desk",
       "A fine desk made from pine. It is possibly a gift from the elves \n"+
       "of the north who make such beautifully designed furniture",
    "paper#papers#parchment#parchments",
       "They all bear the mark of the official mark of the mayor of Tempus",
  }));

  set_weather(2,1,0);
  quester = 0;
  counter = 0;
}

void init() {
  if(present("clerk") && !this_player()->query_npc()) {
    if(!this_player()->query_current_quest() && this_player()->assign_quest()){
      quester = NAME;
    }  
    call_out("quest1", 1);
  }  
  ::init();
  add_action("check", "", 1);
}

status check() {
  if((quester == NAME) && (query_verb() != "update")) { /* failsafe */
    tell_object(this_player(), 
     "Clerk says: Hey, I haven't finished yet!\n");
    return 1;
  }
}

void quest1() {
  if(quester && (quester != NAME)) {
    tell_object(this_player(),
      "Clerk says: Just a moment "+NAME+", I'll be with "+
     "you in a second.\n");
    return;
  }
  if(this_player()->query_current_quest() && (NAME != quester)) {
    tell_object(this_player(),
     "Clerk says: Welcome back, "+NAME+". I see you still have not \n"+
     "            completed your current assignment for the city council.\n"+
     "            Your quest still is...\n\n");
    this_player()->quest_hint();
    return;
  }
  if(!this_player()->query_current_quest()) {
    tell_room(this_object(),
      "Clerk says: I'm sorry, "+NAME+", but we have nothing for you "+
      "at this stage.\n");
    return;
  }

  tell_room(this_object(), "Clerk smiles happily.\n"+
     "Clerk begins to sift through mounds of papers and official documents.\n");
  call_out("quest2", 1);
  return;
}

void quest2() {
  mixed *messages;
  messages = ({
     ({ "Clerk says: It's so good to see you "+NAME+".\n",
        "Clerk says: It's been a while since I've seen you, "+NAME+".\n",
        "Clerk asks: Why haven't you come in sooner, "+NAME+".\n",
         "Clerk finds something amid the mess of papers and scrolls.\n",
     }),


     ({
       "Clerk says: I have heard you are an adventurer of great prowess.\n",
       "Clerk says: News of your power is spreading through the city.\n",
       "Clerk says: You have become quite famous in these parts.\n",
       "Clerk says: You're such a mighty adventurer.\n",
     }),

     ({
       "Clerk says: I was once a mighty mage myself.\n",
       "Clerk says: Did you know I was once a famous magic-user?\n",
       "Clerk recalls her memories of her adventuring days...\n",
       "Clerk begins to daydream about her past adventuring life.\n",
       "Clerk says: The life of the adventurer is filled with such joys.\n",
     }),

      ({
        "Clerk says: now, onto business.\n",
         "Clerk atlast finds the paper she was looking for.\n",
         "Clerk smiles with relief as she finds the necesary papers.\n",
      }),

      ({
     "Clerk says: The Tempus Council is always in need of brave adventurers.\n", 
     "Clerk says: The mayor is always in needs of people to aid the council.\n",
     "Clerk reads a brief proclamation of the Tempus City Council.\n",
      }),
     ({
     "Clerk says: It is my duty to see that you aid us whenever possible.\n",
     "Clerk says: As a citizen of Tempus, you are required to aid the city\n"+
     "            in times of need.\n",
      }),
      ({
     "Clerk says: In exchange, we offer you the freedom to come and go \n"+
     "            in our fair city, using its facilities as you need.\n",
     "Clerk says: In return, you have at your desposal all the guilds and\n"+
     "            training facilities within our city walls.\n",
      }),

     ({
       "Clerk says: "+NAME+", this time I charge you with this duty.\n",
       "Clerk says: "+NAME+", the mayor has asked me to send you on a \n"+
       "            a quest of vital importance to the safety of Tempus.\n",
       "Clerk says: The mayor himself has personally asked me to send you\n"+
       "            on this vital quest.\n",
       "Clerk says: I have a quest for you to undertake.\n",
       "Clerk says: I must ask you to embark on a private quest for us.\n",
     }),
  });

  if(counter < sizeof(messages)) {
    if(sizeof(messages[counter]))
      tell_room(this_object(),
        messages[counter][random(sizeof(messages[counter]))]);
    else 
      tell_room(this_object(), messages[counter]);
    counter ++;
    call_out("quest2", 1);
  }
  else {
      quest_hint();
      quester = 0;
      counter = 0;
  }
  return;
} 

void quest_hint() {
  object scroll;

  tell_object(this_player(),
     "Clerk says: Your quest is...\n\n");
  this_player()->quest_hint();

  if(!present("quest hint", this_player())) {
    tell_object(this_player(), "Clerk hands you a scroll.\n");
    say("Clerk hands "+NAME+" a scroll.\n",this_player());
    scroll = clone_object(SCROLL);
    if(!this_player()->add_weight(1)) {
      tell_object(this_player(), "Clerk notices you can't carry anymore.\n"+
      "Clerk places the scroll back in the drawer of her desk.\n"+
      "Clerk says: Come back when you put on some more muscle.\n");
      destruct(scroll);
      return;
    }
    else
      move_object(scroll, this_player());
  }
  return;
}

string query_quester() {
  return quester;
}