diff options
| author | 2018-10-21 12:08:29 +0100 | |
|---|---|---|
| committer | 2018-10-21 12:08:29 +0100 | |
| commit | 4dbad92f3b6734799930237a5c2ca43329fc39bc (patch) | |
| tree | cb40b8f0db84c49db65b9401569e22a24ebbd82a /modules/coins.py | |
| parent | 'WALLET_DEFAULT' -> 'WALLET_DEFAULT_NAME' (diff) | |
| signature | ||
use default "interest" wallet for interest and default "lottery" wallet for
lottery winnings
Diffstat (limited to 'modules/coins.py')
| -rw-r--r-- | modules/coins.py | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/modules/coins.py b/modules/coins.py index ba288873..008e58b3 100644 --- a/modules/coins.py +++ b/modules/coins.py @@ -31,7 +31,8 @@ THIRD_COLUMN = list(range(1, 37))[2::3] REGEX_STREET = re.compile("street([1-9]|1[0-2])$") WALLET_DEFAULT_NAME = "default" -WALLET_DEFAULTS = {"in": WALLET_DEFAULT_NAME, "out": WALLET_DEFAULT_NAME} +WALLET_DEFAULTS = {"in": WALLET_DEFAULT_NAME, "out": WALLET_DEFAULT_NAME + "interest": WALLET_DEFAULT_NAME, "lottery": WALLET_DEFAULT_NAME} class CoinParseException(Exception): pass @@ -618,9 +619,11 @@ class Module(ModuleManager.BaseModule): self._take_from_pool(server, interest) wallets = server.get_user_setting(nickname, "wallets", {}) - default_coins = wallets.get(WALLET_DEFAULT_NAME, "0.0") + default_wallet = self._default_wallet_for( + server.get_user(nickname), "interest") + default_coins = wallets.get(default_wallet, "0.0") default_coins = decimal.Decimal(default_coins) - wallets[WALLET_DEFAULT_NAME] = self._coin_str( + wallets[default_wallet] = self._coin_str( default_coins+interest) server.set_user_setting(nickname, "wallets", wallets) event["timer"].redo() @@ -720,8 +723,9 @@ class Module(ModuleManager.BaseModule): coins = self._get_user_coins(user) winnings = decimal.Decimal(LOTTERY_BUYIN)*len(users) new_coins = coins+winnings + wallet = self._default_wallet_for(user, "lottery") - self._give(server, user, winnings) + self._give(server, user, winnings, wallet) server.set_setting("lottery-winner", user.nickname) user.send_notice("You won %s in the lottery! you now have %s coins" % (self._coin_str(winnings), self._coin_str(new_coins))) |
