示例#1
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
示例#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 load(self, apphandler):
        """表示用に必要な情報をロード.
        """
        key = 'GreetLog:fromid:%s' % self.id
        key_comment = 'GreetLogComment:fromid:%s' % self.id

        def cb(ret_data, *args, **kwargs):
            try:
                person = ret_data[key].get()
                self.params['dmmid'] = person.id
                self.params['username'] = person.nickname
            except:
                self.params['dmmid'] = ''
                self.params['username'] = u'****'

        self.params['url'] = apphandler.makeAppLinkUrl(
            UrlMaker.profile(self.fromid))

        # Personとか欲しいはず.
        request = self.makePersonApiRequest(apphandler)
        apphandler.addAppApiRequest(key, request, cb)

        # サムネ.
        model_mgr = apphandler.getModelMgr()
        deck = model_mgr.get_model(Deck,
                                   self.fromid,
                                   using=settings.DB_READONLY)
        leader = model_mgr.get_model(Card,
                                     deck.leader,
                                     using=settings.DB_READONLY)
        master = model_mgr.get_model(CardMaster,
                                     leader.mid,
                                     using=settings.DB_READONLY)
        self.params['thumbUrl'] = apphandler.makeAppLinkUrlImg(
            CardUtil.makeThumbnailUrlIcon(master))

        if self.commenttextid != '':

            def cb_comment(ret_data, *args, **kwargs):
                try:
                    result = ret_data[key_comment].get()
                    if len(result) == 1:
                        status = result[0].status
                        data = result[0].data
                        self.params['comment'] = data
                    else:
                        self.params['comment'] = u''
                except:
                    self.params['comment'] = u'********'

            data = InspectionGetRequestData()
            data.textId = self.commenttextid

            request = apphandler.osa_util.makeApiRequest(
                ApiNames.InspectionGet, data)
            apphandler.addAppApiRequest(key_comment, request, cb_comment)
        else:
            self.params['comment'] = u''
示例#4
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)
示例#5
0
    def _get_card(self, model_mgr, tradeshopitemmaster):
        carddict = BackendApi.get_cardmasters([tradeshopitemmaster.itemid], model_mgr, using=settings.DB_READONLY)
        card = carddict.get(tradeshopitemmaster.itemid)

        thumb = CardUtil.makeThumbnailUrlIcon(card)
        icon = self.makeAppLinkUrlImg(Defines.CharacterType.ICONS[card.ctype])
        rare = {
            'str': Defines.Rarity.NAMES.get(card.rare),
            'color': Defines.Rarity.COLORS.get(card.rare, '#ffffff')
        }
        next_url = UrlMaker.tradeshopyesno(tradeshopitemmaster.id)
        return self._dataformat(tradeshopitemmaster, card.name, thumb, kind=card.ckind, iconUrl=icon, rare=rare, next_url=next_url)
示例#6
0
 def itemthumbnail_rect_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.makeThumbnailUrlIcon(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)