Esempio n. 1
0
void shopping_value( const char *arg, struct char_data *ch, 
                    struct char_data *keeper, int shop_nr)
{
  char argm[100], buf[MAX_STRING_LENGTH];
  struct obj_data *temp1;
  int i;
  float mult = 0;
  
  if(!(is_ok(keeper,ch,shop_nr)))
    return;

  if(keeper->generic != 0)
     for(i = 0; i <= MAX_TRADE; i++) {
       if(keeper->generic == FAMINE)
          if(shop_index[shop_nr].type[i] == ITEM_FOOD) {
            mult = shop_multiplier; /* we're in a famine, we sell food, so we */
            break;             /* our prices to hell ;-) -DM */ 
          }
       if(keeper->generic == DWARVES_STRIKE)
          if((shop_index[shop_nr].type[i] == ITEM_ARMOR) || (shop_index[shop_nr].type[i] == ITEM_WEAPON)) {
          mult = shop_multiplier;
          break;
       }        
     }
  
  only_argument(arg, argm);
  
  if(!(*argm))    {
      sprintf(buf,"%s What do you want me to evaluate??",
              GET_NAME(ch));
      do_tell(keeper,buf,19);
      return;
    }
  
  if(!( temp1 = get_obj_in_list_vis(ch,argm,ch->carrying)))    {
      sprintf(buf,shop_index[shop_nr].no_such_item2,
              GET_NAME(ch));
      do_tell(keeper,buf,19);
      return;
    }
  
  if(!(trade_with(temp1,shop_nr)))    {
      sprintf(buf,
              shop_index[shop_nr].do_not_buy,
              GET_NAME(ch));
      do_tell(keeper,buf,19);
      return;
    }
  
  sprintf(buf,"%s I'll give you %d gold coins for that!",
          GET_NAME(ch),(int) (temp1->obj_flags.cost*
          shop_index[shop_nr].profit_sell +
          ((chr_apply[ (int)GET_CHR(ch) ].reaction * 
          temp1->obj_flags.cost)/100) + (mult * temp1->obj_flags.cost)));
  do_tell(keeper,buf,19);
  
