Exemple #1
0
int shop_keeper(struct char_data *ch, int cmd, const char *arg, char *mob, int type)
{
  char argm[100];
  struct char_data *temp_char;
  struct char_data *keeper;
  int shop_nr;
  
  int citizen(struct char_data *ch, int cmd, const char *arg, struct char_data *mob, int type);

  if(type == EVENT_DWARVES_STRIKE) {
    ch->generic = DWARVES_STRIKE;
    return FALSE;
  }

  if(type == EVENT_FAMINE) {
    ch->generic = FAMINE;
    return FALSE;
  }

  keeper = 0;
  
  for (temp_char = real_roomp(ch->in_room)->people; (!keeper) && (temp_char) ; 
       temp_char = temp_char->next_in_room)
    if (IS_MOB(temp_char))
      if (mob_index[temp_char->nr].func == CASTVF shop_keeper)
        keeper = temp_char;
  
  
  
  for(shop_nr=0 ; shop_index[shop_nr].keeper != keeper->nr; shop_nr++);
  
  
  if (!cmd) {
    if (keeper->specials.fighting) {
      return(citizen(keeper,0,"", keeper,0));
    }
  }
  
  if((cmd == 56) && (ch->in_room == shop_index[shop_nr].in_room))
    /* Buy */
    {
      shopping_buy(arg,ch,keeper,shop_nr);
      return(TRUE);
    }
  
  if((cmd ==57 ) && (ch->in_room == shop_index[shop_nr].in_room))
    /* Sell */
    {
      shopping_sell(arg,ch,keeper,shop_nr);
      return(TRUE);
    }
  
  if((cmd == 58) && (ch->in_room == shop_index[shop_nr].in_room))
    /* value */
    {
      shopping_value(arg,ch,keeper,shop_nr);
      return(TRUE);
    }
  
  if((cmd == 59) && (ch->in_room == shop_index[shop_nr].in_room))
    /* List */
    {
      shopping_list(arg,ch,keeper,shop_nr);
      return(TRUE);
    }
  
  if ((cmd == 25) || (cmd==70))   /* Kill or Hit */
    {
      only_argument(arg, argm);
      
      if (keeper == get_char_room(argm,ch->in_room))
        {
          shopping_kill(arg,ch,keeper,shop_nr);
          return(TRUE);
        }
    } else 
    if ((cmd==84) || (cmd==207) || (cmd==172) || (cmd==283) || (cmd==370) ) {   /* Cast, recite, use */
      act("$N tells you 'No magic or mistical powers here - kid!'.", FALSE, ch, 0, keeper, TO_CHAR);
      return TRUE;
    }
  
  return(FALSE);
}
Exemple #2
0
int shop_keeper(struct char_data *ch, int cmd, char *arg)
{
	char argm[100], buf[MAX_STRING_LENGTH];
	struct obj_data *temp1;
	struct char_data *temp_char;
	struct char_data *keeper;
	int shop_nr;

	keeper = 0;

	for (temp_char = world[ch->in_room].people; (!keeper) && (temp_char) ; 
		temp_char = temp_char->next_in_room)
	if (IS_MOB(temp_char))
		if (mob_index[temp_char->nr].func == shop_keeper)
			keeper = temp_char;

	for(shop_nr=0 ; shop_index[shop_nr].keeper != keeper->nr; shop_nr++);

	if((cmd == 56) && (ch->in_room == 
	   real_room(shop_index[shop_nr].in_room)))
	 /* Buy */
	{
		shopping_buy(arg,ch,keeper,shop_nr);
		return(TRUE);
	}

	if((cmd ==57 ) && (ch->in_room == 
	   real_room(shop_index[shop_nr].in_room)))
	 /* Sell */
	{
		shopping_sell(arg,ch,keeper,shop_nr);
		return(TRUE);
	}

	if((cmd == 58) && (ch->in_room == 
	   real_room(shop_index[shop_nr].in_room)))
	 /* value */
	{
		shopping_value(arg,ch,keeper,shop_nr);
		return(TRUE);
	}

	if((cmd == 59) && (ch->in_room == 
	   real_room(shop_index[shop_nr].in_room)))
	 /* List */
	{
		shopping_list(arg,ch,keeper,shop_nr);
		return(TRUE);
	}

	if ((cmd == 25) || (cmd==70))   /* Kill or Hit */
	{
		one_argument(arg, argm);

		if (keeper == get_char_room(argm,ch->in_room))
		{
			shopping_kill(arg,ch,keeper,shop_nr);
			return(TRUE);
		}
	} else if ((cmd==84) || (cmd==207) || (cmd==172)) {   /* Cast, recite, use */
		act("$N tells you 'No magic here - kid!'.", FALSE, ch, 0, keeper, TO_CHAR);
    return TRUE;
	}

	return(FALSE);
}