… | |
… | |
156 | ; |
156 | ; |
157 | |
157 | |
158 | sub give_back { |
158 | sub give_back { |
159 | my ($who, $what) = @_; |
159 | my ($who, $what) = @_; |
160 | $who->insert ($what); |
160 | $who->insert ($what); |
161 | $who->esrv_send_item ($what); |
|
|
162 | } |
161 | } |
163 | |
162 | |
164 | sub give_back_with_message { |
163 | sub give_back_with_message { |
165 | my ($who, $what, $msg) = @_; |
164 | my ($who, $what, $msg) = @_; |
166 | $who->message ($msg, cf::NDI_BROWN); |
165 | $who->message ($msg, cf::NDI_BROWN); |
… | |
… | |
220 | . "entry in the inventory item popup menu)." |
219 | . "entry in the inventory item popup menu)." |
221 | ); |
220 | ); |
222 | return cf::override; |
221 | return cf::override; |
223 | } |
222 | } |
224 | |
223 | |
|
|
224 | if ($value > 100 ** 4) { # also for overflow prevention |
|
|
225 | give_back_with_message ($who, $what, |
|
|
226 | "The shopkeeper says: You can't sell something for such a high " |
|
|
227 | . "value. Please keep it below 100 royalty."); |
|
|
228 | return cf::override; |
|
|
229 | } |
|
|
230 | |
225 | if ($value < 0) { |
231 | if ($value < 0) { |
226 | give_back_with_message ($who, $what, |
232 | give_back_with_message ($who, $what, |
227 | "The shopkeeper says: You can't sell something for a negative value: $value."); |
233 | "The shopkeeper says: You can't sell something for a negative value: $value."); |
228 | return cf::override; |
234 | return cf::override; |
229 | } |
235 | } |