  return;
}
Esempio n. 2
0
void do_event(struct char_data *ch, const char *argument, int cmd)
{
    static const char                      *event_list[] = {
	NULL,
	"rats - Rats invade whatever zone you are standing in. [1+]",
	"undead - The undead rise and devour the zone you are in. [4-10]",
	"xenthia - The Lady of the Dead rises and enters the world. [10-15]",
	"goodies - Goodies fall to earth, with a few bandits too. [2-15]",
	NULL
    };
    static const funcp                      event_code[] = {
	NULL,
	(funcp)event_rats_invade_zone,
	(funcp)event_undead_invade_zone,
	(funcp)event_zombie_master,
	(funcp)event_scatter_goodies,
	NULL
    };
    int                                     i = 0;
    char                                    buf[MAX_INPUT_LENGTH] = "\0\0\0\0\0\0\0";
    int                                     found = FALSE;

    if (DEBUG)
	log_info("called %s with %s, %s, %d", __PRETTY_FUNCTION__, SAFE_NAME(ch),
		 VNULL(argument), cmd);

    if (IS_NPC(ch))
	return;
    only_argument(argument, buf);
    if (!*buf) {
	cprintf(ch, "usage:  event { list | <event name> }\r\n");
	return;
    }
    if (!strcasecmp(buf, "list")) {
	cprintf(ch, "The following events are defined:\r\n");
	for (i = 1; event_list[i]; i++) {
	    cprintf(ch, "    %s\r\n", event_list[i]);
	}
	return;
    }
    for (i = 1; event_list[i]; i++) {
	if (!strncasecmp(buf, event_list[i], strlen(buf))) {
	    found = i;
	    break;
	}
    }
    if (!found)
	return;
    cprintf(ch, "Doing Event [#%d] %s\r\n", found, event_list[found]);
    log_info("%s does Event [#%d] %s", GET_NAME(ch), found, event_list[found]);
    event_code[found] (ch, argument);
}
Esempio n. 3
0
void do_track(struct char_data *ch, char *argument, int cmd)
{
   char name[256], buf[256];
   int dist, code;
   struct hunting_data	huntd;
   int cost;

   only_argument(argument, name);

   dist = ch->skills[SKILL_HUNT].learned;

   if(IS_SET(ch->player.class, CLASS_RANGER)) 
   {
     dist *= 2;
     cost = 15 - (GET_LEVEL(ch,RANGER_LEVEL_IND)/10);
   }
   else
   if(IS_SET(ch->player.class, CLASS_THIEF))
Esempio n. 4
0
void do_disarm(struct char_data *ch, char *argument, int cmd)
{
  char name[30];
  int percent;
  struct char_data *victim;
  struct obj_data *w;
  int chance;
  int cost;

  if (check_peaceful(ch,"You feel too peaceful to contemplate violence.\n\r"))
    return;
  
  only_argument(argument, name);
  if (!(victim = get_char_room_vis(ch, name))) 
  {
    if (ch->specials.fighting) 
    {
      victim = ch->specials.fighting;
    }
    else
    {
      send_to_char("Disarm who?\n\r", ch);
      return;
    }
  }
  
  if (victim == ch) 
  {
    send_to_char("Aren't we funny today...\n\r", ch);
    return;
  }

  if(!CheckKill(ch,victim)) return;

  if(ch->attackers > 3) 
  {
    send_to_char("There is no room to disarm!\n\r", ch);
    return;
  }

  if(victim->attackers > 3)
  {
    send_to_char("There is no room to disarm!\n\r",ch);
    return;
  }

  cost = 25 - (GET_LEVEL(ch,BestFightingClass(ch))/10);

  if(GET_MANA(ch)<cost)
  {
    send_to_char("You trip and fall while trying to disarm.\n\r",ch);
    return;
  }

  percent=number(1,101); /* 101% is a complete failure */
  percent -= dex_app[GET_DEX(ch)].reaction;
  percent += dex_app[GET_DEX(victim)].reaction;

  if(!ch->equipment[WIELD] && !ch->equipment[WIELD_TWOH]) 
  {
    percent -= 50;
  }

  if(percent > ch->skills[SKILL_DISARM].learned) 
  {
    /*   failure   */

    GET_MANA(ch) -= 10;
    act("You try to disarm $N, but fail miserably.",TRUE,ch,0,victim,TO_CHAR);
    if((ch->equipment[WIELD]) && (number(1,10) > 8))
    {
        send_to_char("Your weapon flies from your hand while trying!\n\r",ch);
	w = unequip_char(ch,WIELD);
	obj_from_char(w);
	obj_to_room(w,ch->in_room);
	act("$n tries to disarm $N, but $n loses his weapon!",TRUE,ch,0,victim,TO_ROOM);
    }
    else
    if((ch->equipment[WIELD_TWOH]) && (number(1,10) > 9))
    {
        send_to_char("Your weapon slips from your hands while trying!\n\r",ch);
	w = unequip_char(ch,WIELD_TWOH);
	obj_from_char(w);
	obj_to_room(w,ch->in_room);
	act("$n tries to disarm $N, but $n loses his weapon!",TRUE,ch,0,victim,TO_ROOM);
    }
    GET_POS(ch) = POSITION_SITTING;

    if((IS_NPC(victim)) && (GET_POS(victim) > POSITION_SLEEPING) && (!victim->specials.fighting)) 
    {
      set_fighting(victim, ch);
    }
    WAIT_STATE(ch, PULSE_VIOLENCE*2);
  }
  else
  {
    if(victim->equipment[WIELD]) 
    {
      GET_MANA(ch) -= 25;
      w = unequip_char(victim, WIELD);
      act("$n makes an impressive fighting move.",TRUE, ch, 0, 0, TO_ROOM);
      act("You send $p flying from $N's grasp.", TRUE, ch, w, victim, TO_CHAR);
      act("$p flies from your grasp.", TRUE, ch, w, victim, TO_VICT);
      obj_from_char(w);
      obj_to_room(w, victim->in_room);
      if(ch->skills[SKILL_DISARM].learned < 50)
	ch->skills[SKILL_DISARM].learned += 2;
    }
    else
    if(victim->equipment[WIELD_TWOH])
    {
      GET_MANA(ch) -= cost;
      if(IS_NPC(victim))
	chance = 70;
      else
        chance = victim->skills[SKILL_TWO_HANDED].learned; 

      percent=number(1,101); /* 101% is a complete failure */
      if(percent > chance)
      {
        w = unequip_char(victim, WIELD_TWOH);
        act("$n makes a very impressive fighting move.",TRUE, ch, 0, 0, TO_ROOM);
        act("You send $p flying from $N's grasp.", TRUE, ch, w, victim, TO_CHAR);
        act("$p flies from your grasp.", TRUE, ch, w, victim, TO_VICT);
        obj_from_char(w);
        obj_to_room(w, victim->in_room);
        if(ch->skills[SKILL_DISARM].learned < 50)
	  ch->skills[SKILL_DISARM].learned += 4;
      }
      else
      {
        act("You try to disarm $N, but fail miserably.",TRUE,ch,0,victim,TO_CHAR);
      }
    }
    else
    {
      act("You try to disarm $N, but $E doesn't have a weapon.", 
	  TRUE, ch, 0, victim, TO_CHAR);
      act("$n makes an impressive fighting move, but does little more.",
	  TRUE, ch, 0, 0, TO_ROOM);
    }

    if ((IS_NPC(victim)) && (GET_POS(victim) > POSITION_SLEEPING) &&
        (!victim->specials.fighting)) {
      set_fighting(victim, ch);
    }
    WAIT_STATE(ch, PULSE_VIOLENCE*1);
  }  
}
Esempio n. 5
0
void do_unban(struct char_data *ch, const char *argument, int cmd)
{
    char                                    ban_type[MAX_STRING_LENGTH] = "\0\0\0";
    char                                    buf[MAX_STRING_LENGTH] = "\0\0\0\0\0\0\0";
    int                                     i = 0;

    if (DEBUG)
	log_info("called %s with %s, %s, %d", __PRETTY_FUNCTION__, SAFE_NAME(ch),
		 VNULL(argument), cmd);

    if (IS_NPC(ch)) {
	cprintf(ch, "You're a mob, you can't unban anyone.\r\n");
	return;
    }
    if (argument && *argument) {
	argument = one_argument(argument, ban_type);
	only_argument(argument, buf);
	if (*ban_type) {
	    if (!str_cmp(ban_type, "name")) {
		if (*buf) {
		    /*
		     * First, we need to make sure it isn't already a mob or player. then we can try adding it to the
		     * ban table. 
		     */
		    if (!banned_name(buf)) {
			cprintf(ch, "%s is not banned.\r\n", buf);
			return;
		    }
                    for (i = 0; i < banned_names_count; i++) {
                        if (!str_cmp(banned_names[i], buf)) {
                            char **tmp_foo = calloc(banned_names_count - 1, sizeof(char *));
                            int j = 0;
                            for( j = 0; j < i; j++ ) {
                                tmp_foo[j] = banned_names[j];
                            }
                            for( j = i + 1; j < banned_names_count; j++ ) {
                                tmp_foo[j-1] = banned_names[j];
                            }
                            free(banned_names[i]);
                            banned_names_count--;
                            free(banned_names);
                            banned_names = tmp_foo;
                            cprintf(ch, "%s is no longer banned!\r\n", buf);
                            log_auth(ch, "BAN %s has been unbanned by %s!", buf, GET_NAME(ch));
                            save_bans();
                            return;
                        }
                    }
		    return;
		} else {
		    cprintf(ch, "Banned names:\r\n");
		    for (i = 0; i < banned_names_count; i++) {
			cprintf(ch, "%-20s\r\n", banned_names[i]);
		    }
		    return;
		}
	    } else if (!str_cmp(ban_type, "ip") || !str_cmp(ban_type, "address")
		       || !str_cmp(ban_type, "site")) {
		if (*buf) {
		    /*
		     * No banning localhost! 
		     */
		    if (!banned_ip(buf)) {
			cprintf(ch, "%s is not banned.\r\n", buf);
			return;
		    }
                    for (i = 0; i < banned_names_count; i++) {
                        if (!str_cmp(banned_ips[i], buf)) {
                            char **tmp_foo = calloc(banned_ips_count - 1, sizeof(char *));
                            int j = 0;
                            for( j = 0; j < i; j++ ) {
                                tmp_foo[j] = banned_ips[j];
                            }
                            for( j = i + 1; j < banned_ips_count; j++ ) {
                                tmp_foo[j-1] = banned_ips[j];
                            }
                            free(banned_ips[i]);
                            banned_ips_count--;
                            free(banned_ips);
                            banned_ips = tmp_foo;
                            cprintf(ch, "%s is no longer banned!\r\n", buf);
                            log_auth(ch, "BAN %s has been unbanned by %s!", buf, GET_NAME(ch));
                            save_bans();
                            return;
                        }
                    }
		    return;
		} else {
		    cprintf(ch, "Banned IP addresses:\r\n");
		    for (i = 0; i < banned_ips_count; i++) {
			cprintf(ch, "%-20s\r\n", banned_ips[i]);
		    }
		    return;
		}
	    }
	}
    }
    cprintf(ch, "Usage: unban < name|ip > [ name|address ]\r\n");
}
Esempio n. 6
0
void do_ban(struct char_data *ch, const char *argument, int cmd)
{
    char                                    ban_type[MAX_STRING_LENGTH] = "\0\0\0\0\0\0\0";
    char                                    buf[MAX_STRING_LENGTH] = "\0\0\0\0\0\0\0";
    int                                     i = 0;

    if (DEBUG)
	log_info("called %s with %s, %s, %d", __PRETTY_FUNCTION__, SAFE_NAME(ch),
		 VNULL(argument), cmd);

    if (IS_NPC(ch)) {
	cprintf(ch, "You're a mob, you can't ban anyone.\r\n");
	return;
    }
    if (argument && *argument) {
	argument = one_argument(argument, ban_type);
	only_argument(argument, buf);
	if (*ban_type) {
	    if (!str_cmp(ban_type, "name")) {
		if (*buf) {
		    /*
		     * First, we need to make sure it isn't already a mob or player. then we can try adding it to the
		     * ban table. 
		     */
		    if (!acceptable_name(buf)) {
			cprintf(ch, "%s is already an invalid choice.\r\n", buf);
			return;
		    }

		    banned_names_count++;
		    banned_names = realloc(banned_names, banned_names_count * sizeof(char *));
		    banned_names[banned_names_count - 1] = strdup(buf);
		    cprintf(ch, "%s is now banned!\r\n", buf);
		    log_auth(ch, "BAN %s has been banned by %s!", buf, GET_NAME(ch));
		    save_bans();
		    return;
		} else {
		    cprintf(ch, "Banned names:\r\n");
		    for (i = 0; i < banned_names_count; i++) {
			cprintf(ch, "%-20s\r\n", banned_names[i]);
		    }
		    return;
		}
	    } else if (!str_cmp(ban_type, "ip") || !str_cmp(ban_type, "address")
		       || !str_cmp(ban_type, "site")) {
		if (*buf) {
		    /*
		     * No banning localhost! 
		     */
		    if (str_cmp("127.0.0.1", buf)) {
			cprintf(ch, "You cannot ban localhost!\r\n");
			return;
		    }
		    banned_ips_count++;
		    banned_ips = realloc(banned_ips, banned_ips_count * sizeof(char *));
		    banned_ips[banned_ips_count - 1] = strdup(buf);
		    cprintf(ch, "%s is now banned!\r\n", buf);
		    log_auth(ch, "BAN %s has been banned by %s!", buf, GET_NAME(ch));
		    save_bans();
		    return;
		} else {
		    cprintf(ch, "Banned IP addresses:\r\n");
		    for (i = 0; i < banned_ips_count; i++) {
			cprintf(ch, "%-20s\r\n", banned_ips[i]);
		    }
		    return;
		}
	    }
	}
    }
    cprintf(ch, "Usage: ban < name|ip > [ name|address ]\r\n");
}
Esempio n. 7
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);
}
Esempio n. 8
0
void shopping_sell( const char *arg, struct char_data *ch,
                   struct char_data *keeper,int shop_nr)
{
  char argm[100], buf[MAX_STRING_LENGTH];
  int cost,temp_cost, i;
  struct obj_data *temp1;
  float mult = 0;
  
