示例#1
0
    def create(p_sale, e_sale, p_cardsetList, e_cardsetList, p_skillinfolist,
               e_skillinfolist, feverFlag):
        ins = BattleAnimParam()
        # 売上.
        ins.pSale = p_sale
        ins.eSale = e_sale

        # カード.
        for ins_cardlist, cardsetlist in ((ins.pCard, p_cardsetList),
                                          (ins.eCard, e_cardsetList)):
            for cardset in cardsetlist:
                ins_cardlist.append({
                    'id':
                    cardset.id,
                    'data':
                    CardUtil.makeThumbnailUrlMiddle(cardset.master),
                })

        # スキル.
        ins.pSkill = p_skillinfolist[:]
        ins.eSkill = e_skillinfolist[:]

        # フィーバー.
        ins.feverFlag = feverFlag

        return ins
示例#2
0
 def _get_carddata(self, cardmaster, skillmaster=None):
     thumb = CardUtil.makeThumbnailUrlIcon(cardmaster)
     thumb_middle = CardUtil.makeThumbnailUrlMiddle(cardmaster)
     icon = self.makeAppLinkUrlImg(
         Defines.CharacterType.ICONS[cardmaster.ctype])
     rare = {
         'str': Defines.Rarity.NAMES.get(cardmaster.rare),
         'color': Defines.Rarity.COLORS.get(cardmaster.rare, '#ffffff')
     }
     if isinstance(skillmaster, SkillMaster):
         skillname = skillmaster.name
         skilltext = skillmaster.text
     else:
         skillname = None
         skilltext = None
     return self._dataformat(name=cardmaster.name,
                             thumb=thumb,
                             thumb_middle=thumb_middle,
                             kind=cardmaster.ckind,
                             iconUrl=icon,
                             rare=rare,
                             skillname=skillname,
                             skilltext=skilltext,
                             basepower=cardmaster.basepower,
                             cost=cardmaster.cost)
示例#3
0
    def procLastCardGetAnim(self, args):
        """最後のレア度のキャスト獲得演出
        """
        model_mgr = self.getModelMgr()
        v_player = self.getViewerPlayer()

        # get the card id form url
        cardid = args.getInt(1)

        cur_eventmaster = BackendApi.get_current_produce_event_master(
            model_mgr, using=settings.DB_READONLY)

        if not cur_eventmaster:
            raise CabaretError(u'イベントは終了しました', CabaretError.Code.EVENT_CLOSED)

        raidbattle = BackendApi.get_raid_battleresult(
            model_mgr, v_player.id, using=settings.DB_READONLY)
        if raidbattle is None:
            if settings_sub.IS_LOCAL:
                raise CabaretError(u'想定外の遷移です')
            url = UrlMaker.producehappening()
            self.appRedirect(self.makeAppLinkUrlRedirect(url))
            return

        # レイド情報を取得.
        raidboss = None
        happeningraidset = BackendApi.get_producehappeningraidset(
            model_mgr, raidbattle.raidid, using=settings.DB_READONLY)
        if happeningraidset:
            raidboss = happeningraidset.raidboss
        if raidboss is None:
            raise CabaretError(u'超太客が存在しません', CabaretError.Code.NOT_DATA)

        animdata = raidbattle.process
        is_win = animdata.winFlag

        # 結果へのURL.
        happeningset = BackendApi.get_producehappening(
            model_mgr, raidbattle.raidid, using=settings.DB_READONLY)
        eventid = HappeningUtil.get_produceeventid(
            happeningset.happening.event)
        if cur_eventmaster and cur_eventmaster.id == eventid:
            url = UrlMaker.produceraidresultanim()
        elif is_win:
            url = UrlMaker.produceraidend(raidbattle.raidid)
        else:
            url = UrlMaker.produceraidresult()

        cardmaster = BackendApi.get_model(model_mgr,
                                          CardMasterView,
                                          cardid,
                                          using=settings.DB_READONLY)
        params = {}
        params['backUrl'] = self.makeAppLinkUrl(url)
        params['cast'] = self.makeAppLinkUrlImg(
            CardUtil.makeThumbnailUrlMiddle(cardmaster))

        self.appRedirectToEffect(
            'produce_event/produce_lastcastget/effect.html', params)
