当前位置: 首页>>代码示例>>Python>>正文


Python God.get_head_start_date方法代码示例

本文整理汇总了Python中wouso.core.god.God.get_head_start_date方法的典型用法代码示例。如果您正苦于以下问题:Python God.get_head_start_date方法的具体用法?Python God.get_head_start_date怎么用?Python God.get_head_start_date使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在wouso.core.god.God的用法示例。


在下文中一共展示了God.get_head_start_date方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: activity_handler

# 需要导入模块: from wouso.core.god import God [as 别名]
# 或者: from wouso.core.god.God import get_head_start_date [as 别名]

#.........这里部分代码省略.........
                    cls.earn_achievement(player, 'ach-chall-10-a-day')

        if action == 'chall-won':
            # Check for flawless victory
            if get_chall_score(kwargs.get("arguments")) == 500:
                if not player.magic.has_modifier('ach-flawless-victory'):
                    cls.earn_achievement(player, 'ach-flawless-victory')
            # Check 10 won challenge games in a row
            if not player.magic.has_modifier('ach-chall-won-10'):
                if consecutive_chall_won(player) >= 10:
                    cls.earn_achievement(player, 'ach-chall-won-10')

            # Check if player defeated 2 levels or more bigger opponent
            if not player.magic.has_modifier('ach-chall-def-big'):
                if (kwargs.get('user_to').level_no - player.level_no) >= 2:
                    Activity.objects.create(timestamp=datetime.now(),
                                            user_from=player, user_to=player,
                                            action='defeat-better-player')
                    victories = Activity.objects.filter(user_to=player,
                                                        action='defeat-better-player')
                    if victories.count() >= 5:
                        cls.earn_achievement(player, 'ach-chall-def-big')
                        victories.delete()

            # Check if the player finished the challenge in less than 1 minute
            if not player.magic.has_modifier('ach-win-fast'):
                seconds_no = get_challenge_time(kwargs.get("arguments"))
                if seconds_no > 0 and seconds_no <= 60:
                    cls.earn_achievement(player, 'ach-win-fast')

        if action == 'message':
            # Check the number of unique users who send pm to player in the last m minutes
            if unique_users_pm(kwargs.get('user_to'), 15) >= 5:
                if not kwargs.get('user_to').magic.has_modifier('ach-popularity'):
                    cls.earn_achievement(kwargs.get('user_to'), 'ach-popularity')

        if action in ("login", "seen"):
            # Check login between 2-4 am
            if login_between_count(player, 3, 5) > 2:
                if not player.magic.has_modifier('ach-night-owl'):
                    cls.earn_achievement(player, 'ach-night-owl')
            if login_between_count(player, 6, 8) > 2:
                if not player.magic.has_modifier('ach-early-bird'):
                    cls.earn_achievement(player, 'ach-early-bird')

            if not player.magic.has_modifier('ach-god-mode-on'):
                if check_for_god_mode(player, 5, 5):
                    cls.earn_achievement(player, 'ach-god-mode-on')
            # Check previous 10 seens
            if consecutive_days_seen(player, datetime.now()) >= 14:
                if not player.magic.has_modifier('ach-login-10'):
                    cls.earn_achievement(player, 'ach-login-10')

        if action == 'cast':
            # Check if player is affected by 5 or more spells
            if not player.magic.has_modifier('ach-spell-5'):
                if spell_count(player) >= 5:
                    cls.earn_achievement(player, 'ach-spell-5')

            # Check if player used all non-mass spells
            if not player.magic.has_modifier('ach-use-all-spells'):
                if used_all_spells(player, False):
                    cls.earn_achievement(player, 'ach-use-all-spells')

            # Check if player used all mass spells
            if not player.magic.has_modifier('ach-use-all-mass'):
                if used_all_spells(player, True):
                    cls.earn_achievement(player, 'ach-use-all-mass')

        if 'buy' in action:
            # Check if player spent 500 gold on spells
            if not player.magic.has_modifier('ach-spent-gold'):
                if spent_gold(player) >= 500:
                    cls.earn_achievement(player, 'ach-spent-gold')

        if action == 'gold-won':
            # Check if player reached level 5
            if not player.magic.has_modifier('ach-level-5'):
                if player.level_no >= 5:
                    cls.earn_achievement(player, 'ach-level-5')
            # Check if player reached level 10
            if not player.magic.has_modifier('ach-level-10'):
                if player.level_no >= 10:
                    cls.earn_achievement(player, 'ach-level-10')

        if 'gold' in action:
            # Check if player has 300 gold
            if not player.magic.has_modifier('ach-gold-300'):
                if gold_amount(player) >= 300:
                    cls.earn_achievement(player, 'ach-gold-300')

        if 'login' in action:
            # Check if player got a head start login
            if not player.magic.has_modifier('ach-head-start'):
                # (player, start_hour, start_day, start_month, hour_offset)
                # server start date: hour, day, month
                # hour_offset = offset from start date when player will be rewarded
                head_start_date = God.get_head_start_date()
                if login_at_start(player, start_day=head_start_date.day, start_month=head_start_date.month):
                    cls.earn_achievement(player, 'ach-head-start')
开发者ID:gabrielivascu,项目名称:wouso,代码行数:104,代码来源:achievements.py


注:本文中的wouso.core.god.God.get_head_start_date方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。