  if(!(is_ok(keeper,ch,shop_nr)))
    return;

  if(keeper->generic != 0)
     for(i = 0; i <= MAX_TRADE; i++) {
       if(keeper->generic == FAMINE)
          if(shop_index[shop_nr].type[i] == ITEM_FOOD) {
            mult = shop_multiplier; /* we're in a famine, we sell food, so we */
            break;             /* our prices to hell ;-) -DM */ 
          }
       if(keeper->generic == DWARVES_STRIKE)
          if((shop_index[shop_nr].type[i] == ITEM_ARMOR) || (shop_index[shop_nr].type[i] == ITEM_WEAPON)) {
          mult = shop_multiplier;
          break;
       }        
     }
  
  only_argument(arg, argm);
  
  if(!(*argm))        {
    sprintf(buf, "%s What do you want to sell??"
            ,GET_NAME(ch));
    do_tell(keeper,buf,19);
    return;
  }
  
  if (!( temp1 = get_obj_in_list_vis(ch,argm,ch->carrying))) {
    sprintf(buf, shop_index[shop_nr].no_such_item2,GET_NAME(ch));
    do_tell(keeper,buf,19);
    return;
  }
  
  if( IS_OBJ_STAT( temp1, ITEM_NODROP ) && !IS_IMMORTAL( ch ) )
  {
     send_to_char("You can't let go of it, it must be CURSED!\n\r", ch);
     return;
  }

