示例#1
0
文件: views.py 项目: narcisaam/wouso
def customization_set_levels(request):
    new_level_limits = request.GET.get('new_level_limits', '')
    IntegerListSetting.get('level_limits').set_value(new_level_limits)

    redir = request.META.get('HTTP_REFERER', reverse('customization_levels'))

    return redirect(redir)
示例#2
0
文件: views.py 项目: Ionut1994/wouso
def customization_set_levels(request):
    new_level_limits = request.GET.get('new_level_limits', '')
    IntegerListSetting.get('level_limits').set_value(new_level_limits)

    redir = request.META.get('HTTP_REFERER', reverse('customization_levels'))

    return redirect(redir)
示例#3
0
    def test_get_level_limit(self):
        IntegerListSetting.get('level_limits').set_value(
            "80 125 180 245 320 450")
        god = get_god()

        self.assertEqual(god.get_level_for_points(0), 1)
        self.assertNotEqual(god.get_level_for_points(10000), 1)
示例#4
0
文件: tests.py 项目: PopAdi/wouso
 def test_update_points_level_upgrade_first_time(self):
     level_up_points = 80
     IntegerListSetting.get('level_limits').set_value(str(level_up_points))
     Coin.add('points')
     Coin.add('gold')
     Formula.add('level-gold', expression='gold=10*{level}', owner=None)
     # Upgrade player's level
     player = self._get_player()
     player.points = level_up_points + 1
     player.level_no = 1
     player.save()
     update_points(player, None)
     coins = History.user_coins(player.user)
     self.assertEqual(coins['gold'], 10 * player.max_level)
示例#5
0
 def test_update_points_level_upgrade_first_time(self):
     level_up_points = 80
     IntegerListSetting.get('level_limits').set_value(str(level_up_points))
     Coin.add('points')
     Coin.add('gold')
     Formula.add('level-gold', expression='gold=10*{level}', owner=None)
     # Upgrade player's level
     player = self._get_player()
     player.points = level_up_points + 1
     player.level_no = 1
     player.save()
     update_points(player, None)
     coins = History.user_coins(player.user)
     self.assertEqual(coins['gold'], 10 * player.max_level)
示例#6
0
文件: views.py 项目: Ionut1994/wouso
    def get_context_data(self, **kwargs):
        context = super(CustomizationLevelsView, self).get_context_data(**kwargs)

        level_limits = IntegerListSetting.get('level_limits').get_value()
        context['maximum_level'] = 1 + len(level_limits)
        context['level_limits'] = level_limits

        return context
示例#7
0
文件: views.py 项目: narcisaam/wouso
    def get_context_data(self, **kwargs):
        context = super(CustomizationLevelsView, self).get_context_data(**kwargs)

        level_limits = IntegerListSetting.get('level_limits').get_value()
        context['maximum_level'] = 1 + len(level_limits)
        context['level_limits'] = level_limits

        return context
示例#8
0
文件: tests.py 项目: Sendroiu/wouso
    def testUpdatePoints(self):
        IntegerListSetting.get('level_limits').set_value("80 125 180 245 320 450")

        Coin.add('points')
        Coin.add('gold')
        Formula.add('level-gold', expression='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)
示例#9
0
文件: tests.py 项目: hcxiong/wouso
    def testUpdatePoints(self):
        IntegerListSetting.get('level_limits').set_value(
            "80 125 180 245 320 450")

        Coin.add('points')
        Coin.add('gold')
        Formula.add('level-gold', expression='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)
示例#10
0
文件: god.py 项目: MathPlayer/wouso
 def get_level_limits(self):
     return IntegerListSetting.get('level_limits').get_value()
示例#11
0
文件: god.py 项目: ArmandNM/wouso
 def get_level_limits(self):
     return IntegerListSetting.get('level_limits').get_value()
示例#12
0
文件: tests.py 项目: Sendroiu/wouso
    def test_get_level_limit(self):
        IntegerListSetting.get('level_limits').set_value("80 125 180 245 320 450")
        god = get_god()

        self.assertEqual(god.get_level_for_points(0), 1)
        self.assertNotEqual(god.get_level_for_points(10000), 1)