示例#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
 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))