Exemplo n.º 1
0
    def process(self):
        model_mgr = self.getModelMgr()

        event_config = BackendApi.get_current_produce_event_config(
            model_mgr, using=settings.DB_READONLY)

        args = self.getUrlArgs('/produceeventtop/')
        mid = args.getInt(0)
        eventmaster = None

        if not mid and event_config:
            mid = event_config.mid

        if mid:
            eventmaster = BackendApi.get_produce_event_master(
                model_mgr, mid, using=settings.DB_READONLY)

        if not eventmaster:
            raise CabaretError(u'Event Closed.',
                               CabaretError.Code.EVENT_CLOSED)

        cur_eventmaster = self.getCurrentProduceEvent(quiet=True)
        is_open = cur_eventmaster and cur_eventmaster.id == mid
        v_player = self.getViewerPlayer()
        uid = v_player.id

        if is_open:
            # 発生中のレイド情報.
            happeningraidset = self.getHappeningRaidSet()
            happeningset = None
            if happeningraidset:
                happeningset = happeningraidset.happening
            if happeningset:
                # レイドがある.
                if (happeningset.happening.is_cleared()):
                    # 未確認の結果がある.
                    url = UrlMaker.raidresultanim(happeningset.id)
                    self.appRedirect(self.makeAppLinkUrlRedirect(url))
                    return
                elif not happeningset.happening.is_end():
                    obj_happening = Objects.producehappening(
                        self, happeningraidset)
                    obj_happening['url_battlepre'] = self.makeAppLinkUrl(
                        UrlMaker.produceevent_battlepre())
                    self.html_param['producehappening'] = obj_happening

            # デッキ編成へのリンクを上書き.
            self.setFromPage(Defines.FromPages.PRODUCEEVENT)
            self.html_param['url_deck_raid'] = self.makeAppLinkUrl(
                UrlMaker.deck_raid())
        # イベント情報.
        self.html_param['produceevent'] = Objects.produceevent(
            self, eventmaster, event_config)

        # ルール、説明とランキングのリンク.
        self.putEventTopic(mid, 'top')

        self.html_param['produce_card'] = BackendApi.create_produce_cardinfo(
            self, model_mgr, uid, eventmaster.id)

        # イベント専用スカウトのTOPページへのリンク.
        self.html_param['url_produceevent_scouttop'] = self.makeAppLinkUrl(
            UrlMaker.produceevent_scouttop())

        produce_score = ProduceEventScore.get_instance(
            model_mgr, uid, eventmaster.id, using=settings.DB_READONLY)
        self.html_param['produce_eventscore'] = produce_score.to_dict()

        self.html_param['produce_rank'] = BackendApi.get_ranking_rank(
            ProduceEventRanking, eventmaster.id, uid)

        self.html_param['shop_url'] = self.makeAppLinkUrl(UrlMaker.shop())

        # HTML 作成
        self.writeAppHtml('produce_event/top')
