| version 1.31 | | version 1.32 |
|---|
| | |
| /* | | /* |
| * static char *rcsid_shop_c = | | * static char *rcsid_shop_c = |
| * "$Id: shop.c,v 1.31 2004/06/13 17:30:38 akirschbaum Exp $"; | | * "$Id: shop.c,v 1.32 2004/08/24 19:43:59 akirschbaum Exp $"; |
| */ | | */ |
| | | |
| /* | | /* |
| | |
| uint64 val; | | uint64 val; |
| int number; /* used to better calculate value */ | | int number; /* used to better calculate value */ |
| int no_bargain; | | int no_bargain; |
| | | int identified; |
| | | int not_cursed; |
| float diff; | | float diff; |
| float ratio; | | float ratio; |
| | | |
| no_bargain = flag & F_NO_BARGAIN; | | no_bargain = flag & F_NO_BARGAIN; |
| flag &= ~F_NO_BARGAIN; | | identified = flag & F_IDENTIFIED; |
| | | not_cursed = flag & F_NOT_CURSED; |
| | | flag &= ~(F_NO_BARGAIN|F_IDENTIFIED|F_NOT_CURSED); |
| | | |
| if (tmp->type==MONEY) return (tmp->nrof * tmp->value); | | if (tmp->type==MONEY) return (tmp->nrof * tmp->value); |
| if (tmp->type==GEM) { | | if (tmp->type==GEM) { |
| | |
| } | | } |
| number = tmp->nrof; | | number = tmp->nrof; |
| if (number==0) number=1; | | if (number==0) number=1; |
| if (QUERY_FLAG(tmp, FLAG_IDENTIFIED) || !need_identify(tmp)) { | | if (QUERY_FLAG(tmp, FLAG_IDENTIFIED) || !need_identify(tmp) || identified) { |
| if (QUERY_FLAG(tmp, FLAG_CURSED) || QUERY_FLAG(tmp, FLAG_DAMNED)) | | if (!not_cursed && (QUERY_FLAG(tmp, FLAG_CURSED) || QUERY_FLAG(tmp, FLAG_DAMNED))) |
| return 0; | | return 0; |
| else | | else |
| val=tmp->value * number; | | val=tmp->value * number; |
| | |
| * default magical. This is because the archetype value should have | | * default magical. This is because the archetype value should have |
| * already figured in that value. | | * already figured in that value. |
| */ | | */ |
| if((QUERY_FLAG(tmp, FLAG_IDENTIFIED)||!need_identify(tmp)|| | | if((QUERY_FLAG(tmp, FLAG_IDENTIFIED)||!need_identify(tmp)||identified|| |
| QUERY_FLAG(tmp, FLAG_BEEN_APPLIED)) && | | QUERY_FLAG(tmp, FLAG_BEEN_APPLIED)) && |
| tmp->magic&&(tmp->arch==NULL||!tmp->arch->clone.magic)) { | | tmp->magic&&(tmp->arch==NULL||!tmp->arch->clone.magic)) { |
| if(tmp->magic>0) | | if(tmp->magic>0) |
| | |
| * charges. the treasure code already sets up the value | | * charges. the treasure code already sets up the value |
| * 50 charges is used as the baseline. | | * 50 charges is used as the baseline. |
| */ | | */ |
| if (QUERY_FLAG(tmp, FLAG_IDENTIFIED) || !need_identify(tmp)) | | if (QUERY_FLAG(tmp, FLAG_IDENTIFIED) || !need_identify(tmp) || identified) |
| val=(val*tmp->stats.food) / 50; | | val=(val*tmp->stats.food) / 50; |
| else /* if not identified, presume one charge */ | | else /* if not identified, presume one charge */ |
| val/=50; | | val/=50; |
| | |
| val=0; | | val=0; |
| | | |
| /* Unidentified stuff won't sell for more than 60gp */ | | /* Unidentified stuff won't sell for more than 60gp */ |
| if(flag==F_SELL && !QUERY_FLAG(tmp, FLAG_IDENTIFIED) && need_identify(tmp)) { | | if(flag==F_SELL && !QUERY_FLAG(tmp, FLAG_IDENTIFIED) && need_identify(tmp) && !identified) { |
| val = (val > 600)? 600:val; | | val = (val > 600)? 600:val; |
| } | | } |
| return val; | | return val; |