  if (!(trade_with(temp1,shop_nr))||(temp1->obj_flags.cost<1)) {
    sprintf(buf,shop_index[shop_nr].do_not_buy,
            GET_NAME(ch));
    do_tell(keeper,buf,19);
    return;
  }
  
  if( GET_GOLD(keeper)<(int) (temp1->obj_flags.cost*
      shop_index[shop_nr].profit_sell +
      ((chr_apply[ (int)GET_CHR(ch)].reaction*temp1->obj_flags.cost)/100) +
      (mult * temp1->obj_flags.cost)))
  {
    sprintf(buf,shop_index[shop_nr].missing_cash1,GET_NAME(ch));
    do_tell(keeper,buf,19);
    return;
  }
  
  cost = temp1->obj_flags.cost;
  
  if ((ITEM_TYPE(temp1) == ITEM_WAND) ||
      (ITEM_TYPE(temp1) == ITEM_STAFF))
  {
    if (temp1->obj_flags.value[1])
    {
      cost = (int)( cost * ( (float)temp1->obj_flags.value[2] /
                             (float)temp1->obj_flags.value[1] ) );
    }
    else
    {
      cost = 0;
    }
  } 
  else if (ITEM_TYPE(temp1) == ITEM_ARMOR)
  {
    if (temp1->obj_flags.value[1])
    {
      cost = (int)( cost * ( (float)temp1->obj_flags.value[0] /
                             (float)temp1->obj_flags.value[1] ) );
    }
    else
    {
      cost = 0;
    }
  }
  
