2 Created by: Joris Bontje <jbontje@suespammers.org>
4 This module stores bank account information.
15 self.
bankdb.execute(
"CREATE TABLE IF NOT EXISTS bank_accounts ('name' TEXT PRIMARY KEY, 'balance' INT);")
20 def __exit__(self, exc_type, exc_value, traceback):
24 self.
bankdb.execute(
"INSERT OR IGNORE INTO bank_accounts VALUES (?, 0)", (user,))
29 self.
bankdb.execute(
"UPDATE bank_accounts SET balance = balance + ? WHERE name=?", (amount, user))
35 self.
bankdb.execute(
"UPDATE bank_accounts SET balance = balance - ? WHERE name=?", (amount, user))
41 c.execute(
"SELECT balance FROM bank_accounts WHERE name=?", (user,))
43 if result
is not None:
49 c.execute(
"DELETE FROM bank_accounts WHERE name=?", (user,))
56 """Move a player's balance from the player file to the bank."""
57 player = Crossfire.FindPlayer(name)
60 balance_str = player.ReadKey(
"balance")
62 old_balance =
int(balance_str)
63 Crossfire.Log(Crossfire.LogInfo,
"Converting bank account for %s with %d silver" % (name, old_balance))
67 player.WriteKey(
"balance",
None, 0)