Exemplo n.º 2
0
 def process(self):
     
     model_mgr = self.getModelMgr()
     v_player = self.getViewerPlayer()
     uid = v_player.id
     
     # 開催中判定.
     cur_eventmaster = self.getCurrentRaidEvent()
     mid = cur_eventmaster.id
     
     # 現在発生中のレイド.
     happeningraidset = self.getHappeningRaidSet()
     if happeningraidset is None or happeningraidset.raidboss is None:
         self.appRedirect(self.makeAppLinkUrlRedirect(UrlMaker.mypage()))
         return
     
     # イベントのレイド判定.
     happeningset = happeningraidset.happening
     raidboss = happeningraidset.raidboss
     eventid = HappeningUtil.get_raideventid(happeningset.happening.event)
     if happeningset.happening.oid != uid:
         # 自分のじゃないのは救援詳細へ.
         self.appRedirect(self.makeAppLinkUrlRedirect(UrlMaker.raidhelpdetail(happeningset.id)))
         return
     elif eventid != mid:
         # イベントじゃないレイド.
         self.appRedirect(self.makeAppLinkUrlRedirect(UrlMaker.happening()))
         return
     elif not happeningset.happening.is_active():
         # 終了済み.
         self.appRedirect(self.makeAppLinkUrlRedirect(UrlMaker.raidend(happeningset.happening.id)))
         return
     
     raideventraidmaster = BackendApi.get_raidevent_raidmaster(model_mgr, cur_eventmaster.id, raidboss.master.id, using=settings.DB_READONLY)
     
     # キャストを借りる.
     func_put_playerlist = self.putHelpFriend(raidboss)
     
     # ダメージ履歴.
     func_put_attacklog = self.putRaidAttackLog(raidboss)
     
     # イベント情報.
     config = BackendApi.get_current_raideventconfig(model_mgr, using=settings.DB_READONLY)
     self.html_param['raidevent'] = Objects.raidevent(self, cur_eventmaster, config)
     
     # レイド情報.
     obj_happening = Objects.happening(self, happeningraidset)
     self.html_param['happening'] = obj_happening
     
     # 実行リンク 等倍と3倍.
     url = UrlMaker.raiddo(raidboss.id, v_player.req_confirmkey)
     self.html_param['url_exec'] = self.makeAppLinkUrl(url)
     self.html_param['url_exec_strong'] = self.makeAppLinkUrl(OSAUtil.addQuery(url, Defines.URLQUERY_STRONG, 1))
     
     # 諦める.
     self.html_param['url_happeningcancel_yesno'] = self.makeAppLinkUrl(UrlMaker.happeningcancel_yesno())
     
     # 初心者フラグ.
     is_beginer = BackendApi.check_raidevent_beginer(model_mgr, uid, cur_eventmaster, config, using=settings.DB_READONLY)
     self.html_param['is_beginer'] = is_beginer
     
     # イベントデータ.
     scorerecord = BackendApi.get_raidevent_scorerecord(model_mgr, mid, uid, using=settings.DB_READONLY)
     rank = BackendApi.get_raidevent_rank(cur_eventmaster.id, uid)
     rank_beginer = BackendApi.get_raidevent_rank(cur_eventmaster.id, uid, is_beginer=True)
     self.html_param['raideventscore'] = Objects.raidevent_score(cur_eventmaster, scorerecord, rank, rank_beginer)
     
     # 特攻カード.
     BackendApi.put_raidevent_specialcard_info(self, uid, raideventraidmaster, using=settings.DB_READONLY)
     
     # このページに戻ってくるリンク.
     self.setFromPage(Defines.FromPages.HAPPENING, happeningset.id)
     BackendApi.put_bprecover_uselead_info(self)
     self.html_param['url_deck_raid'] = self.makeAppLinkUrl(UrlMaker.deck_raid())
     
     # デッキ情報.
     deckcardlist = self.getDeckCardList()
     self.putDeckParams(deckcardlist)
     
     self.execute_api()
     if func_put_attacklog:
         func_put_attacklog()
     if func_put_playerlist:
         func_put_playerlist()
     
     # 説明とランキングのリンク.
     url = UrlMaker.raidevent_top(mid)
     self.html_param['url_raidevent_top'] = self.makeAppLinkUrl(url)
     
     self.html_param['player'] = Objects.player(self, v_player)
     
     self.writeHtml(cur_eventmaster, 'bossappear')
