def payTrainer(): #for each user for user in User.select(): #print 'im at least here' if user.fighter.trainer == None: return else: #if user has more money than trainer salary if user.money > user.fighter.trainer.salary: #deduct the trainer salary from user money user.money -= user.fighter.trainer.salary notfire = Feed(owner=user.user_name, msg = 'Payed trainer $%d.' %user.fighter.trainer.salary, category = 'Other', time = datetime.now()) #otherwise else: #change trainer back to default trainer user.fighter.trainer = None user.fighter.trainer_points = 0 user.fighter.trainer_strength = 0 user.fighter.trainer_speed = 0 user.fighter.trainer_defence = 0 user.fighter.trainer_conditioning = 0 #generate feed message fire = Feed(owner=user.user_name, msg = 'You don\'t have enough money to pay your trainer\'s salary, your trainer quit!', category = 'Other', time = datetime.now()) model.hub.commit() return
def perDiem(): users = User.select() for user in users: payment = (user.fighter.level*100) user.money += payment Feed(owner=user.user_name, msg = "Earned $%d from sponsors." %payment, category='Other', time = datetime.now()) model.hub.commit() return