示例#4
0
    def create(power,
               power_default,
               cardlist,
               skilllist,
               damage,
               hppre,
               hppost,
               hpmax,
               critical,
               specialcard_idlist=None,
               friendcard=None,
               sppowup=None,
               weakpowup=None):
        ins = BossBattleAnimParam()

        # 勝利フラグ.
        ins.winFlag = hppost < 1

        # 接客力とか.
        ins.power = power
        ins.power_default = power_default
        ins.specialcard_powup = sppowup
        ins.weak_powup = weakpowup

        # ボス.
        ins.bossHpPre = hppre
        ins.bossHpPost = hppost
        ins.bossHpMax = hpmax
        ins.bossDamage = damage

        # カード.
        leader = cardlist[0]
        ins.leader = {
            'id': leader.id,
            'data': CardUtil.makeThumbnailUrlMiddle(leader.master),
        }
        for cardset in cardlist[1:]:
            ins.memberlist.append({
                'id':
                cardset.id,
                'data':
                CardUtil.makeThumbnailUrlIcon(cardset.master),
            })
        if friendcard:
            ins.memberlist.append({
                'id':
                friendcard.id,
                'data':
                CardUtil.makeThumbnailUrlIcon(friendcard.master),
                'friend':
                True,
            })

        # スキル.
        ins.skilllist = skilllist[:]

        ins.specialcard_idlist = specialcard_idlist or []

        return ins
示例#5
0
    def procCard(self, filter_json, page):
        """カード画像確認.
        """
        PAGE_CONTENT_NUM = 50
        offset = page * PAGE_CONTENT_NUM

        nummax = CardMasterView.count(filters=filter_json,
                                      using=settings.DB_READONLY)
        pagemax = int((nummax + PAGE_CONTENT_NUM - 1) / PAGE_CONTENT_NUM)

        titles = (
            u'ID',
            u'キャスト',
            u'thumbの値',
            u'Card_thumb_52_52.png',
            u'Card_thumb_60_75.png',
            u'Card_thumb_110_138.png',
            u'Card_thumb_320_400.png',
            u'Card_thumb_320_314.png',
            u'Card_thumb_70_88.png',
        )

        cardmasterlist = CardMasterView.fetchValues(filters=filter_json,
                                                    order_by='id',
                                                    limit=PAGE_CONTENT_NUM,
                                                    offset=offset,
                                                    using=settings.DB_READONLY)

        datalist = []
        for cardmaster in cardmasterlist:
            row = [
                cardmaster.id,
                cardmaster.name,
                cardmaster.thumb,
                (self.makeAppImgUrl(CardUtil.makeThumbnailUrlIcon(cardmaster)),
                 52, 52),
                (self.makeAppImgUrl(
                    CardUtil.makeThumbnailUrlSmall(cardmaster)), 60, 75),
                (self.makeAppImgUrl(
                    CardUtil.makeThumbnailUrlMiddle(cardmaster)), 110, 138),
                (self.makeAppImgUrl(
                    CardUtil.makeThumbnailUrlLarge(cardmaster)), 320, 400),
                (self.makeAppImgUrl(
                    CardUtil.makeThumbnailUrlBustup(cardmaster)), 320, 314),
            ]
            if cardmaster.rare in Defines.Rarity.EVOLUTION_ABLES:
                row.append((self.makeAppImgUrl(
                    CardUtil.makeThumbnailUrlMemory(cardmaster)), 70, 88))
            else:
                row.append('')
            datalist.append(row)
        self.putData(titles, datalist)

        url = OSAUtil.addQuery(UrlMaker.view_images(), '_target', 'Card')
        url = OSAUtil.addQuery(url, '_filter',
                               urllib.quote(self.html_param['_filter'], ''))
        self.putPagenationData(url, page, pagemax)
示例#6
0
    def proc_EVOL00_ANIM(self, basecard, materialcard):
        """ハメ管理合成アニメーション.
        """
        model_mgr = self.getModelMgr()
        params = {
            'card1':
            self.makeAppLinkUrlImg(
                CardUtil.makeThumbnailUrlMiddle(basecard.master)),
            'card2':
            self.makeAppLinkUrlImg(
                CardUtil.makeThumbnailUrlMiddle(materialcard.master)),
            'startText':
            Defines.EffectTextFormat.EVOLUTION_STARTTEXT,
            'backUrl':
            self.makeAppLinkUrl(self.makeUrlNext()),
        }
        basecard_post, _ = BackendApi.tutorial_evolution(
            model_mgr, basecard, materialcard, using=settings.DB_READONLY)
        params['mixCard'] = self.makeAppLinkUrlImg(
            CardUtil.makeThumbnailUrlMiddle(basecard_post.master))
        params['endText'] = Defines.EffectTextFormat.EVOLUTION_ENDTEXT % (
            basecard_post.master.name, basecard_post.master.hklevel - 1,
            basecard_post.card.takeover)
        params[
            'endText2'] = Defines.EffectTextFormat.EVOLUTION_ENDTEXT2 % basecard_post.master.maxlevel
        params['endText3'] = Defines.EffectTextFormat.EVOLUTION_ENDTEXT3_MOVIE

        v_player = self.getViewerPlayer(True)
        mid = basecard_post.master.id
        if self.is_pc:
            memoriesmaster = BackendApi.get_tutorial_pcmemories(
                model_mgr, v_player.ptype, using=settings.DB_READONLY)
        else:
            memoriesmaster = BackendApi.get_tutorial_memories(
                model_mgr, v_player.ptype, using=settings.DB_READONLY)
        card_acquisition = CardAcquisition.makeInstance(
            CardAcquisition.makeID(basecard_post.card.uid, mid))

        obj_memories = Objects.memoriesmaster(self, memoriesmaster,
                                              card_acquisition)
        params['miniCard1'] = obj_memories['thumbUrl']

        self.appRedirectToEffect('gousei/effect.html', params)
示例#7
0
 def itemthumbnail_middle(self):
     if self.__imaster and self.present.itype in (Defines.ItemType.CARD,
                                                  Defines.ItemType.ITEM):
         if self.present.itype == Defines.ItemType.CARD:
             return CardUtil.makeThumbnailUrlMiddle(self.__imaster)
         else:
             return ItemUtil.makeThumbnailUrlMiddle(self.__imaster)
     elif self.__imaster and self.present.itype == Defines.ItemType.EVENT_GACHATICKET:
         return ItemUtil.makeThumbnailUrlMiddleByDBString(
             self.__imaster.ticketthumb)
     elif self.__imaster and self.present.itype == Defines.ItemType.SCOUTEVENT_TANZAKU:
         return self.__imaster.tanzakuthumb
     elif self.present.itype == Defines.ItemType.ADDITIONAL_GACHATICKET:
         return ItemUtil.makeThumbnailUrlMiddleByDBString(
             Defines.GachaConsumeType.GachaTicketType.THUMBNAIL[
                 self.present.ivalue])
     else:
         return ItemUtil.makeThumbnailUrlMiddleByType(self.present.itype)
示例#8
0
    def process(self):
        v_player = self.getViewerPlayer()
        model_mgr = self.getModelMgr()

        # 合成結果.
        evolutiondata = BackendApi.get_evolutiondata(
            model_mgr, v_player.id, using=settings.DB_READONLY)

        # 進化後カード.
        basecardset = BackendApi.get_cards([evolutiondata.result_baseid],
                                           model_mgr,
                                           using=settings.DB_READONLY)
        if not basecardset:
            if settings_sub.IS_LOCAL:
                raise CabaretError(u'ハメ管理したキャストが見つかりません.')
            url = UrlMaker.evolution()
            self.appRedirect(self.makeAppLinkUrlRedirect(url))
            return
        basecardset = basecardset[0]

        # ベースカード.
        pre_master = BackendApi.get_cardmasters(
            [evolutiondata.mid], model_mgr,
            using=settings.DB_READONLY).get(evolutiondata.mid)
        if pre_master is None or (pre_master.albumhklevel +
                                  1) != basecardset.master.albumhklevel:
            if settings_sub.IS_LOCAL:
                raise CabaretError(u'ハメ管理前のキャストが見つかりません.')
            url = UrlMaker.evolution()
            self.appRedirect(self.makeAppLinkUrlRedirect(url))
            return

        # 素材カード.
        materialcard = BackendApi.get_cards([evolutiondata.result_materialid],
                                            model_mgr,
                                            using=settings.DB_READONLY,
                                            deleted=True)
        if not materialcard:
            if settings_sub.IS_LOCAL:
                raise CabaretError(u'ハメ管理に使用したキャストが見つかりません.')
            url = UrlMaker.evolution()
            self.appRedirect(self.makeAppLinkUrlRedirect(url))
            return
        materialcard = materialcard[0]

        miniImg = {}
        endText2 = None
        endText3 = None
        # 文言.
        endText = Defines.EffectTextFormat.EVOLUTION_ENDTEXT % (
            basecardset.master.name, basecardset.master.hklevel - 1,
            evolutiondata.result_takeover)
        if evolutiondata.result_flag_memories_open:
            movie = False
            memories_list = BackendApi.get_album_memories_list(
                self,
                v_player.id,
                basecardset.master.album,
                using=settings.DB_READONLY)

            if memories_list:
                cnt = 0
                for memories in memories_list:
                    if memories.get(
                            'cardid'
                    ) != basecardset.master.id or not memories.get('is_new'):
                        continue
                    elif memories.get(
                            'contenttype') == Defines.MemoryContentType.MOVIE:
                        movie = True
                    if cnt < 2:
                        cnt += 1
                        miniImg['miniCard%d' % cnt] = memories['thumbUrl']

            endText2 = Defines.EffectTextFormat.EVOLUTION_ENDTEXT2 % basecardset.master.maxlevel

            # 思い出アルバム開放.
            if movie:
                endText3 = Defines.EffectTextFormat.EVOLUTION_ENDTEXT3_MOVIE
            else:
                endText3 = Defines.EffectTextFormat.EVOLUTION_ENDTEXT3_MEMORIES

        params = {
            'card1':
            self.makeAppLinkUrlImg(
                CardUtil.makeThumbnailUrlMiddle(pre_master)),
            'card2':
            self.makeAppLinkUrlImg(
                CardUtil.makeThumbnailUrlMiddle(materialcard.master)),
            'mixCard':
            self.makeAppLinkUrlImg(
                CardUtil.makeThumbnailUrlMiddle(basecardset.master)),
            'startText':
            Defines.EffectTextFormat.EVOLUTION_STARTTEXT,
            'endText':
            endText,
            'backUrl':
            self.makeAppLinkUrl(UrlMaker.evolutionresult()),
        }
        if endText2:
            params['endText2'] = endText2
        if endText3:
            params['endText3'] = endText3
        params.update(**miniImg)
        self.appRedirectToEffect('gousei/effect.html', params)
示例#9
0
    def procRarityAnim(self, args):
        """レア度上昇演出
        """
        model_mgr = self.getModelMgr()
        v_player = self.getViewerPlayer()

        # カードのorder情報を取得する
        new_order = args.getInt(1)
        old_order = args.getInt(2)

        cur_eventmaster = BackendApi.get_current_produce_event_master(
            model_mgr, using=settings.DB_READONLY)

        if not cur_eventmaster:
            raise CabaretError(u'イベントは終了しました', CabaretError.Code.EVENT_CLOSED)

        raidbattle = BackendApi.get_raid_battleresult(
            model_mgr, v_player.id, using=settings.DB_READONLY)
        if raidbattle is None:
            if settings_sub.IS_LOCAL:
                raise CabaretError(u'想定外の遷移です')
            url = UrlMaker.producehappening()
            self.appRedirect(self.makeAppLinkUrlRedirect(url))
            return

        # レイド情報を取得.
        raidboss = None
        happeningraidset = BackendApi.get_producehappeningraidset(
            model_mgr, raidbattle.raidid, using=settings.DB_READONLY)
        if happeningraidset:
            raidboss = happeningraidset.raidboss
        if raidboss is None:
            raise CabaretError(u'超太客が存在しません', CabaretError.Code.NOT_DATA)

        animdata = raidbattle.process
        is_win = animdata.winFlag

        # 結果へのURL.
        happeningset = BackendApi.get_producehappening(
            model_mgr, raidbattle.raidid, using=settings.DB_READONLY)
        eventid = HappeningUtil.get_produceeventid(
            happeningset.happening.event)
        if cur_eventmaster and cur_eventmaster.id == eventid:
            url = UrlMaker.produceraidresultanim()
        elif is_win:
            url = UrlMaker.produceraidend(raidbattle.raidid)
        else:
            url = UrlMaker.produceraidresult()

        params = {}
        castmasters = cur_eventmaster.get_produce_castmasters(
            filters={'order__in': [old_order, new_order]},
            order_by='order',
            using=settings.DB_READONLY)

        old_rarity_card = BackendApi.get_model(model_mgr, CardMasterView,
                                               castmasters[0].produce_cast)
        new_rarity_card = BackendApi.get_model(model_mgr, CardMasterView,
                                               castmasters[1].produce_cast)

        params['backUrl'] = self.makeAppLinkUrl(url)
        params['old_rarity'] = self.makeAppLinkUrlImg(
            CardUtil.makeThumbnailUrlMiddle(old_rarity_card))
        params['new_rarity'] = self.makeAppLinkUrlImg(
            CardUtil.makeThumbnailUrlMiddle(new_rarity_card))

        self.appRedirectToEffect('produce_event/produce_rareup/effect.html',
                                 params)