Exemplo n.º 3
0
    def process(self):

        v_player = self.getViewerPlayer()

        args = self.getUrlArgs('/carddetail/')
        strcardid = args.get(0, None)

        model_mgr = self.getModelMgr()

        cardset = None
        if strcardid and strcardid.isdigit():
            cardid = int(strcardid)
            cardlist = BackendApi.get_cards([cardid],
                                            model_mgr,
                                            using=settings.DB_READONLY)
            if cardlist:
                cardset = cardlist[0]
        if cardset is None or cardset.card.uid != v_player.id:
            raise CabaretError(u'閲覧できないキャストです', CabaretError.Code.ILLEGAL_ARGS)

        if self.getFromPageName() == Defines.FromPages.CARDBOX:
            url = UrlMaker.cardbox()
            args = self.getFromPageArgs()
            if args and len(args) == 3:
                ctype, sortby, page = args
                url = OSAUtil.addQuery(url, Defines.URLQUERY_CTYPE, ctype)
                url = OSAUtil.addQuery(url, Defines.URLQUERY_SORTBY, sortby)
                url = OSAUtil.addQuery(url, Defines.URLQUERY_PAGE, page)
            self.html_param['url_back'] = self.makeAppLinkUrl(
                url, add_frompage=False)
        elif self.getFromPageName() == Defines.FromPages.DECK_RAID:
            url = UrlMaker.deck_raid()
            self.html_param['url_back'] = self.makeAppLinkUrl(
                url, add_frompage=False)
        elif self.getFromPageName() == Defines.FromPages.DECK_NORMAL:
            url = UrlMaker.deck()
            self.html_param['url_back'] = self.makeAppLinkUrl(
                url, add_frompage=False)

        deck = BackendApi.get_deck(v_player.id,
                                   model_mgr,
                                   using=settings.DB_READONLY)
        raid_deck = BackendApi.get_raid_deck(v_player.id,
                                             model_mgr,
                                             using=settings.DB_READONLY)
        cardidlist = []
        cardidlist.extend(deck.to_array())
        cardidlist.extend(raid_deck.to_array())

        self.html_param['card'] = Objects.card(self, cardset, deck=cardidlist)

        is_stockable = False
        is_stock_overlimit = False
        if CardUtil.checkStockable(v_player.id,
                                   deck,
                                   cardset,
                                   raise_on_error=False):
            stocknum_model = BackendApi.get_cardstock(
                model_mgr,
                v_player.id,
                cardset.master.album,
                using=settings.DB_READONLY)
            num = stocknum_model.num if stocknum_model else 0
            is_stock_overlimit = Defines.ALBUM_STOCK_NUM_MAX <= num
            is_stockable = True
        self.html_param['is_stockable'] = is_stockable
        self.html_param['is_stock_overlimit'] = is_stock_overlimit

        self.writeAppHtml('card/carddetail')
