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.20 by root, Wed Jul 19 08:52:57 2006 UTC vs.
Revision 1.21 by root, Wed Jul 19 22:20:07 2006 UTC

140 } 140 }
141 return $exchange_rates."This may change a bit with the stock markets but don't expect it to be much."; 141 return $exchange_rates."This may change a bit with the stock markets but don't expect it to be much.";
142 } 142 }
143} 143}
144 144
145sub on_say { 145cf::register_script_function "bank::command" => sub {
146 my ($event, $ob, $who, $msg) = @_; 146 my ($who, $msg, $npc) = @_;
147
147 my ($cmd, $arguments) = split /\s+/, $msg, 2; 148 my ($cmd, $arguments) = split /\s+/, $msg, 2;
148 my ($amount, $currency) = split /\s+/, $arguments, 2; 149 my ($amount, $currency) = split /\s+/, $arguments, 2;
149 my $name = $ob->name;
150 my $service_charge = 5; 150 my $service_charge = 5;
151 my @units = sort keys %unit; 151 my @units = sort keys %unit;
152 my $units = join ", ", @units; 152 my $units = join ", ", @units;
153 my $fees = - ($service_charge / 100) + 1; 153 my $fees = - ($service_charge / 100) + 1;
154 154
160 } 160 }
161 161
162 if ($cmd eq "balance") { 162 if ($cmd eq "balance") {
163 if ($who->flag (cf::FLAG_WIZ)) { 163 if ($who->flag (cf::FLAG_WIZ)) {
164 if (my $player = cf::player::find $arguments) { 164 if (my $player = cf::player::find $arguments) {
165 $who->reply ("$name says: " . balance ($player->ob, 1)); 165 $who->reply ($npc, balance $player->ob, 1);
166 } 166 }
167 } else { 167 } else {
168 $who->reply ("$name says: " . balance ($who, 0)); 168 $who->reply ($npc, balance $who, 0);
169 } 169 }
170 170
171 } elsif ($cmd eq "balance" and !$arguments) { 171 } elsif ($cmd eq "balance" and !$arguments) {
172 $who->reply ("$name says: Balance of whom?"); 172 $who->reply ($npc, "Balance of whom?");
173 173
174 } elsif ($cmd eq "deposit" and $currency) { 174 } elsif ($cmd eq "deposit" and $currency) {
175 $who->reply ("$name says: " . (transaction $who, "deposit", $amount, $currency)); 175 $who->reply ($npc, transaction $who, "deposit", $amount, $currency);
176 $who->reply ("$name says: " . (balance $who)); 176 $who->reply ($npc, balance $who);
177 177
178 } elsif ($cmd eq "deposit" and $amount and $currency eq "") { 178 } elsif ($cmd eq "deposit" and $amount and $currency eq "") {
179 $who->reply ("$name says: Deposit $amount of what: $units"); 179 $who->reply ($npc, "deposit $amount of what: $units");
180 180
181 } elsif ($cmd eq "deposit" and $amount eq "" and $currency eq "") { 181 } elsif ($cmd eq "deposit" and $amount eq "" and $currency eq "") {
182 $who->reply ("$name says: How much do you want to deposit?"); 182 $who->reply ($npc, "How much do you want to deposit?");
183 183
184 } elsif ($cmd eq "withdraw" and $currency) { 184 } elsif ($cmd eq "withdraw" and $currency) {
185 $who->reply ("$name says: " . (transaction $who, "withdraw", $amount, $currency)); 185 $who->reply ($npc, transaction $who, "withdraw", $amount, $currency);
186 $who->reply ("$name says: " . (balance $who)); 186 $who->reply ($npc, balance $who);
187 187
188 } elsif ($cmd eq "withdraw" and $amount and $currency eq "") { 188 } elsif ($cmd eq "withdraw" and $amount and $currency eq "") {
189 $who->reply ("$name says: Withdraw $amount of what: $units"); 189 $who->reply ($npc, "Withdraw $amount of what: $units");
190 190
191 } elsif ($cmd eq "withdraw" and $amount eq "" and $currency eq "") { 191 } elsif ($cmd eq "withdraw" and $amount eq "" and $currency eq "") {
192 $who->reply ("$name says: How much do you want to withdraw?"); 192 $who->reply ($npc, "How much do you want to withdraw?");
193 193
194 } elsif ($cmd eq "exchange") { 194 } elsif ($cmd eq "exchange") {
195 $who->reply ("$name says: This function is not yet implemented. Ask me again later."); 195 $who->reply ($npc, "This function is not yet implemented. Ask me again later.");
196 196
197 } elsif ($cmd eq "help" or $cmd eq "yes" and $arguments eq "") { 197 } elsif ($cmd eq "help" or $cmd eq "yes" and $arguments eq "") {
198 $who->reply ("$name says: " . (help $arguments)); 198 $who->reply ($npc, help $arguments);
199 199
200 } elsif ($cmd eq "help" or $cmd eq "yes" and $arguments ne "") { 200 } elsif ($cmd eq "help" or $cmd eq "yes" and $arguments ne "") {
201 $who->reply ("$name says: " . (help)); 201 $who->reply ($npc, help);
202 202
203 } else { 203 } else {
204 $who->reply ("$name says: Do you need help?"); 204 $who->reply ($npc, "Do you need help?");
205 } 205 }
206} 206}
207 207

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines