--- deliantra/maps/perl/bank.ext 2006/05/22 18:54:12 1.8 +++ deliantra/maps/perl/bank.ext 2006/05/22 19:09:36 1.9 @@ -96,6 +96,42 @@ } } +sub help { + my ($command) = @_; + + if ($command eq "") { + return "You can: + deposit + withdraw + balance + exchange + help "; + } elsif ($command eq "deposit") { + return "You can deposit some of the money you don't currently use in our bank. To do this, ask me to: + deposit \nSee help exchange for our currencies."; + } elsif ($command eq "withdraw") { + return "To get the money you stored in our system back, just say: + withdraw "; + } elsif ($command eq "balance") { + return "I can tell you how much money you are saving in our bank, just ask me about your balance."; + } elsif ($command eq "exchange") { + return "We exchange between imperial notes and platinum coins at a very low price. To change from platinum to imperials, say: + exchange platina\nTo change from imperials to platinum, say: + exchange imperial\nWe currently only exchange between these two currencies. If you want to know more about exchange rates, ask me: + help exchange rates\nThanks for using our bank."; + } elsif ($command eq "exchange rates") { + my @units = sort { $unit{$b} <=> $unit{$a} } keys %unit; + my $exchange_rates = "Here is a list of exchange rates:\n"; + + for my $from_cur_nr (0 .. $#units) { + for my $to_cur_nr ($from_cur_nr+1 .. $#units) { + $exchange_rates = $exchange_rates."One $units[$from_cur_nr] is ".calc_exchange_rate(1, $units[$from_cur_nr], $units[$to_cur_nr])." $units[$to_cur_nr]\n"; + } + } + return $exchange_rates."This may change a bit with the stock markets but don't expect it to be much."; + } +} + sub on_say { my ($event, $ob, $who, $msg) = @_; my ($cmd, $arguments) = split /\s+/, $msg, 2; @@ -107,7 +143,12 @@ my $fees = - ($service_charge / 100) + 1; if ($cmd eq "balance") { - $who->message ("$name says: ".balance ($who), cf::NDI_WHITE); + if ($who->flag (cf::FLAG_WIZ)) { + my $player = cf::player::find $who->name; + #$who->message ("$name says: ".balance ($player), cf::NDI_WHITE); + #} else { + $who->message ("$name says: ".balance ($who), cf::NDI_WHITE); + } } elsif ($cmd eq "deposit" and $currency) { $who->message ("$name says: " . (transaction $who, "deposit", $amount, $currency), cf::NDI_WHITE); @@ -140,38 +181,3 @@ } } -sub help { - my ($command) = @_; - - if ($command eq "") { - return "You can: - deposit - withdraw - balance - exchange - help "; - } elsif ($command eq "deposit") { - return "You can deposit some of the money you don't currently use in our bank. To do this, ask me to: - deposit \nSee help exchange for our currencies."; - } elsif ($command eq "withdraw") { - return "To get the money you stored in our system back, just say: - withdraw "; - } elsif ($command eq "balance") { - return "I can tell you how much money you are saving in our bank, just ask me about your balance."; - } elsif ($command eq "exchange") { - return "We exchange between imperial notes and platinum coins at a very low price. To change from platinum to imperials, say: - exchange platina\nTo change from imperials to platinum, say: - exchange imperial\nWe currently only exchange between these two currencies. If you want to know more about exchange rates, ask me: - help exchange rates\nThanks for using our bank."; - } elsif ($command eq "exchange rates") { - my @units = sort { $unit{$b} <=> $unit{$a} } keys %unit; - my $exchange_rates = "Here is a list of exchange rates:\n"; - - for my $from_cur_nr (0 .. $#units) { - for my $to_cur_nr ($from_cur_nr+1 .. $#units) { - $exchange_rates = $exchange_rates."One $units[$from_cur_nr] is ".calc_exchange_rate(1, $units[$from_cur_nr], $units[$to_cur_nr])." $units[$to_cur_nr]\n"; - } - } - return $exchange_rates."This may change a bit with the stock markets but don't expect it to be much."; - } -}