Exemplo n.º 4
0
 def process(self):
     
     args = self.getUrlArgs('/raidhelpdetail/')
     raidid = str(args.get(0, ''))
     
     if not raidid.isdigit():
         if settings_sub.IS_LOCAL:
             raise CabaretError(u'レイドIDの指定がおかしい')
         self.__redirectWithError(self.makeAppLinkUrlRedirect(UrlMaker.happening()), u'Illegal ID.')
         return
     raidid = int(raidid)
     
     model_mgr = self.getModelMgr()
     v_player = self.getViewerPlayer()
     uid = v_player.id
     
     # レイド情報.
     raidboss = BackendApi.get_raid(model_mgr, raidid, using=settings.DB_READONLY)
     if raidboss is None:
         if settings_sub.IS_LOCAL:
             raise CabaretError(u'存在しないレイド')
         raidlog = BackendApi.get_raidlog_by_raidid(model_mgr, uid, raidid, using=settings.DB_READONLY)
         if raidlog:
             self.__redirectWithError(self.makeAppLinkUrlRedirect(UrlMaker.raidlogdetail(raidlog.id)), u'Raid not Found.')
         else:
             self.__redirectWithError(self.makeAppLinkUrlRedirect(UrlMaker.happening()), u'Raid not Found and Log not Found.')
         return
     elif raidboss.raid.oid == uid:
         if settings_sub.IS_LOCAL:
             raise CabaretError(u'自分のレイド')
         self.__redirectWithError(self.makeAppLinkUrlRedirect(UrlMaker.happening()), u'Mine.')
         return
     
     happeningset = BackendApi.get_happening(model_mgr, raidid, using=settings.DB_READONLY)
     is_end = False
     if happeningset.happening.is_active():
         # 参加可能かを確認.
         if not BackendApi.check_raid_joinable(model_mgr, raidboss, uid, using=settings.DB_READONLY):
             # もう一度開催確認.
             happeningset = BackendApi.get_happening(ModelRequestMgr(), raidid, using=settings.DB_DEFAULT)
             if happeningset.happening.is_active():
                 if settings_sub.IS_LOCAL:
                     raise CabaretError(u'参加できないレイド')
                 self.__redirectWithError(self.makeAppLinkUrlRedirect(UrlMaker.happening()), u'Cannot Join.')
                 return
             else:
                 # チェック中に終了した.
                 is_end = True
     else:
         is_end = True
     
     BackendApi.reset_raidboss_eventraidmaster(model_mgr, raidboss, happeningset.happening.event, using=settings.DB_READONLY)
     
     # プレイヤー情報.
     self.html_param['player'] = Objects.player(self, v_player)
     
     # ダメージ履歴.
     func_put_attacklog = self.putRaidAttackLog(raidboss)
     # お助け.
     func_put_playerlist = self.putHelpFriend(raidboss)
     
     # ハプニング情報.
     o_players = BackendApi.get_players(self, [happeningset.happening.oid], [], using=settings.DB_READONLY)
     dmmid = ''
     if o_players:
         o_player = o_players[0]
         dmmid = o_player.dmmid
         persons = BackendApi.get_dmmplayers(self, o_players, using=settings.DB_READONLY, do_execute=False)
     else:
         persons = {}
     
     if not is_end:
         # デッキ情報.
         deckcardlist = self.getDeckCardList()
         self.putDeckParams(deckcardlist)
     
     self.execute_api()
     
     obj_happening = Objects.happening(self, HappeningRaidSet(happeningset, raidboss), o_person=persons.get(dmmid))
     self.html_param['happening'] = obj_happening
     
     if func_put_attacklog or func_put_playerlist:
         if func_put_attacklog:
             func_put_attacklog()
         if func_put_playerlist:
             func_put_playerlist()
     
     self.setFromPage(Defines.FromPages.RAID, raidid)
     BackendApi.put_bprecover_uselead_info(self)
     
     self.html_param['url_deck_raid'] = self.makeAppLinkUrl(UrlMaker.deck_raid())
     
     # 実行Url.
     url = UrlMaker.raiddo(raidboss.id, v_player.req_confirmkey)
     self.html_param['url_exec_strong'] = self.makeAppLinkUrl(OSAUtil.addQuery(url, Defines.URLQUERY_STRONG, 1))
     self.html_param['url_exec'] = self.makeAppLinkUrl(url)
     self.html_param['url_trade'] = self.makeAppLinkUrl(UrlMaker.trade(), add_frompage=True)
     
     cur_eventmaster = BackendApi.get_current_raideventmaster(model_mgr, using=settings.DB_READONLY)
     eventid = HappeningUtil.get_raideventid(happeningset.happening.event)
     if cur_eventmaster and cur_eventmaster.id == eventid:
         # イベント情報.
         config = BackendApi.get_current_raideventconfig(model_mgr, using=settings.DB_READONLY)
         self.html_param['raidevent'] = Objects.raidevent(self, cur_eventmaster, config)
         
         # イベントデータ.
         scorerecord = BackendApi.get_raidevent_scorerecord(model_mgr, cur_eventmaster.id, uid, using=settings.DB_READONLY)
         rank = BackendApi.get_raidevent_rank(cur_eventmaster.id, uid)
         self.html_param['raideventscore'] = Objects.raidevent_score(cur_eventmaster, scorerecord, rank)
         
         # 特攻カード.
         raideventraidmaster = BackendApi.get_raidevent_raidmaster(model_mgr, cur_eventmaster.id, raidboss.master.id, using=settings.DB_READONLY)
         BackendApi.put_raidevent_specialcard_info(self, uid, raideventraidmaster, using=settings.DB_READONLY)
         
         self.html_param['url_raidevent_top'] = self.makeAppLinkUrl(UrlMaker.raidevent_top(cur_eventmaster.id))
         
         self.html_param['is_end'] = is_end
         
         self.writeAppHtml('raidevent/bossappear')
     elif is_end:
         self.writeAppHtml('raid/helpend')
     else:
         self.writeAppHtml('raid/helpdetail')
