diff options
Diffstat (limited to 'models')
-rw-r--r-- | models/inventory.py | 12 | ||||
-rw-r--r-- | models/item.py | 11 | ||||
-rw-r--r-- | models/level.py | 9 | ||||
-rw-r--r-- | models/models.py | 0 | ||||
-rw-r--r-- | models/user.py | 8 |
5 files changed, 34 insertions, 6 deletions
diff --git a/models/inventory.py b/models/inventory.py new file mode 100644 index 0000000..90f4cba --- /dev/null +++ b/models/inventory.py @@ -0,0 +1,12 @@ +from peewee import IntegerField, ForeignKeyField + +from base import BaseModel +from models.user import User +from models.item import Item + + +class Inventory(BaseModel): + + user = ForeignKeyField(User) + item = ForeignKeyField(Item) + stock = IntegerField(default=0) diff --git a/models/item.py b/models/item.py new file mode 100644 index 0000000..194b69c --- /dev/null +++ b/models/item.py @@ -0,0 +1,11 @@ +from peewee import TextField, IntegerField + +from base import BaseModel + + +class Item(BaseModel): + + name = TextField() + price = IntegerField() + text = TextField() + reward_rank = TextField(null=True) diff --git a/models/level.py b/models/level.py new file mode 100644 index 0000000..2dc61d9 --- /dev/null +++ b/models/level.py @@ -0,0 +1,9 @@ +from peewee import IntegerField, BigIntegerField + +from base import BaseModel + + +class Level(BaseModel): + level = IntegerField(primary_key=True) + exp_required = BigIntegerField() + reward_currency = IntegerField(null=True) diff --git a/models/models.py b/models/models.py new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/models/models.py diff --git a/models/user.py b/models/user.py index dcf35ab..c38135d 100644 --- a/models/user.py +++ b/models/user.py @@ -1,6 +1,5 @@ from peewee import TextField, IntegerField, DateTimeField import datetime -import random from base import BaseModel @@ -15,14 +14,11 @@ class User(BaseModel): currency = IntegerField() message_count = IntegerField() joined_date = DateTimeField(default=datetime.datetime.now) + exp_gained_time = DateTimeField(default=datetime.datetime.now) + daily_gained_time = DateTimeField(default=datetime.datetime.now) def add_coins(self, additional_coins: int): self.currency = self.currency + additional_coins def remove_coins(self, lost_coins: int): self.currency = self.currency - lost_coins - - def add_message(self): - self.message_count += 1 - gained_exp = random.randrange(10, 15) - self.exp += gained_exp |