      Creator:
Rainer Roomet, Estonia. 
rainer_roomet@hotmail.com
The Lost Lands of Arion
telnet: irc.nohik.ee 4242
url:    http://www.zone.ee/gain/

Snippet:
This snippets adds some extra informative texts for your shopkeepers
(You also may add these texts to bankers, receptionists, questmasters)
If shop is closed, then shopkeeper tells you when he/she opens his/her
shop.

Credits: No need ANY credits.

Code:

Open the file 'act_object.c'
Find the code 'CHAR_DATA *find_keeper( CHAR_DATA *ch )'

after:
    CHAR_DATA *keeper;
add:
        char buf[MAX_STRING_LENGTH];

Before:
    /*
     * Invisible or hidden people.
     */
    if ( !can_see( keeper, ch ) )
    {
	do_function(keeper, &do_say, "I don't trade with folks I can't see.");
	return NULL;
    } 

add:
    if ( time_info.hour == pShop->open_hour - 2
    ||   time_info.hour == pShop->open_hour - 3 )
    {
	act("$N tells you 'We are closed! We will open in a couple hours.'", ch, NULL, keeper, TO_CHAR);
	return NULL;
    }
    else if ( time_info.hour == pShop->open_hour - 1 )
    {
	act("$N tells you 'We are closed! We will open in within the hour.'", ch, NULL, keeper, TO_CHAR);
	return NULL;
    }
    else if ( time_info.hour <  pShop->open_hour )
    {
	sprintf(buf, "$N tells you 'Sorry, we are closed. We will open at %d%s %s.'",
	   pShop->open_hour, 
	   pShop->open_hour < 13 ? "am" : "pm",
	   time_info.hour < pShop->open_hour ?  "today" : "tomorrow");

	act(buf, ch, NULL, keeper, TO_CHAR);
	return NULL;
    }


SAVE and CLOSE the file 'act_obj.c'

Open the file 'update.c'
Find the code 'void char_update( void )'

After:

 /*
  * Autosave and autoquit.
  * Check that these chars still exist.
  */
   for ( ch = char_list; ch != NULL; ch = ch_next )
   {
      ch_next = ch->next;

      if (ch->desc != NULL && ch->desc->descriptor % 30 == save_number)
         save_char_obj(ch);

      if (ch == ch_quit)
	    do_function(ch, &do_quit, "" );
   }

  /* 
   * Shopkeepers informs the players when they open or close
   * their shops. Also, at open hour, we give some extra gold 
   * to the Shopkeepers -- I hate bankryted shopkeepers :)
   * -- Ranka 
   */
   for ( ch = char_list; ch != NULL; ch = ch_next )
   {
      ch_next = ch->next;

      if ( !IS_NPC(ch) 
      || ch->in_room == NULL 
      || IS_AFFECTED(ch,AFF_CHARM))
	 continue;

      if (ch->in_room->area->empty && !IS_SET(ch->act,ACT_UPDATE_ALWAYS))
          continue;

ADD:
      if ( (pShop = ch->pIndexData->pShop) != NULL)
      {
         if (time_info.hour == pShop->open_hour - 1 )
	 {
	    {
	       if (ch->gold < ch->pIndexData->wealth)
	           ch->gold += ch->pIndexData->wealth;
	    }
	    act( "$n prepares to open the shop.", ch, NULL, NULL, TO_ROOM);
	 }
	 else if (time_info.hour == pShop->open_hour)
	    act( "$n opens the shop.", ch, NULL, NULL, TO_ROOM);
	 else if (time_info.hour == pShop->close_hour - 1)
            act( "$n prepares to close the shop.", ch, NULL, NULL, TO_ROOM);
         else if (time_info.hour == ch->pIndexData->pShop->close_hour)
	    act( "$n closes the shop.", ch, NULL, NULL, TO_ROOM);	
      }

         
 