Exemplo n.º 5
0
 def process(self):
     
     model_mgr = self.getModelMgr()
     
     config = BackendApi.get_current_raideventconfig(model_mgr, using=settings.DB_READONLY)
     
     args = self.getUrlArgs('/raideventtop/')
     mid = str(args.get(0))
     eventmaster = None
     
     if mid and mid.isdigit():
         mid = int(mid)
     elif config:
         mid = config.mid
     
     if mid:
         eventmaster = BackendApi.get_raideventmaster(model_mgr, mid, using=settings.DB_READONLY)
     
     if eventmaster is None:
         raise CabaretError(u'Event Closed.', CabaretError.Code.EVENT_CLOSED)
         return
     
     cur_eventmaster = self.getCurrentRaidEvent(quiet=True)
     
     mid = eventmaster.id
     
     # 開催中判定.
     is_open = cur_eventmaster and cur_eventmaster.id == mid
     
     v_player = self.getViewerPlayer()
     uid = v_player.id
     scorerecord = BackendApi.get_raidevent_scorerecord(model_mgr, mid, uid, using=settings.DB_READONLY)
     flagrecord = BackendApi.get_raidevent_flagrecord(model_mgr, mid, uid, using=settings.DB_READONLY)
     
     # イベント情報.
     self.html_param['raidevent'] = Objects.raidevent(self, eventmaster, config)
     
     # 説明とランキングのリンク.
     self.putEventTopic(mid, 'top')
     
     if is_open:
         # 救援(1件だけ).
         func_raidhelp = self.putRaidHelpList(do_execute=False, limit=1)
         self.html_param['url_raidhelp_list'] = self.makeAppLinkUrl(UrlMaker.raidevent_helplist())
         
         # 履歴(1件だけ).
         raidlogidlist = BackendApi.get_raidlog_idlist(model_mgr, v_player.id, 0, 1, using=settings.DB_READONLY)
         raidloglist = BackendApi.get_raidlogs(model_mgr, raidlogidlist, using=settings.DB_READONLY).values()
         func_raidlog = BackendApi.put_list_raidlog_obj(self, raidloglist)
         self.html_param['url_raidloglist'] = self.makeAppLinkUrl(UrlMaker.raidloglist())
         
         # 発生中のレイド情報.
         happeningraidset = self.getHappeningRaidSet()
         happeningset = None
         if happeningraidset:
             happeningset = happeningraidset.happening
         if happeningset:
             # レイドがある.
             if (happeningset.happening.is_cleared() or happeningset.happening.is_missed_and_not_end()):
                 # 未確認の結果がある.
                 url = UrlMaker.raidresultanim(happeningset.id)
                 self.appRedirect(self.makeAppLinkUrlRedirect(url))
                 return
             elif not happeningset.happening.is_end():
                 obj_happening = Objects.happening(self, happeningraidset)
                 obj_happening['url_battlepre'] = self.makeAppLinkUrl(UrlMaker.raidevent_battlepre())
                 self.html_param['happening'] = obj_happening
         
         # デッキ編成へのリンクを上書き.
         self.setFromPage(Defines.FromPages.RAIDEVENT)
         self.html_param['url_deck_raid'] = self.makeAppLinkUrl(UrlMaker.deck_raid())
     elif BackendApi.check_raidevent_lead_epilogue(model_mgr, uid, mid, using=settings.DB_READONLY):
         # EDを見ないといけない.
         self.appRedirect(self.makeAppLinkUrlRedirect(UrlMaker.raidevent_epilogue()))
         return
     
     # 報酬受取り判定.
     flag = False
     if scorerecord:
         if flagrecord is None:
             flagrecord = BackendApi.update_raideventflagrecord(model_mgr, eventmaster.id, uid, OSAUtil.get_datetime_max())
         if scorerecord.destroy and BackendApi.choice_raidevent_notfixed_destroy_prizeids(eventmaster, scorerecord.destroy, flagrecord, False):
             flag = True
         elif scorerecord.destroy_big and BackendApi.choice_raidevent_notfixed_destroy_prizeids(eventmaster, scorerecord.destroy_big, flagrecord, True):
             flag = True
     if flag:
         self.html_param['url_raidevent_prizereceive'] = self.makeAppLinkUrl(UrlMaker.raidevent_prizereceive_do(mid, v_player.req_confirmkey))
     
     # イベント秘宝所持数.
     # 討伐回数.
     rank = BackendApi.get_raidevent_rank(mid, uid)
     rank_beginer = BackendApi.get_raidevent_rank(mid, uid, is_beginer=True)
     self.html_param['raideventscore'] = Objects.raidevent_score(eventmaster, scorerecord, rank, rank_beginer)
     
     # イベントガチャのリンク.
     self.putEventGachaUrl()
     
     # 初心者フラグ.
     is_beginer = BackendApi.check_raidevent_beginer(model_mgr, uid, eventmaster, config, using=settings.DB_READONLY)
     self.html_param['is_beginer'] = is_beginer
     
     # ランキング.
     view_myrank = False
     view_beginer = self.request.get(Defines.URLQUERY_BEGINER) == "1"
     if not view_beginer or is_beginer:
         view_myrank = self.request.get(Defines.URLQUERY_FLAG) == "1"
     url_ranking = OSAUtil.addQuery(UrlMaker.raidevent_top(mid), Defines.URLQUERY_FLAG, "0")
     url_myrank = OSAUtil.addQuery(UrlMaker.raidevent_top(mid), Defines.URLQUERY_FLAG, "1")
     self.putRanking(uid, mid, view_myrank, url_ranking, url_myrank, view_beginer)
     
     # シャンパン.
     self.putChampagneData()
     
     # 素材.
     self.putMaterialHtml()
     
     # 交換所のURL.
     self.putRecipeUrl()
     
     if eventmaster.flag_dedicated_stage:
         # イベント専用ステージ情報.
         eventstageplaydata = BackendApi.get_raideventstage_playdata(model_mgr, mid, uid, using=settings.DB_READONLY)
         # 現在のステージ.
         cur_stagemaster = BackendApi.get_current_raideventstage_master(model_mgr, eventmaster, eventstageplaydata, using=settings.DB_READONLY)
         if cur_stagemaster is None:
             raise CabaretError(u'ステージが存在いません', CabaretError.Code.INVALID_MASTERDATA)
         
         # 現在のステージ情報.
         progress = eventstageplaydata.progress
         confirmkey = eventstageplaydata.confirmkey
         self.html_param['raideventstage'] = Objects.raidevent_stage(self, v_player, cur_stagemaster.stage, cur_stagemaster, progress, confirmkey)
         
         # イベント専用スカウトのTOPページへのリンク.
         self.html_param['url_raidevent_scouttop'] = self.makeAppLinkUrl(UrlMaker.raidevent_scouttop())
     
     self.execute_api()
     if is_open:
         if func_raidhelp:
             func_raidhelp()
         func_raidlog()
         
         # イベント参加のKPIを保存.
         BackendApi.save_kpi_raidevent_join(uid, self.is_pc)
     
     self.writeHtml(eventmaster, 'top')
