def __putCompleteData(self, model_mgr, playdata, stagemaster): if 0 < stagemaster.boss and BackendApi.check_event_boss_playable( playdata, stagemaster): # ボス出現. boss = BackendApi.get_boss(model_mgr, stagemaster.boss, using=settings.DB_READONLY) self.html_param['boss'] = Objects.boss(self, boss) self.setFromPage(Defines.FromPages.PRODUCEEVENTSCOUT, stagemaster.id) url = UrlMaker.bosspre(stagemaster.id) self.html_param['url_bossbattle'] = self.makeAppLinkUrl(url) else: nextstagemaster = BackendApi.get_produceevent_next_stagemaster( model_mgr, playdata.mid, stagemaster, using=settings.DB_READONLY) if nextstagemaster and nextstagemaster.stage != stagemaster.stage: if nextstagemaster.area == stagemaster.area: self.html_param['next_stage'] = nextstagemaster.name else: self.html_param['next_area'] = nextstagemaster.areaname url = UrlMaker.produceevent_scoutdo(nextstagemaster.id, playdata.confirmkey) else: url = UrlMaker.produceevent_scoutdo(stagemaster.id, playdata.confirmkey) self.html_param['url_next'] = self.makeAppLinkUrl(url)
def __putCompleteData(self, model_mgr, playdata, stagemaster): if 0 < stagemaster.boss and BackendApi.check_event_boss_playable(playdata, stagemaster): # ボス出現. boss = BackendApi.get_boss(model_mgr, stagemaster.boss, using=settings.DB_READONLY) self.html_param['boss'] = Objects.boss(self, boss) self.setFromPage(Defines.FromPages.SCOUTEVENT, stagemaster.id) url = UrlMaker.bosspre(stagemaster.id) self.html_param['url_bossbattle'] = self.makeAppLinkUrl(url) else: nextstagemaster = BackendApi.get_event_next_stage(model_mgr, playdata.mid, stagemaster, using=settings.DB_READONLY) if nextstagemaster and nextstagemaster.stage != stagemaster.stage: if nextstagemaster.area == stagemaster.area: self.html_param['next_stage'] = nextstagemaster.name else: self.html_param['next_area'] = nextstagemaster.areaname url = UrlMaker.scouteventdo(nextstagemaster.id, playdata.confirmkey) else: url = UrlMaker.scouteventdo(stagemaster.id, playdata.confirmkey) self.html_param['url_next'] = self.makeAppLinkUrl(url) # 早期クリアボーナス. if stagemaster.earlybonus and playdata.result.get('earlybonus'): # 早期クリアボーナス. prizelist = BackendApi.get_prizelist(model_mgr, stagemaster.earlybonus, using=settings.DB_READONLY) self.html_param['earlybonus'] = BackendApi.make_prizeinfo(self, prizelist, using=settings.DB_READONLY)
def __putCompleteData(self, model_mgr, scoutmaster): nextscoutid = BackendApi.get_next_scoutid(model_mgr, scoutmaster.id, using=settings.DB_READONLY) flag_boss = False if nextscoutid == scoutmaster.id: flag_boss = True else: arr = BackendApi.get_scouts(model_mgr, [nextscoutid], using=settings.DB_READONLY) nextscoutmaster = arr[0] if arr else None if nextscoutmaster: if nextscoutmaster.area == scoutmaster.area: self.html_param['next_scout'] = self.makeScoutObj( nextscoutmaster, None) else: flag_boss = True if flag_boss: # ボス出現. areamaster = BackendApi.get_area(model_mgr, scoutmaster.area, using=settings.DB_READONLY) if areamaster.boss: boss = BackendApi.get_boss(model_mgr, areamaster.boss, using=settings.DB_READONLY) if boss: self.html_param['boss'] = Objects.boss(self, boss) self.html_param['url_bossbattle'] = self.makeAppLinkUrl( UrlMaker.bosspre(areamaster.id))
def __makeBackLinkUrlBoss(self, args): if args and 0 < len(args) and str(args[0]).isdigit(): url = UrlMaker.bosspre(int(args[0])) return { 'url': self.makeAppLinkUrl(url, add_frompage=False), 'text': u'太客接客へ戻る' } return None
def __makeBackLinkUrlRaidEventScoutBoss(self, args): if args and 0 < len(args) and str(args[0]).isdigit(): self.setFromPage(Defines.FromPages.RAIDEVENTSCOUT, int(args[0])) url = UrlMaker.bosspre(int(args[0])) return { 'url': self.makeAppLinkUrl(url, add_frompage=True), 'text': u'太客接客へ戻る' } return None
def process(self): v_player = self.getViewerPlayer() uid = v_player.id model_mgr = self.getModelMgr() using = settings.DB_READONLY # イベントマスター. eventmaster = self.getCurrentProduceEvent() mid = eventmaster.id # イベントスカウトのプレイ情報 playdata = BackendApi.get_produceeventstage_playdata(model_mgr, mid, uid, using=using) # 今いるステージ. stagemaster = BackendApi.get_current_produceeventstage_master( model_mgr, eventmaster, playdata, using=using) bossattack = False # 発生中のレイド情報. happeningraidset = self.getHappeningRaidSet() happeningset = None if happeningraidset: happeningset = happeningraidset.happening if happeningset: # レイドがある. if not happeningset.happening.is_end(): bossattack = True # エリアボス出現 areaboss_attack = False allcleared = BackendApi.check_event_boss_playable( playdata, stagemaster) boss = None if 0 < stagemaster.boss and allcleared: boss = BackendApi.get_boss(model_mgr, stagemaster.boss, using=settings.DB_READONLY) if boss is not None: areaboss_attack = True # エリアボス情報 if areaboss_attack: # エリアボス戦へのURL self.html_param['areaboss'] = Objects.boss(self, boss) self.setFromPage(Defines.FromPages.PRODUCEEVENT, stagemaster.id) url = UrlMaker.bosspre(stagemaster.id) self.html_param['url_bossbattle'] = self.makeAppLinkUrl(url) # 現在のステージ情報 obj_scout = self.makeStageObj(stagemaster, playdata, stagemaster.stage, bossattack=bossattack, areaboss_attack=areaboss_attack) self.__putParam('scout', obj_scout) # プレーヤーの情報 self.html_param['player'] = Objects.player(self, v_player, None) # 宝箱の上限チェック. overlimit_treasure_list = BackendApi.get_treasuretype_list_overlimit( model_mgr, uid, using=using) self.__putParam('overlimit_treasure', overlimit_treasure_list) # スキップフラグ self.__putParam('flag_skip', BackendApi.get_scoutskip_flag(uid)) # 全力探索フラグ self.__putParam('flag_search', BackendApi.get_scoutsearch_flag(uid)) # 説明とランキングのリンク. self.putEventTopic(mid) self.writeHtml(eventmaster, 'scout/scout')
def process(self): v_player = self.getViewerPlayer() uid = v_player.id model_mgr = self.getModelMgr() using = settings.DB_READONLY # イベントマスター. eventmaster = self.getCurrentScoutEvent() mid = eventmaster.id # イベントプレイ情報 playdata = BackendApi.get_event_playdata(model_mgr, mid, uid, using) # 今いるステージ. stage = BackendApi.get_current_scouteventstage_master( model_mgr, eventmaster, playdata, using=settings.DB_READONLY) stageid = stage.stage cardget_event = BackendApi.find_scout_event( playdata, Defines.ScoutEventType.GET_CARD) if cardget_event and not cardget_event.is_received: # カード獲得で離脱した. url = UrlMaker.scouteventresult(stage.id, playdata.alreadykey) self.appRedirect(self.makeAppLinkUrlRedirect(url)) return # プレイ情報. self.__putParam('scout', Objects.scoutevent_stage(self, stage, playdata)) # ボス出現. bossattack = False allcleared = BackendApi.check_event_boss_playable(playdata, stage) boss = None if 0 < stage.boss and allcleared: boss = BackendApi.get_boss(model_mgr, stage.boss, using=using) if boss is not None: bossattack = True # ステージ情報. obj_stage = self.makeStageObj(stage, playdata, stageid, bossattack) self.__putParam('stagelist', [obj_stage]) # ボス if bossattack: # ボス戦へのURL. self.__putParam('boss', Objects.boss(self, boss)) self.setFromPage(Defines.FromPages.SCOUTEVENT, stage.id) url = UrlMaker.bosspre(stage.id) self.html_param['url_bossbattle'] = self.makeAppLinkUrl(url) self.html_param['player'] = Objects.player(self, v_player, None) self.html_param['scoutevent'] = Objects.scouteventmaster( self, eventmaster, None) # フィーバー self.html_param['scouteventfever'] = Objects.scoutevent_fever(playdata) # 説明とランキングのリンク. self.putEventTopic(mid, 'top') # カードの上限チェック. if v_player.cardlimit <= BackendApi.get_cardnum( uid, arg_model_mgr=model_mgr, using=using): self.__putParam('overlimit_card', True) # 宝箱の上限チェック. overlimit_treasure_list = BackendApi.get_treasuretype_list_overlimit( model_mgr, uid, using=using) self.__putParam('overlimit_treasure', overlimit_treasure_list) self.__putParam('flag_skip', BackendApi.get_scoutskip_flag(uid)) config = BackendApi.get_current_scouteventconfig( model_mgr, using=settings.DB_READONLY) max_stage = config.get_stage_max() is_all_open = max_stage is None self.__putParam('is_all_open', is_all_open) is_all_cleared = False if is_all_open: if allcleared and not bossattack: stagelist_all = BackendApi.get_event_stage_by_stagenumber( model_mgr, mid, using=settings.DB_READONLY) stagelist_all.sort(key=lambda x: x.stage, reverse=True) is_all_cleared = stagelist_all[0].stage <= playdata.cleared else: is_all_cleared = max_stage <= playdata.cleared self.__putParam('is_all_cleared', is_all_cleared) # 短冊情報. BackendApi.put_scoutevent_tanzakudata(self, uid) self.writeScoutEventHTML('scout', eventmaster)
def process(self): try: # エリア. areaid = int(self.request.get(Defines.URLQUERY_AREA, 0)) or None #if self.is_pc and areaid is None: # raise CabaretError() except: raise CabaretError(u'閲覧できないエリアです', CabaretError.Code.ILLEGAL_ARGS) v_player = self.getViewerPlayer() uid = v_player.id model_mgr = self.getModelMgr() using = settings.DB_READONLY # エリア. area = None if areaid: area = BackendApi.get_area(model_mgr, areaid, using) else: area = BackendApi.get_lastview_area(model_mgr, uid, using) if area is not None: areaid = area.id if area and not BackendApi.check_area_playable(model_mgr, area, uid, using): area = None if area is None: # 見つからなかったので最新のエリア. areaid = BackendApi.get_newbie_areaid(model_mgr, uid, using) area = BackendApi.get_area(model_mgr, areaid, using) # エリアクリア情報. areaplaydata = BackendApi.get_areaplaydata(model_mgr, uid, [area.id], using).get(area.id) self.__putParam('area', Objects.area(self, area, areaplaydata)) # スカウト. scoutidlist = BackendApi.get_scoutidlist_by_area(model_mgr, area.id, using) scoutlist = BackendApi.get_scouts(model_mgr, scoutidlist, using) scoutlist.sort(key=operator.attrgetter('id')) # スカウト進行情報. pscoutidlist = scoutidlist[:] pscoutidlist.extend([scout.opencondition for scout in scoutlist if scout.opencondition]) pscoutidlist = list(set(pscoutidlist)) scoutplaydata_dict = BackendApi.get_scoutprogress(model_mgr, uid, pscoutidlist, using) obj_scoutlist = [] allcleared = True for scout in scoutlist: if not BackendApi.check_scout_playable(model_mgr, scout, v_player, using): allcleared = False continue scoutplaydata = scoutplaydata_dict.get(scout.id) obj_scout = self.makeScoutObj(scout, scoutplaydata) obj_scoutlist.insert(0, obj_scout) if not obj_scout['cleared']: allcleared = False self.__putParam('scoutlist', obj_scoutlist) is_last_area = False if allcleared: if areaplaydata is None: # ボス出現. boss = BackendApi.get_boss(model_mgr, area.boss, using=using) if boss is None: raise CabaretError(u'エリアにボスがいません.%d' % area.id, CabaretError.Code.INVALID_MASTERDATA) self.__putParam('boss', Objects.boss(self, boss)) # ボス戦へのURL. url = UrlMaker.bosspre(areaid) self.html_param['url_bossbattle'] = self.makeAppLinkUrl(url) else: # クリア済み. next_area_id = BackendApi.get_next_areaid(model_mgr, area.id, using=settings.DB_READONLY) if next_area_id == area.id: is_last_area = True else: next_area = BackendApi.get_area(model_mgr, next_area_id, using=settings.DB_READONLY) if not BackendApi.check_area_playable(model_mgr, next_area, uid, using=settings.DB_READONLY): is_last_area = True self.html_param['is_last_area'] = is_last_area self.html_param['player'] = Objects.player(self, v_player, None) arealist = BackendApi.get_playable_area_all(model_mgr, uid, using=settings.DB_READONLY) prev_area = None post_area = None flag = False for tmparea in arealist: if flag: post_area = tmparea break elif area.id == tmparea.id: flag = True else: prev_area = tmparea url_base = UrlMaker.scout() # 前のエリア. if prev_area: url = OSAUtil.addQuery(url_base, Defines.URLQUERY_AREA, prev_area.id) self.html_param['url_area_prev'] = self.makeAppLinkUrl(url) # 次のエリア. if post_area: url = OSAUtil.addQuery(url_base, Defines.URLQUERY_AREA, post_area.id) self.html_param['url_area_next'] = self.makeAppLinkUrl(url) # カードの上限チェック. if v_player.cardlimit <= BackendApi.get_cardnum(uid, arg_model_mgr=model_mgr, using=using): self.__putParam('overlimit_card', True) # 宝箱の上限チェック. overlimit_treasure_list = BackendApi.get_treasuretype_list_overlimit(model_mgr, uid, using=using) self.__putParam('overlimit_treasure', overlimit_treasure_list) BackendApi.save_lastview_areaid(uid, areaid) # スキップフラグ self.__putParam('flag_skip', BackendApi.get_scoutskip_flag(uid)) # レイドイベント. BackendApi.put_raidevent_champagnedata(self, uid) raideventmaster = BackendApi.get_current_raideventmaster(model_mgr, using=settings.DB_READONLY) if raideventmaster and raideventmaster.flag_dedicated_stage: self.html_param['url_raidevent_scouttop'] = self.makeAppLinkUrl(UrlMaker.raidevent_scouttop()) # スカウトイベント. scouteventmaster = BackendApi.get_current_scouteventmaster(model_mgr, using=settings.DB_READONLY) if scouteventmaster: scouteventconfig = BackendApi.get_current_scouteventconfig(model_mgr, using=settings.DB_READONLY) self.html_param['scoutevent'] = Objects.scouteventmaster(self, scouteventmaster, scouteventconfig) self.html_param['url_scoutevent_top'] = self.makeAppLinkUrl(UrlMaker.scoutevent_top(scouteventmaster.id)) # プロデュースイベント. produceeventmaster = BackendApi.get_current_produce_event_master(model_mgr, using=settings.DB_READONLY) if produceeventmaster: produceeventconfig = BackendApi.get_current_produce_event_config(model_mgr, using=settings.DB_READONLY) self.html_param['produceevent'] = Objects.produceevent(self, produceeventmaster, produceeventconfig) self.html_param['url_produceevent_scouttop'] = self.makeAppLinkUrl(UrlMaker.produceevent_scouttop()) self.writeAppHtml('scout/scout')