… | |
… | |
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 | # - Implement exchange() |
|
|
15 | # - Add a DM command to view any user's balance. |
15 | |
16 | |
16 | # The units are being used in each sub so they are declared globally. |
17 | # The units are being used in each sub so they are declared globally. |
17 | my %unit = ( |
18 | my %unit = ( |
18 | silver => 1, |
19 | silver => 1, |
19 | gold => 10, |
20 | gold => 10, |
… | |
… | |
104 | my @units = sort keys %unit; |
105 | my @units = sort keys %unit; |
105 | my $units = join ", ", @units; |
106 | my $units = join ", ", @units; |
106 | my $fees = - ($service_charge / 100) + 1; |
107 | my $fees = - ($service_charge / 100) + 1; |
107 | |
108 | |
108 | if ($cmd eq "balance") { |
109 | if ($cmd eq "balance") { |
109 | $who->message ("$name says: " . (balance $who), cf::NDI_WHITE); |
110 | $who->message ($ob->name." says: ".balance ($who), cf::NDI_WHITE); |
110 | |
111 | |
111 | } elsif ($cmd eq "deposit" and $currency) { |
112 | } elsif ($cmd eq "deposit" and $currency) { |
112 | $who->message ("$name says: " . (transaction $who, "deposit", $amount, $currency), cf::NDI_WHITE); |
113 | $who->message ("$name says: " . (transaction $who, "deposit", $amount, $currency), cf::NDI_WHITE); |
113 | $who->message ("$name says: " . (balance $who), cf::NDI_WHITE); |
114 | $who->message ("$name says: " . (balance $who), cf::NDI_WHITE); |
114 | |
115 | |
… | |
… | |
126 | $who->message ("$name says: Withdraw $amount of what: $units", cf::NDI_WHITE); |
127 | $who->message ("$name says: Withdraw $amount of what: $units", cf::NDI_WHITE); |
127 | |
128 | |
128 | } elsif ($cmd eq "withdraw" and $amount eq "" and $currency eq "") { |
129 | } elsif ($cmd eq "withdraw" and $amount eq "" and $currency eq "") { |
129 | $who->message ("$name says: How much do you want to withdraw?", cf::NDI_WHITE); |
130 | $who->message ("$name says: How much do you want to withdraw?", cf::NDI_WHITE); |
130 | |
131 | |
131 | } elsif ($cmd eq "help" or $cmd eq "yes") { |
132 | } elsif ($cmd eq "help" or $cmd eq "yes" and $arguments eq "") { |
132 | $who->message ("$name says: " . (help $arguments), cf::NDI_WHITE); |
133 | $who->message ("$name says: " . (help $arguments), cf::NDI_WHITE); |
|
|
134 | |
|
|
135 | } elsif ($cmd eq "help" or $cmd eq "yes" and $arguments ne "") { |
|
|
136 | $who->message ("$name says: " . (help), cf::NDI_WHITE); |
133 | |
137 | |
134 | } else { |
138 | } else { |
135 | $who->message ("$name says: Do you need help?", cf::NDI_WHITE); |
139 | $who->message ("$name says: Do you need help?", cf::NDI_WHITE); |
136 | } |
140 | } |
137 | } |
141 | } |