當前位置: 首頁>>代碼示例>>Python>>正文


Python ClanPrototype.get_by_id方法代碼示例

本文整理匯總了Python中the_tale.accounts.clans.prototypes.ClanPrototype.get_by_id方法的典型用法代碼示例。如果您正苦於以下問題:Python ClanPrototype.get_by_id方法的具體用法?Python ClanPrototype.get_by_id怎麽用?Python ClanPrototype.get_by_id使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在the_tale.accounts.clans.prototypes.ClanPrototype的用法示例。


在下文中一共展示了ClanPrototype.get_by_id方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: pvp_page

# 需要導入模塊: from the_tale.accounts.clans.prototypes import ClanPrototype [as 別名]
# 或者: from the_tale.accounts.clans.prototypes.ClanPrototype import get_by_id [as 別名]
    def pvp_page(self):

        battle = Battle1x1Prototype.get_by_account_id(self.account.id)

        if battle is None or not battle.state.is_PROCESSING:
            return self.redirect(reverse("game:"))

        own_abilities = sorted(self.own_hero.abilities.all, key=lambda x: x.NAME)

        enemy_account = AccountPrototype.get_by_id(battle.enemy_id)

        enemy_hero = HeroPrototype.get_by_account_id(battle.enemy_id)
        enemy_abilities = sorted(enemy_hero.abilities.all, key=lambda x: x.NAME)

        say_form = SayForm()

        clan = None
        if self.account.clan_id is not None:
            clan = ClanPrototype.get_by_id(self.account.clan_id)

        enemy_clan = None
        if enemy_account.clan_id is not None:
            enemy_clan = ClanPrototype.get_by_id(enemy_account.clan_id)

        return self.template(
            "pvp/pvp_page.html",
            {
                "enemy_account": AccountPrototype.get_by_id(battle.enemy_id),
                "own_hero": self.own_hero,
                "own_abilities": own_abilities,
                "enemy_abilities": enemy_abilities,
                "game_settings": game_settings,
                "say_form": say_form,
                "clan": clan,
                "enemy_clan": enemy_clan,
                "battle": battle,
                "EQUIPMENT_SLOT": EQUIPMENT_SLOT,
                "ABILITIES": (Ice, Blood, Flame),
            },
        )
開發者ID:nbadp,項目名稱:the-tale,代碼行數:42,代碼來源:views.py

示例2: index

# 需要導入模塊: from the_tale.accounts.clans.prototypes import ClanPrototype [as 別名]
# 或者: from the_tale.accounts.clans.prototypes.ClanPrototype import get_by_id [as 別名]
    def index(self):

        if portal_settings.ENABLE_FIRST_TIME_REDIRECT and accounts_logic.is_first_time_visit(self.request):
            return self.redirect(random.choice(portal_settings.FIRST_TIME_LANDING_URLS))

        news = news_logic.load_news_from_query(news_models.News.objects.all().order_by('-created_at')[:portal_settings.NEWS_ON_INDEX])

        bills = BillPrototype.get_recently_modified_bills(portal_settings.BILLS_ON_INDEX)

        account_of_the_day_id = settings.get(portal_settings.SETTINGS_ACCOUNT_OF_THE_DAY_KEY)

        hero_of_the_day = None
        account_of_the_day = None
        clan_of_the_day = None

        if account_of_the_day_id is not None:
            hero_of_the_day = heroes_logic.load_hero(account_id=account_of_the_day_id)
            account_of_the_day = AccountPrototype.get_by_id(account_of_the_day_id)

            if account_of_the_day.clan_id is not None:
                clan_of_the_day = ClanPrototype.get_by_id(account_of_the_day.clan_id)

        forum_threads = ThreadPrototype.get_last_threads(account=self.account if self.account.is_authenticated() else None,
                                                         limit=portal_settings.FORUM_THREADS_ON_INDEX)

        blog_posts = [ BlogPostPrototype(blog_post_model)
                       for blog_post_model in BlogPost.objects.filter(state__in=[BLOG_POST_STATE.ACCEPTED, BLOG_POST_STATE.NOT_MODERATED],
                                                                      votes__gte=0).order_by('-created_at')[:portal_settings.BLOG_POSTS_ON_INDEX] ]

        map_info = map_info_storage.item

        chronicle_records = ChronicleRecordPrototype.get_last_records(portal_settings.CHRONICLE_RECORDS_ON_INDEX)

        chronicle_actors = RecordToActorPrototype.get_actors_for_records(chronicle_records)

        return self.template('portal/index.html',
                             {'news': news,
                              'forum_threads': forum_threads,
                              'bills': bills,
                              'hero_of_the_day': hero_of_the_day,
                              'account_of_the_day': account_of_the_day,
                              'clan_of_the_day': clan_of_the_day,
                              'map_info': map_info,
                              'blog_posts': blog_posts,
                              'TERRAIN': TERRAIN,
                              'MAP_STATISTICS': MAP_STATISTICS,
                              'chronicle_records': chronicle_records,
                              'chronicle_actors': chronicle_actors,
                              'RACE': RACE})
