예제 #1
0
파일: tests.py 프로젝트: TomyRO/wouso
 def testUpdatePoints(self):
     Coin.add('points')
     Coin.add('gold')
     Formula.objects.create(id='level-gold', formula='gold=10*{level}', owner=None)
     player = self._get_player()
     player.points = 82
     player.level_no = 1
     player.save()
     update_points(player, None)
     coins = History.user_coins(player.user)
     self.assertIn('gold', coins)
     self.assertEqual(coins['gold'], 20)
     player.points = 10
     player.save()
     update_points(player, None)
     coins = History.user_coins(player.user)
     self.assertIn('gold', coins)
     self.assertEqual(coins['gold'], 0)
예제 #2
0
파일: tests.py 프로젝트: andreip/wouso
 def testUpdatePoints(self):
     Coin.add("points")
     Coin.add("gold")
     Formula.objects.create(id="level-gold", formula="gold=10*{level}", owner=None)
     player = self._get_player()
     player.points = 420
     player.level_no = 1
     player.save()
     update_points(player, None)
     coins = History.user_coins(player.user)
     self.assertIn("gold", coins)
     self.assertEqual(coins["gold"], 60)
예제 #3
0
 def coins(self):
     # TODO check usage and deprecate this function
     from wouso.core.scoring.models import History
     return History.user_coins(self.user)
예제 #4
0
 def inf(self):
     return History.user_coins(user=self)['penalty']
예제 #5
0
파일: sm.py 프로젝트: andreip/wouso
def user_coins(user):
    """ Returns a dictionary with user coins """
    if not isinstance(user, User):
        user = user.user
    return History.user_coins(user)
예제 #6
0
def gold_amount(player):
    """
     Return player's amount of gold
    """
    coins = History.user_coins(player)
    return coins['gold']
예제 #7
0
 def test_user_coins(self):
     Coin.add('points')
     Coin.add('gold')
     player = self._get_player()
     self.assertIn('points', History.user_coins(player.user))
예제 #8
0
파일: sm.py 프로젝트: damianr13/wouso
def user_coins(user):
    """ Returns a dictionary with user coins """
    if not isinstance(user, User):
        user = user.user
    return History.user_coins(user)
예제 #9
0
def gold_amount(player):
    """
     Return player's amount of gold
    """
    coins = History.user_coins(player)
    return coins['gold']
예제 #10
0
파일: models.py 프로젝트: vladeugeniu/wouso
 def coins(self):
     # TODO check usage and deprecate this function
     from wouso.core.scoring.models import History
     return History.user_coins(self.user)
예제 #11
0
파일: tests.py 프로젝트: TomyRO/wouso
 def test_user_coins(self):
     Coin.add('points')
     Coin.add('gold')
     player = self._get_player()
     self.assertIn('points', History.user_coins(player.user))
예제 #12
0
 def inf(self):
     return History.user_coins(user=self)['penalty']
예제 #13
0
파일: tests.py 프로젝트: andreip/wouso
 def test_user_coins(self):
     Coin.add("points")
     Coin.add("gold")
     player = self._get_player()
     self.assertIn("points", History.user_coins(player.user))