ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/maps/perl/bank.ext
(Generate patch)

Comparing deliantra/maps/perl/bank.ext (file contents):
Revision 1.4 by pippijn, Mon May 22 17:57:55 2006 UTC vs.
Revision 1.5 by pippijn, Mon May 22 18:33:24 2006 UTC

9# - exchange, will exchange between imperials and platinum coins 9# - exchange, will exchange between imperials and platinum coins
10# - balance, simply shows how much money one has on his/her account. 10# - balance, simply shows how much money one has on his/her account.
11# 11#
12# TODO: 12# TODO:
13# - Comment more steps 13# - Comment more steps
14# - Implement exchange()
14 15
15# The units are being used in each sub so they are declared globally. 16# The units are being used in each sub so they are declared globally.
16my %unit = ( 17my %unit = (
17 silver => 1, 18 silver => 1,
18 gold => 10, 19 gold => 10,
54 my ($who, $action, $amount, $currency) = @_; 55 my ($who, $action, $amount, $currency) = @_;
55 my $pay = $amount * $unit{$currency}; 56 my $pay = $amount * $unit{$currency};
56 57
57 if (!$unit{$currency}) { 58 if (!$unit{$currency}) {
58 return "We don't trade in that currency."; 59 return "We don't trade in that currency.";
60 }
61
62 if ($amount !=~ /\d+/) {
63 return "You can not $action fractions.";
59 } 64 }
60 65
61 # First check for possible overflow and user stupidity 66 # First check for possible overflow and user stupidity
62 if ($amount > 10000) { 67 if ($amount > 10000) {
63 return "Sorry, we do not handle more than 10000 units for one ".$action."."; 68 return "Sorry, we do not handle more than 10000 units for one ".$action.".";

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines