示例#1
0
 def setUp(self):
     # カード.
     table = []
     cardmaster = self.create_dummy(DummyType.CARD_MASTER)
     data = GachaBoxCardData(cardmaster.id, 10000)
     table.append(data.to_data())
     
     # グループ.
     group = self.create_dummy(DummyType.GACHA_GROUP_MASTER, table=table)
     
     # おまけ.
     item = self.create_dummy(DummyType.ITEM_MASTER)
     prize = self.create_dummy(DummyType.PRIZE_MASTER, item=item, itemnum=1)
     bonus = [prize.id]
     
     # ガチャ.
     continuity = 10
     boxdata = GachaBoxGroupData(group.id, 10000, continuity)
     box = [boxdata.to_data()]
     self.__gachamaster_gachapt = self.create_dummy(DummyType.GACHA_MASTER, box=box, bonus=bonus, continuity=continuity, consumetype=Defines.GachaConsumeType.GACHAPT, consumevalue=10)
     self.__gachamaster_ticket = self.create_dummy(DummyType.GACHA_MASTER, box=box, bonus=bonus, continuity=continuity, consumetype=Defines.GachaConsumeType.TRYLUCKTICKET, consumevalue=1)
     self.__gachamaster_pay = self.create_dummy(DummyType.GACHA_MASTER, box=box, bonus=bonus, continuity=continuity, consumetype=Defines.GachaConsumeType.PAYMENT, consumevalue=10)
     
     # プレイヤー.
     self.__player = self.create_dummy(DummyType.PLAYER)
     
     # 引抜ポイントとチケット.
     playergachapt = self.__player.getModel(PlayerGachaPt)
     playergachapt.gachapt = continuity * 10
     playergachapt.ticket = 1
     playergachapt.save()
     
     # カード所持上限.
     playerdeck = self.__player.getModel(PlayerDeck)
     playerdeck.cardlimitlv = continuity
     playerdeck.save()
     
     # プレイ情報.
     self.__playdata_gachapt = self.create_dummy(DummyType.GACHA_PLAY_DATA, self.__player.id, self.__gachamaster_gachapt.boxid)
     self.__playdata_ticket = self.create_dummy(DummyType.GACHA_PLAY_DATA, self.__player.id, self.__gachamaster_ticket.boxid)
     self.__playdata_pay = self.create_dummy(DummyType.GACHA_PLAY_DATA, self.__player.id, self.__gachamaster_pay.boxid)
     
     self.__gachamaster = self.__gachamaster_gachapt
     self.__playdata = self.__playdata_gachapt
     
     # 課金レコード.
     self.__payment_entry = self.create_dummy(DummyType.GACHA_PAYMENT_ENTRY, self.__player.id, self.__gachamaster.id, PaymentData.Status.START, continuity)
     
     self.__present_num = BackendApi.get_present_num(self.__player.id)
     self.__cardnum = BackendApi.get_cardnum(self.__player.id)
示例#2
0
 def setUp(self):
     # カード.
     table = []
     cardmaster = self.create_dummy(DummyType.CARD_MASTER)
     data = GachaBoxCardData(cardmaster.id, 10000)
     table.append(data.to_data())
     
     # グループ.
     group = self.create_dummy(DummyType.GACHA_GROUP_MASTER, table=table)
     
     # おまけ.
     item = self.create_dummy(DummyType.ITEM_MASTER)
     prize = self.create_dummy(DummyType.PRIZE_MASTER, item=item, itemnum=1)
     bonus = [prize.id]
     
     # ガチャ.
     continuity = 10
     boxdata = GachaBoxGroupData(group.id, 10000, continuity)
     box = [boxdata.to_data()]
     self.__gachamaster_gachapt = self.create_dummy(DummyType.GACHA_MASTER, box=box, bonus=bonus, continuity=continuity, consumetype=Defines.GachaConsumeType.GACHAPT, consumevalue=10)
     self.__gachamaster_ticket = self.create_dummy(DummyType.GACHA_MASTER, box=box, bonus=bonus, continuity=continuity, consumetype=Defines.GachaConsumeType.TRYLUCKTICKET, consumevalue=1)
     self.__gachamaster_pay = self.create_dummy(DummyType.GACHA_MASTER, box=box, bonus=bonus, continuity=continuity, consumetype=Defines.GachaConsumeType.PAYMENT, consumevalue=10)
     
     # プレイヤー.
     self.__player = self.create_dummy(DummyType.PLAYER)
     
     # 引抜ポイントとチケット.
     playergachapt = self.__player.getModel(PlayerGachaPt)
     playergachapt.gachapt = continuity * 10
     playergachapt.ticket = 1
     playergachapt.save()
     
     # カード所持上限.
     playerdeck = self.__player.getModel(PlayerDeck)
     playerdeck.cardlimitlv = continuity
     playerdeck.save()
     
     # プレイ情報.
     self.__playdata_gachapt = self.create_dummy(DummyType.GACHA_PLAY_DATA, self.__player.id, self.__gachamaster_gachapt.boxid)
     self.__playdata_ticket = self.create_dummy(DummyType.GACHA_PLAY_DATA, self.__player.id, self.__gachamaster_ticket.boxid)
     self.__playdata_pay = self.create_dummy(DummyType.GACHA_PLAY_DATA, self.__player.id, self.__gachamaster_pay.boxid)
     
     self.__gachamaster = self.__gachamaster_gachapt
     self.__playdata = self.__playdata_gachapt
     
     model_mgr = ModelRequestMgr()
     BackendApi.tr_play_gacha_free(model_mgr, self.__player, self.__gachamaster, self.__player.req_confirmkey, continuity, OSAUtil.get_now())
     model_mgr.write_all()
     model_mgr.write_end()
示例#3
0
    def setUp(self):
        # カード.
        table = []
        cardmaster = self.create_dummy(DummyType.CARD_MASTER)
        data = GachaBoxCardData(cardmaster.id, 10000)
        table.append(data.to_data())

        # グループ.
        group = self.create_dummy(DummyType.GACHA_GROUP_MASTER, table=table)

        # おまけ.
        item = self.create_dummy(DummyType.ITEM_MASTER)
        prize = self.create_dummy(DummyType.PRIZE_MASTER, item=item, itemnum=1)
        bonus = [prize.id]

        # ガチャ.
        continuity = 10
        boxdata = GachaBoxGroupData(group.id, 10000, continuity)
        box = [boxdata.to_data()]
        self.__gachamaster_gachapt = self.create_dummy(
            DummyType.GACHA_MASTER,
            box=box,
            bonus=bonus,
            continuity=continuity,
            consumetype=Defines.GachaConsumeType.GACHAPT,
            consumevalue=10)
        self.__gachamaster_ticket = self.create_dummy(
            DummyType.GACHA_MASTER,
            box=box,
            bonus=bonus,
            continuity=continuity,
            consumetype=Defines.GachaConsumeType.TRYLUCKTICKET,
            consumevalue=1)
        self.__gachamaster_pay = self.create_dummy(
            DummyType.GACHA_MASTER,
            box=box,
            bonus=bonus,
            continuity=continuity,
            consumetype=Defines.GachaConsumeType.PAYMENT,
            consumevalue=10)

        # プレイヤー.
        self.__player = self.create_dummy(DummyType.PLAYER)

        # 引抜ポイントとチケット.
        playergachapt = self.__player.getModel(PlayerGachaPt)
        playergachapt.gachapt = continuity * 10
        playergachapt.ticket = continuity * 1
        playergachapt.save()
示例#4
0
 def __valid_master(self, master):
     if not master.is_public:
         return
     cnt = 0
     rate_total = 0
     try:
         for data in master.box:
             groupdata = GachaBoxGroupData.createByBoxData(data)
             groupdata.validate(self.getModelMgr())
             if 0 < groupdata.rate:
                 cnt += 1
                 rate_total += groupdata.rate
     except CabaretError, err:
         raise ModelEditValidError('%s, box=%d' % (err.value, master.id))
示例#5
0
    def setUp(self):

        # カード.
        table = []
        cardmaster = self.create_dummy(DummyType.CARD_MASTER)
        data = GachaBoxCardData(cardmaster.id, 10000, ApiTest.RANKING_POINT)
        table.append(data.to_data())

        # グループ.
        group = self.create_dummy(DummyType.GACHA_GROUP_MASTER, table=table)

        # おまけ.
        item = self.create_dummy(DummyType.ITEM_MASTER)
        prize = self.create_dummy(DummyType.PRIZE_MASTER, item=item, itemnum=1)
        bonus = [prize.id]

        # ガチャ.
        continuity = 10
        boxdata = GachaBoxGroupData(group.id, 10000, continuity + 1)
        box = [boxdata.to_data()]
        self.__gachamaster_gachapt = self.create_dummy(
            DummyType.GACHA_MASTER,
            box=box,
            bonus=bonus,
            continuity=continuity,
            consumetype=Defines.GachaConsumeType.GACHAPT,
            consumevalue=10)
        self.__gachamaster_ticket = self.create_dummy(
            DummyType.GACHA_MASTER,
            box=box,
            bonus=bonus,
            continuity=continuity,
            consumetype=Defines.GachaConsumeType.TRYLUCKTICKET,
            consumevalue=1)
        self.__gachamaster_pay = self.create_dummy(
            DummyType.GACHA_MASTER,
            box=box,
            bonus=bonus,
            continuity=continuity,
            consumetype=Defines.GachaConsumeType.RANKING,
            consumevalue=10)

        # ランキング.
        rankingprizes = [
            (1, bonus),
        ]
        wholeprizes = {
            'normal': [
                (ApiTest.RANKING_POINT, bonus),
            ]
        }
        self.__rankingmaster = self.create_dummy(
            DummyType.RANKING_GACHA_MASTER,
            self.__gachamaster_pay.boxid,
            singleprizes=rankingprizes,
            totalprizes=rankingprizes,
            wholeprizes=wholeprizes,
            wholewinprizes=bonus)
        self.__queue_cnt = RankingGachaWholePrizeQueue.count()

        # プレイヤー.
        self.__player = self.create_dummy(DummyType.PLAYER)

        # 引抜ポイントとチケット.
        playergachapt = self.__player.getModel(PlayerGachaPt)
        playergachapt.gachapt = continuity * 10
        playergachapt.ticket = 1
        playergachapt.save()

        # カード所持上限.
        playerdeck = self.__player.getModel(PlayerDeck)
        playerdeck.cardlimitlv = continuity
        playerdeck.save()

        # プレイ情報.
        self.__playdata_gachapt = self.create_dummy(
            DummyType.GACHA_PLAY_DATA, self.__player.id,
            self.__gachamaster_gachapt.boxid)
        self.__playdata_ticket = self.create_dummy(
            DummyType.GACHA_PLAY_DATA, self.__player.id,
            self.__gachamaster_ticket.boxid)
        self.__playdata_pay = self.create_dummy(DummyType.GACHA_PLAY_DATA,
                                                self.__player.id,
                                                self.__gachamaster_pay.boxid)

        self.__gachamaster = self.__gachamaster_pay
        self.__playdata = self.__playdata_pay

        # 課金レコード.
        self.__payment_entry = self.create_dummy(DummyType.GACHA_PAYMENT_ENTRY,
                                                 self.__player.id,
                                                 self.__gachamaster.id,
                                                 PaymentData.Status.START,
                                                 continuity)

        self.__present_num = BackendApi.get_present_num(self.__player.id)
        self.__cardnum = BackendApi.get_cardnum(self.__player.id)
示例#6
0
 def setUp(self):
     # DMMID.
     self.__player = self.create_dummy(DummyType.PLAYER)
     self.__player.lbtime = OSAUtil.get_now()
     self.__player.getModel(PlayerLogin).save()
     
     # デッキ.
     deck = Deck(id=self.__player.id)
     cardmaster = self.create_dummy(DummyType.CARD_MASTER)
     deck.leader = self.create_dummy(DummyType.CARD, self.__player, cardmaster).id
     
     for i in xrange(9):
         cardmaster = self.create_dummy(DummyType.CARD_MASTER)
         setattr(deck, 'mamber%d' % i, self.create_dummy(DummyType.CARD, self.__player, cardmaster).id)
     
     deck.save()
     
     # お知らせ.
     for _ in range(5):
         self.create_dummy(DummyType.TOP_BANNER_MASTER)
     
     # イベント発生設定.
     config = BackendApi.get_current_scouteventconfig(ModelRequestMgr())
     self.__preconfig_mid = config.mid
     BackendApi.update_scouteventconfig(0, config.starttime, config.endtime)
     
     # カード.
     table = []
     cardmaster = self.create_dummy(DummyType.CARD_MASTER)
     data = GachaBoxCardData(cardmaster.id, 10000)
     table.append(data.to_data())
     
     # グループ.
     group = self.create_dummy(DummyType.GACHA_GROUP_MASTER, table=table)
     
     # おまけ.
     item = self.create_dummy(DummyType.ITEM_MASTER)
     prize = self.create_dummy(DummyType.PRIZE_MASTER, item=item, itemnum=1)
     bonus = [prize.id]
     
     # ガチャ.
     continuity = 10
     boxdata = GachaBoxGroupData(group.id, 10000, continuity+1)
     box = [boxdata.to_data()]
     self.__gachamaster = self.create_dummy(DummyType.GACHA_MASTER, box=box, bonus=bonus, continuity=continuity, consumetype=Defines.GachaConsumeType.RANKING, consumevalue=10)
     
     # ランキングガチャマスター.
     wholeprizes = {
         'normal' : [(1, bonus),]
     }
     self.__rankingmaster = self.create_dummy(DummyType.RANKING_GACHA_MASTER, self.__gachamaster.boxid, wholeprizes=wholeprizes)
     
     # 達成報酬キュー.
     queue0 = self.create_dummy(DummyType.RANKING_GACHA_WHOLE_PRIZE_QUEUE, self.__rankingmaster.id, point=100, prizes=bonus)
     queue1 = self.create_dummy(DummyType.RANKING_GACHA_WHOLE_PRIZE_QUEUE, self.__rankingmaster.id, point=1000, prizes=bonus)
     self.__queue = queue1
     
     # 初めてプレイした時間.
     self.create_dummy(DummyType.RANKING_GACHA_SCORE, self.__player.id, self.__rankingmaster.id, firstpoint=queue1.point)
     
     # 受け取ったキューのID.
     self.create_dummy(DummyType.RANKING_GACHA_WHOLE_PRIZE_DATA, self.__player.id, queue0.id - 1)
     
     # 全プレ.
     presenteveryone_list = BackendApi.get_presenteveryone_list_formypage(ModelRequestMgr())
     prizeidlist = []
     for presenteveryone in presenteveryone_list:
         prizeidlist.extend(presenteveryone.prizes)
     prizelist = BackendApi.get_prizelist(ModelRequestMgr(), prizeidlist)
     self.__presenteveryone_presentlist = BackendApi.create_present_by_prize(ModelRequestMgr(), 0, prizelist, 0, do_set_save=False)
     
     # ミッション報酬を受け取ってしまう.
     model_mgr = ModelRequestMgr()
     missionplaydata = BackendApi.get_current_panelmission_data(model_mgr, self.__player.id)
     if missionplaydata:
         panel = missionplaydata.mid
         
         # マイページで確認するミッション.
         mission_executer = PanelMissionConditionExecuter()
         
         # 更新確認.
         is_update = BackendApi.check_lead_update_panelmission(model_mgr, self.__player, panel, OSAUtil.get_now(), mission_executer)
         if is_update:
             def write():
                 model_mgr = ModelRequestMgr()
                 if mission_executer.isNeedCheck():
                     BackendApi.tr_complete_panelmission(model_mgr, self.__player.id, mission_executer, OSAUtil.get_now())
                 BackendApi.tr_receive_panelmission(model_mgr, self.__player.id, panel, self.__player.req_confirmkey, OSAUtil.get_now())
                 model_mgr.write_all()
                 model_mgr.write_end()
             write()
     
     self.__present_num = BackendApi.get_present_num(self.__player.id)