Exemplo n.º 6
0
    def process(self):
        model_mgr = self.getModelMgr()
        v_player = self.getViewerPlayer()
        uid = v_player.id

        # 開催中判定.
        cur_eventmaster = self.getCurrentProduceEvent()
        mid = cur_eventmaster.id

        # 現在発生中のレイド.
        happeningraidset = self.getHappeningRaidSet()
        if happeningraidset is None or happeningraidset.raidboss is None:
            self.appRedirect(self.makeAppLinkUrlRedirect(UrlMaker.mypage()))
            return

        # イベントのレイド判定.
        happeningset = happeningraidset.happening
        raidboss = happeningraidset.raidboss
        eventid = HappeningUtil.get_produceeventid(
            happeningset.happening.event)
        if happeningset.happening.oid != uid:
            # 自分のじゃないのは救援詳細へ.
            self.appRedirect(
                self.makeAppLinkUrlRedirect(
                    UrlMaker.raidhelpdetail(happeningset.id)))
            return
        elif eventid != mid:
            # イベントじゃないレイド.
            self.appRedirect(self.makeAppLinkUrlRedirect(UrlMaker.happening()))
            return
        elif not happeningset.happening.is_active():
            # 終了済み.
            self.appRedirect(
                self.makeAppLinkUrlRedirect(
                    UrlMaker.produceraidend(happeningset.happening.id)))
            return

        produceeventraidmaster = BackendApi.get_produceevent_raidmaster(
            model_mgr,
            cur_eventmaster.id,
            raidboss.master.id,
            using=settings.DB_READONLY)

        # キャストを借りる.
        func_put_playerlist = self.putHelpFriend(raidboss)

        # ダメージ履歴.
        func_put_attacklog = self.putRaidAttackLog(raidboss)

        # イベント情報.
        config = BackendApi.get_current_produce_event_config(
            model_mgr, using=settings.DB_READONLY)
        self.html_param['produceevent'] = Objects.produceevent(
            self, cur_eventmaster, config)

        # レイド情報.
        obj_happening = Objects.producehappening(self, happeningraidset)
        self.html_param['happening'] = obj_happening

        # 実行リンク 等倍と3倍.
        url = UrlMaker.produceraiddo(raidboss.id, v_player.req_confirmkey)
        self.html_param['url_exec'] = self.makeAppLinkUrl(url)
        self.html_param['url_exec_strong'] = self.makeAppLinkUrl(
            OSAUtil.addQuery(url, Defines.URLQUERY_STRONG, 1))

        # イベントデータ.
        scorerecord = BackendApi.get_produceevent_scorerecord(
            model_mgr, mid, uid, using=settings.DB_READONLY)
        self.html_param['produceeventscore'] = Objects.produceevent_score(
            cur_eventmaster, scorerecord, None)

        # 特攻カード.
        #BackendApi.put_raidevent_specialcard_info(self, uid, produceeventraidmaster, using=settings.DB_READONLY)

        # このページに戻ってくるリンク.
        self.setFromPage(Defines.FromPages.HAPPENING, happeningset.id)
        BackendApi.put_bprecover_uselead_info(self)
        self.html_param['url_deck_raid'] = self.makeAppLinkUrl(
            UrlMaker.deck_raid())

        # デッキ情報.
        deckcardlist = self.getDeckCardList()
        self.putDeckParams(deckcardlist)

        self.execute_api()
        # if func_put_attacklog:
        #     func_put_attacklog()
        # if func_put_playerlist:
        #     func_put_playerlist()

        self.html_param['player'] = Objects.player(self, v_player)

        event_item_master = BackendApi.get_itemmaster(
            model_mgr, cur_eventmaster.useitem, using=settings.DB_READONLY)
        has_event_item_nums = BackendApi.get_item_nums(
            model_mgr, uid, [event_item_master.id], using=settings.DB_READONLY)
        if not has_event_item_nums:
            num = 0
        else:
            num = has_event_item_nums[event_item_master.id]
        self.html_param['event_item'] = {
            'name': event_item_master.name,
            'num': num
        }
        self.html_param['shop_url'] = self.makeAppLinkUrl(UrlMaker.shop())
        produce_score = ProduceEventScore.get_instance(
            model_mgr, uid, mid, using=settings.DB_READONLY)
        self.html_param['produce_eventscore'] = produce_score.to_dict()
        self.html_param['produce_rank'] = BackendApi.get_ranking_rank(
            ProduceEventRanking, mid, uid)

        self.writeHtml(cur_eventmaster, 'bossappear')
