Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from datetime import datetime
- from sqlalchemy import Column, Integer, DateTime, String
- from app.util import Table
- from app.models import Base, Default
- class SpecialStage(Base, Default):
- __tablename__ = 'special_stages'
- id = Column(Integer, primary_key=True)
- uid = Column(Integer)
- type = Column(String)
- next_at = Column(DateTime)
- def __init__(self, **kwargs):
- Base.__init__(self, **kwargs)
- next_at = datetime.utcnow() + datetime(seconds=Table['StageSpecial']['ReAppearCondValue_Clear']['Value'])
- def win(self, at):
- self.next_at = at + datetime(seconds=Table['StageSpecial']['ReAppearCondValue_Clear']['Value'])
- def lose(self, at):
- self.next_at = at + datetime(seconds=Table['StageSpecial']['ReAppearCondValue_Fail']['Value'])
- def to_dto(self, user):
- dto = SpecialStageDto()
- desc = list(filter(lambda x: x['AppearStageIndexMin'] < user.stage, Table['StageSpecial'].values()))
- desc = sorted(desc, key=lambda x: x['AppearStageIndexMin'])
- desc = data[-1]
- dto.desc_id = desc['id']
- return dto
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement