2 Created by: Joris Bontje <jbontje@suespammers.org>
4 This module stores bank account information.
14 self.
bankdb_file = os.path.join(Crossfire.LocalDirectory(), bankfile)
20 def __exit__(self, exc_type, exc_value, traceback):
24 if not user
in self.
bankdb:
27 balance = self.
bankdb[user]
28 self.
bankdb[user] = balance + amount
34 self.
bankdb[user] = balance - amount
48 Crossfire.Log(Crossfire.LogDebug,
49 "%s's bank account removed." % user)
58 """Move a player's balance from the player file to the bank."""
59 player = Crossfire.FindPlayer(name)
64 Crossfire.Log(Crossfire.LogInfo,
65 "Converting bank account for %s with %d silver" \
66 % (name, old_balance))
68 player.WriteKey(
"balance",
"moved-to-bank-file", 1)
71 return CFBank(
'ImperialBank_DB')
74 """Return the balance of the given player's bank account."""
76 balance_str = player.ReadKey(
"balance")
77 return int(balance_str)