… | |
… | |
163 | } |
163 | } |
164 | } else { |
164 | } else { |
165 | $value = $what->query_cost ($who, cf::F_SELL | cf::F_SHOP) / ($what->nrof || 1); |
165 | $value = $what->query_cost ($who, cf::F_SELL | cf::F_SHOP) / ($what->nrof || 1); |
166 | } |
166 | } |
167 | |
167 | |
|
|
168 | if ($value < 0) { |
|
|
169 | $what->insert_ob_in_ob ($who); |
|
|
170 | $who->message ("The shopkeeper says: You can't sell something for a negative value: $value", cf::NDI_BROWN); |
|
|
171 | return 1; |
|
|
172 | } |
|
|
173 | |
168 | my $fee = $value / 100; # 1% selling fee |
174 | my $fee = $value / 100; # 1% selling fee |
169 | |
175 | |
170 | unless ($who->pay_amount ($fee)) { |
176 | unless ($who->pay_amount ($fee)) { |
171 | $who->message ( |
177 | $who->message ( |
172 | "The shopkeeper says: You need " . cf::cost_string_from_value ($fee) . " to pay the 1% fee for this item", |
178 | "The shopkeeper says: You need " . cf::cost_string_from_value ($fee) . " to pay the 1% fee for this item", |