開發者ID:Jazzis18,項目名稱:the-tale,代碼行數:51,代碼來源:views.py

示例3: pvp_page

# 需要導入模塊: from the_tale.accounts.clans.prototypes import ClanPrototype [as 別名]
# 或者: from the_tale.accounts.clans.prototypes.ClanPrototype import get_by_id [as 別名]
    def pvp_page(self):

        battle = Battle1x1Prototype.get_by_account_id(self.account.id)

        if battle is None or not battle.state.is_PROCESSING:
            return self.redirect(reverse('game:'))

        own_abilities = sorted(self.own_hero.abilities.all, key=lambda x: x.NAME)

        enemy_account = AccountPrototype.get_by_id(battle.enemy_id)

        enemy_hero = HeroPrototype.get_by_account_id(battle.enemy_id)
        enemy_abilities = sorted(enemy_hero.abilities.all, key=lambda x: x.NAME)

        say_form = SayForm()

        clan = None
        if self.account.clan_id is not None:
            clan = ClanPrototype.get_by_id(self.account.clan_id)

        enemy_clan = None
        if enemy_account.clan_id is not None:
            enemy_clan = ClanPrototype.get_by_id(enemy_account.clan_id)

        return self.template('pvp/pvp_page.html',
                             {'enemy_account': AccountPrototype.get_by_id(battle.enemy_id),
                              'own_hero': self.own_hero,
                              'own_abilities': own_abilities,
                              'enemy_abilities': enemy_abilities,
                              'game_settings': game_settings,
                              'say_form': say_form,
                              'clan': clan,
                              'enemy_clan': enemy_clan,
                              'battle': battle,
                              'EQUIPMENT_SLOT': EQUIPMENT_SLOT,
                              'ABILITIES': (Ice, Blood, Flame)} )
開發者ID:alexudracul,項目名稱:the-tale,代碼行數:38,代碼來源:views.py

示例4: game_page

# 需要導入模塊: from the_tale.accounts.clans.prototypes import ClanPrototype [as 別名]
# 或者: from the_tale.accounts.clans.prototypes.ClanPrototype import get_by_id [as 別名]
def game_page(context):

    battle = Battle1x1Prototype.get_by_account_id(context.account.id)

    if battle and battle.state.is_PROCESSING:
        return dext_views.Redirect(url('game:pvp:'))

    clan = None
    if context.account.clan_id is not None:
        clan = ClanPrototype.get_by_id(context.account.clan_id)

    cards = sorted(EFFECTS.values(), key=lambda x: (x.TYPE.rarity.value, x.TYPE.text))

    return dext_views.Page('game/game_page.html',
                           content={'map_settings': map_settings,
                                    'game_settings': game_settings,
                                    'EQUIPMENT_SLOT': EQUIPMENT_SLOT,
                                    'current_map_version': map_info_storage.version,
                                    'clan': clan,
                                    'CARDS': cards,
                                    'resource': context.resource,
                                    'hero': context.account_hero} )
開發者ID:Alkalit,項目名稱:the-tale,代碼行數:24,代碼來源:views.py

示例5: clan

# 需要導入模塊: from the_tale.accounts.clans.prototypes import ClanPrototype [as 別名]
# 或者: from the_tale.accounts.clans.prototypes.ClanPrototype import get_by_id [as 別名]
 def clan(self):
     if self.membership:
         return ClanPrototype.get_by_id(self.membership.clan_id)
開發者ID:Alkalit,項目名稱:the-tale,代碼行數:5,代碼來源:logic.py


注:本文中的the_tale.accounts.clans.prototypes.ClanPrototype.get_by_id方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。