void do_grab(struct char_data *ch, char *argument, int cmd) { char arg1[MAX_STRING_LENGTH]; char arg2[MAX_STRING_LENGTH]; char buffer[MAX_STRING_LENGTH]; struct obj_data *obj_object; int keyword = 13; argument_interpreter(argument, arg1, arg2); if (*arg1) { obj_object = get_obj_in_list(arg1, ch->carrying); if (obj_object) { if (obj_object->obj_flags.type_flag == ITEM_LIGHT) wear(ch, obj_object, WEAR_LIGHT); else wear(ch, obj_object, 13); } else { sprintf(buffer, "You do not seem to have the '%s'.\n\r",arg1); send_to_char(buffer,ch); } } else { send_to_char("Hold what?\n\r", ch); } }
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; }
void shopping_sell( char *arg, struct char_data *ch, struct char_data *keeper,int shop_nr) { char argm[100], buf[MAX_STRING_LENGTH]; struct obj_data *temp1; struct char_data *temp_char; if(!(is_ok(keeper,ch,shop_nr))) return; one_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(!(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)) { sprintf(buf,shop_index[shop_nr].missing_cash1 ,GET_NAME(ch)); do_tell(keeper,buf,19); return; } act("$n sells $p.", FALSE, ch, temp1, 0, TO_ROOM); sprintf(buf,shop_index[shop_nr].message_sell, GET_NAME(ch),(int) (temp1->obj_flags.cost* shop_index[shop_nr].profit_sell)); do_tell(keeper,buf,19); sprintf(buf,"The shopkeeper now has %s.\n\r", temp1->short_description); send_to_char(buf,ch); GET_GOLD(ch) += (int) (temp1->obj_flags.cost* shop_index[shop_nr].profit_sell); GET_GOLD(keeper) -= (int) (temp1->obj_flags.cost* shop_index[shop_nr].profit_sell); if((get_obj_in_list(argm,keeper->carrying)) || (GET_ITEM_TYPE(temp1) == ITEM_TRASH)) extract_obj(temp1); else { obj_from_char(temp1); obj_to_char(temp1,keeper); } return; }