  temp1->obj_flags.cost = cost;
  
  act("$n sells $p.", FALSE, ch, temp1, 0, TO_ROOM);
  temp_cost = (int) (temp1->obj_flags.cost*shop_index[shop_nr].profit_sell +
             ((chr_apply[ (int)GET_CHR(ch) ].reaction *
             temp1->obj_flags.cost)/100) + (mult * temp1->obj_flags.cost));
  if(temp_cost < 0) temp_cost=0;

  sprintf(buf,shop_index[shop_nr].message_sell,GET_NAME(ch),temp_cost);

/* (int) (temp1->obj_flags.cost*        
                shop_index[shop_nr].profit_sell +
                ((chr_apply[GET_CHR(ch)].reaction*temp1->obj_flags.cost)/100)))
; */
  
  do_tell(keeper,buf,19);
  
  sprintf(buf,"The shopkeeper now has %s.\n\r",
          temp1->short_description);
  send_to_char(buf,ch);
  
  if (GET_GOLD(keeper)< temp_cost) {
 /* (int) (temp1->obj_flags.cost*
              shop_index[shop_nr].profit_sell +
               ((chr_apply[GET_CHR(ch)].reaction*temp1->obj_flags.cost)/100))) {
 */
    sprintf(buf,shop_index[shop_nr].missing_cash1 ,GET_NAME(ch));
    do_tell(keeper,buf,19);
    return;
  }
  
