Offload trivial commands to their separate functions.

git-svn-id: svn://svn.code.sf.net/p/crossfire/code/maps/trunk@18857 282e977c-c81d-0410-88c4-b93c2d0d6712
master
partmedia 2013-08-03 00:25:47 +00:00
parent 75a5fcd61c
commit 342ac2430a
1 changed files with 23 additions and 7 deletions

View File

@ -212,7 +212,7 @@ def depositBoxClose():
# ----------------------------------------------------------------------------
# Print a help message for the player.
def printHelp():
def cmd_help():
message = "You can check your 'balance', 'deposit' or 'withdraw' money, 'exchange' your currency, 'cash' a check, 'transfer' funds, buy 'checks', or find out how much 'profits' this bank has made.\n\nAll transactions are in imperial notes (1 note = 1000 gold). A service charge of %d percent will be placed on all deposits." % service_charge
if activator.DungeonMaster:
@ -220,6 +220,25 @@ def printHelp():
whoami.Say(message)
# ----------------------------------------------------------------------------
# Show the profits made by the bank.
def cmd_show_profits():
message = "To date, the Imperial Bank of Skud has made %s " \
"pounds sterling in profit." % \
str(bank.getbalance(Skuds))
whoami.Say(message)
# ----------------------------------------------------------------------------
# Erase the profits made by the bank.
def cmd_zero_balance():
if activator.DungeonMaster:
bank.withdraw(Skuds, bank.getbalance(Skuds))
message = "Profits erased!"
else:
message = "Only the dungeon master can wipe our profits!"
whoami.Say(message)
# ----------------------------------------------------------------------------
# Script execution begins here.
@ -236,14 +255,11 @@ else:
message = ""
if text[0] == 'help' or text[0] == 'yes':
printHelp()
cmd_help()
elif text[0] == 'zero-balance':
bank.withdraw(Skuds, bank.getbalance(Skuds))
message = 'Balance zeroed.'
cmd_zero_balance()
elif text[0] == 'profits':
message = 'The Imperial Bank of Skud has made ' \
+ str(bank.getbalance(Skuds) * 0.029394968) \
+ ' pounds sterling in profit to date.'
cmd_show_profits()
elif text[0] == 'deposit':
if len(text) == 2: