示例#1
0
def checkForSensei():
    username = Sensei.username
    exists = yield Penguin.exists(where=['username = ?', username])

    if not exists:
        sensei = Penguin(username=username,
                         nickname="Sensei",
                         password='',
                         email='*****@*****.**',
                         coins=1000,
                         igloos='',
                         urnitures='',
                         floors='',
                         locations='',
                         care='',
                         stamps='',
                         cover='')

        yield sensei.save()
        yield sensei.refresh()

        SenseiNinja = Ninja(
            penguin_id=sensei.id,
            belt=10,
            cards=
            '427,99|749,99|591,99|724,99|90,99|259,99|574,99|736,99|257,99|580,99|83,99|97,99|748,99|76,99|252,99|355,99|590,99|593,99|734,99|260,99|739,99',
            matches='')
        yield SenseiNinja.save()

    logger.debug('Sensei has been born!')
示例#2
0
    def setupAI(self):
        AIExists = yield Penguin.exists(['`Username` = ?', self.AI_username])

        if not AIExists:
            yield self.createAI()

        if self.AI is None:
            self.AI = yield Penguin.find(
                where=['Username = ?', self.AI_username], limit=1)