  GET_GOLD(ch) += temp_cost;
    /* (int) (temp1->obj_flags.cost*
              shop_index[shop_nr].profit_sell +
               ((chr_apply[GET_CHR(ch)].reaction*temp1->obj_flags.cost)/100));
              */
  GET_GOLD(keeper) -= temp_cost;
    /* (int) (temp1->obj_flags.cost*
              shop_index[shop_nr].profit_sell +
               ((chr_apply[GET_CHR(ch)].reaction*temp1->obj_flags.cost)/100));
              */
  obj_from_char(temp1);
  if (temp1 == NULL) {
    send_to_char("As far as I am concerned, you are out..\n\r",ch);
    return;
  }
  if ((get_obj_in_list(argm,keeper->carrying)) || 
      (GET_ITEM_TYPE(temp1) == ITEM_TRASH)) {
    extract_obj(temp1);
  } else {
    obj_to_char(temp1,keeper);
  }
  return;
}
Esempio n. 9
0
void shopping_buy( const char *arg, struct char_data *ch,
         struct char_data *keeper, int shop_nr)
{
  char argm[100], buf[MAX_STRING_LENGTH], newarg[100];
  int num = 1;
  struct obj_data *temp1;
  int i;
  float mult = 0;
  
  if(!(is_ok(keeper,ch,shop_nr)))
    return;

  if(keeper->generic != 0)
     for(i = 0; i <= MAX_TRADE; i++) {
       if(keeper->generic == FAMINE)
          if(shop_index[shop_nr].type[i] == ITEM_FOOD) {
            mult = shop_multiplier; /* we're in a famine, we sell food, so we */
            break;             /* our prices to hell ;-) -DM */ 
          }
       if(keeper->generic == DWARVES_STRIKE)
          if((shop_index[shop_nr].type[i] == ITEM_ARMOR) || (shop_index[shop_nr].type[i] == ITEM_WEAPON)) {
          mult = shop_multiplier;
          break;
       }        
     }
  
  only_argument(arg, argm);
  if(!(*argm))   {
      sprintf(buf,
              "%s what do you want to buy??"
              ,GET_NAME(ch));
      do_tell(keeper,buf,19);
      return;
    };
  
  if( ( num = getabunch( argm, newarg ) ) != 0 ) 
  {
    strcpy(argm,newarg);
  }
  if (num == 0) num = 1;
  