Exemplo n.º 7
0
    def process(self):

        # プレイヤー情報.
        v_player = self.getViewerPlayer()
        self.html_param['player'] = Objects.player(self, v_player)

        # ハプニング情報.
        self.putHappeningInfo()

        self.setFromPage(Defines.FromPages.HAPPENING)

        model_mgr = self.getModelMgr()
        cur_eventmaster = BackendApi.get_current_raideventmaster(
            model_mgr, using=settings.DB_READONLY)

        # 実行Url.
        happeningset = self.getHappening()
        eventid = HappeningUtil.get_raideventid(
            happeningset.happening.event) if happeningset else 0
        if happeningset and happeningset.happening.is_missed(
        ) and happeningset.happening.state != Defines.HappeningState.MISS:
            # 失敗した.
            if cur_eventmaster and cur_eventmaster.id == eventid:
                url = UrlMaker.raidresultanim(happeningset.id)
            else:
                self.writeHappeningMissed(happeningset.id)
                url = UrlMaker.happening()
            self.appRedirect(self.makeAppLinkUrl(url))
            return
        elif happeningset and not happeningset.happening.is_end():

            if happeningset.happening.is_cleared():
                # クリア済み.
                if cur_eventmaster and cur_eventmaster.id == eventid:
                    # イベントレイド.
                    url = UrlMaker.raidresultanim(happeningset.id)
                else:
                    url = UrlMaker.raidend(happeningset.id)
                self.appRedirect(self.makeAppLinkUrl(url, add_frompage=False))
                return
            elif eventid:
                if cur_eventmaster.id == eventid:
                    url = UrlMaker.raidevent_battlepre()
                    self.appRedirect(
                        self.makeAppLinkUrl(url, add_frompage=False))
                    return
                else:
                    # これはデバッグ中だけ起きる想定. ステータスは...メンテでいいかなぁ.
                    raise CabaretError(u'イベントの終了処理が終わっていません',
                                       CabaretError.Code.MAINTENANCE)
            else:
                # 救援要請.
                func_raidhelp_callback = self.putRaidHelpList(do_execute=False)

                raidboss = self.getRaidBoss()
                if raidboss:
                    # ダメージ履歴.
                    func_put_attacklog = self.putRaidAttackLog(raidboss)
                    # お助け.
                    func_put_playerlist = self.putHelpFriend(raidboss)

                    if func_raidhelp_callback or func_put_attacklog or func_put_playerlist:
                        self.execute_api()
                        if func_raidhelp_callback:
                            func_raidhelp_callback()
                        if func_put_attacklog:
                            func_put_attacklog()
                        if func_put_playerlist:
                            func_put_playerlist()

                    BackendApi.put_bprecover_uselead_info(self)

                    deckcardlist = self.getDeckCardList()
                    self.putDeckParams(deckcardlist)

                    url = UrlMaker.raiddo(raidboss.id, v_player.req_confirmkey)
                    htmlname = 'happening/bossappear'

                    self.html_param['url_exec_strong'] = self.makeAppLinkUrl(
                        OSAUtil.addQuery(url, Defines.URLQUERY_STRONG, 1))

                    self.html_param['url_deck_raid'] = self.makeAppLinkUrl(
                        UrlMaker.deck_raid())

                else:
                    if func_raidhelp_callback:
                        self.execute_api()
                        func_raidhelp_callback()
                    url = UrlMaker.happeningdo(v_player.req_confirmkey)
                    htmlname = 'happening/happening'
                self.html_param['url_exec'] = self.makeAppLinkUrl(url)
                self.html_param[
                    'url_happeningcancel_yesno'] = self.makeAppLinkUrl(
                        UrlMaker.happeningcancel_yesno())
        else:
            if cur_eventmaster is not None:
                # イベント.
                eventbanners = BackendApi.get_eventbanners(
                    self, using=settings.DB_READONLY)
                self.html_param['eventbanners'] = [
                    Objects.eventbanner(self, banner)
                    for banner in eventbanners
                ]

            # 救援要請.
            self.putRaidHelpList()
            htmlname = 'happening/happening_none'

        self.html_param['url_trade'] = self.makeAppLinkUrl(UrlMaker.trade(),
                                                           add_frompage=True)

        self.html_param['is_event_open'] = cur_eventmaster is not None

        self.writeAppHtml(htmlname)