  if(!( temp1 = 
       get_obj_in_list_vis(ch,argm,keeper->carrying)))    {
      sprintf(buf,
              shop_index[shop_nr].no_such_item1
              ,GET_NAME(ch));
      do_tell(keeper,buf,19);
      return;
    }
  
  if(temp1->obj_flags.cost <= 0)    {
      sprintf(buf,
              shop_index[shop_nr].no_such_item1
              ,GET_NAME(ch));
      do_tell(keeper,buf,19);
      extract_obj(temp1);
      return;
    }
  
  if( GET_GOLD(ch) < (int) (num*(temp1->obj_flags.cost*
      shop_index[shop_nr].profit_buy -
      ((chr_apply[ (int)GET_CHR(ch) ].reaction*temp1->obj_flags.cost)/100) +
      (mult * temp1->obj_flags.cost))) && GetMaxLevel(ch)<DEMIGOD)    {
    sprintf(buf, shop_index[shop_nr].missing_cash2, GET_NAME(ch));
    do_tell(keeper,buf,19);
      
    switch(shop_index[shop_nr].temper1)        {
        case 0:
          do_action(keeper,GET_NAME(ch),30);
          return;
        case 1:
          do_emote(keeper,"grins happily",36);
          return;
        default:
          return;
    }
  }
  
  if ((IS_CARRYING_N(ch) + num) > (CAN_CARRY_N(ch)))
    {
      sprintf(buf,"%s : You can't carry that many items.\n\r", 
              fname(temp1->name));
      send_to_char(buf, ch);
      return;
    }
  
  if ((IS_CARRYING_W(ch) + (num * temp1->obj_flags.weight)) > CAN_CARRY_W(ch))
    {
      sprintf(buf,"%s : You can't carry that much weight.\n\r", 
              fname(temp1->name));
      send_to_char(buf, ch);
      return;
    }
  
  act("$n buys $p.", FALSE, ch, temp1, 0, TO_ROOM);
  
  sprintf(buf, shop_index[shop_nr].message_buy,
          GET_NAME(ch), (int) (num * (temp1->obj_flags.cost*
          shop_index[shop_nr].profit_buy -
          ((chr_apply[ (int)GET_CHR(ch)].reaction*temp1->obj_flags.cost)/100) + 
          (mult * temp1->obj_flags.cost))));
  
  do_tell(keeper,buf,19);
  
  sprintf(buf,"You now have %s (*%d).\n\r",
          temp1->short_description,num);
  
  send_to_char(buf,ch);
  
  while (num-- > 0) {
    
    if (GetMaxLevel(ch)<DEMIGOD)
      GET_GOLD(ch) -= (int)(temp1->obj_flags.cost*
      shop_index[shop_nr].profit_buy -
      ((chr_apply[ (int)GET_CHR(ch) ].reaction*temp1->obj_flags.cost)/100)+
      (mult * temp1->obj_flags.cost));
    
      GET_GOLD(keeper) += (int)(temp1->obj_flags.cost*
                shop_index[shop_nr].profit_buy -
                ((chr_apply[(int)GET_CHR(ch)].reaction*temp1->obj_flags.cost)/100)+
                (mult * temp1->obj_flags.cost));
    
    /* Test if producing shop ! */
    if (shop_producing(temp1,shop_nr))
      temp1 = read_object(temp1->item_number, REAL);
    else {
      obj_from_char(temp1);
      if (temp1 == NULL) {
        send_to_char("Sorry, I just ran out of those.\n\r",ch);
        GET_GOLD(ch) += (int)(temp1->obj_flags.cost*
                shop_index[shop_nr].profit_buy -
                ((chr_apply[ (int)GET_CHR(ch) ].reaction * 
                temp1->obj_flags.cost)/100)+
                (mult * temp1->obj_flags.cost));
        return;
      }
    }
    
    obj_to_char(temp1,ch);
    
  }
  return; 
}