Beispiel #1
0
 def setUp(self):
     # DMMID.
     self.__player = self.create_dummy(DummyType.PLAYER)
     
     self.__sell_card_idlist = []
     
     # デッキ.
     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)
     
     stocknums = {}
     for i in xrange(10):
         cardmaster = self.create_dummy(DummyType.CARD_MASTER, rare=Defines.Rarity.TRANSFER[0])
         card = self.create_dummy(DummyType.CARD, self.__player, cardmaster)
         self.__sell_card_idlist.append(card.id)
         stocknums[cardmaster.id] = stocknums.get(cardmaster.id, 0) + 1
     
     self.__stocknums = stocknums
     
     deck.save()
Beispiel #2
0
    def setUp(self):
        # DMMID.
        self.__player = self.create_dummy(DummyType.PLAYER)

        self.__sell_card_idlist = []

        # デッキ.
        deck = Deck(id=self.__player.id)
        cardmaster = self.create_dummy(DummyType.CARD_MASTER)
        deck.leader = self.create_dummy(DummyType.CARD, self.__player,
                                        cardmaster).id
        #        self.__sell_card_idlist.append(deck.leader)

        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)
#            self.__sell_card_idlist.append(getattr(deck, 'mamber%d' % i))

        for i in xrange(10):
            cardmaster = self.create_dummy(DummyType.CARD_MASTER)
            card = self.create_dummy(DummyType.CARD, self.__player, cardmaster)
            #            card.protection = True
            #            card.save()
            self.__sell_card_idlist.append(card.id)

        deck.save()
Beispiel #3
0
    def setUp(self):
        # DMMID.
        self.__player = self.create_dummy(DummyType.PLAYER)
        uid = self.__player.id

        for _ in xrange(16):
            o_player = self.create_dummy(DummyType.PLAYER)
            oid = o_player.id
            model_mgr = ModelRequestMgr()
            deck = Deck(id=oid)
            cardmaster = self.create_dummy(DummyType.CARD_MASTER)
            deck.leader = self.create_dummy(DummyType.CARD, o_player,
                                            cardmaster).id
            model_mgr.set_save(deck)
            BackendApi.tr_greet(model_mgr, oid, uid, False)
            model_mgr.write_all()
            model_mgr.write_end()
Beispiel #4
0
    def setUp(self):
        # Player.
        self.__player0 = self.create_dummy(DummyType.PLAYER)
        self.__player1 = self.create_dummy(DummyType.PLAYER)

        # デッキ.
        deck = Deck(id=self.__player1.id)
        cardmaster = self.create_dummy(DummyType.CARD_MASTER)
        deck.leader = self.create_dummy(DummyType.CARD, self.__player1,
                                        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.__player1,
                                  cardmaster).id)
        deck.save()
Beispiel #5
0
    def check(self):

        deck = Deck.getByKey(self.__player.id)

        if ApiTest.AUTO:
            if len(deck.to_array()) != Defines.DECK_CARD_NUM_MAX:
                raise AppTestError(u'デッキ設定されていない')
        else:
            #            if deck.member1 == self.__deck.member1 or deck.member1 != self.__deck.member2:
            #                raise AppTestError(u'デッキ設定されていない')
            if deck.member1 != self.__card.id:
                raise AppTestError(u'デッキ設定されていない')
Beispiel #6
0
    def setUp(self):
        # Player.
        self.__player0 = self.create_dummy(DummyType.PLAYER)

        # デッキ.
        deck = Deck(id=self.__player0.id)
        cardmaster = self.create_dummy(DummyType.CARD_MASTER)

        arr = []
        for _ in xrange(Defines.DECK_CARD_NUM_MAX - 3):
            cardmaster = self.create_dummy(DummyType.CARD_MASTER)
            arr.append(
                self.create_dummy(DummyType.CARD, self.__player0,
                                  cardmaster).id)
        deck.set_from_array(arr)
        deck.save()

        # ボス.
        boss = self.create_dummy(DummyType.BOSS_MASTER)
        boss.hp = 100000
        boss.defense = 10000
        boss.save()

        # エリア.
        area = self.create_dummy(DummyType.AREA_MASTER, bossid=boss.id)

        # スカウト.
        for _ in xrange(5):
            scout = self.create_dummy(DummyType.SCOUT_MASTER, area=area)
            self.create_dummy(DummyType.SCOUT_PLAY_DATA, self.__player0.id,
                              scout.id, scout.execution)

        self.__area = area
        self.__battlekey = self.__player0.req_confirmkey
Beispiel #7
0
    def setUp(self):
        # Player.
        self.__player0 = self.create_dummy(DummyType.PLAYER)

        # デッキ.
        deck = Deck(id=self.__player0.id)
        cardmaster = self.create_dummy(DummyType.CARD_MASTER)

        arr = []
        for _ in xrange(Defines.DECK_CARD_NUM_MAX - 3):
            cardmaster = self.create_dummy(DummyType.CARD_MASTER)
            arr.append(
                self.create_dummy(DummyType.CARD, self.__player0,
                                  cardmaster).id)
        deck.set_from_array(arr)
        deck.save()

        self.setUpRaidEvent(self.__player0,
                            dedicated_stage_max=5,
                            is_open=True)

        # 進行情報.
        self.__playdata = self.create_dummy(
            DummyType.RAID_EVENT_SCOUT_PLAY_DATA,
            self.__player0.id,
            self.eventmaster.id,
            stage=1,
            cleared=1,
            progress=1)

        self.__stagemaster = self.getStageByNumber(self.__playdata.stage)
Beispiel #8
0
    def setUp(self):
        # DMMID.
        self.__player = self.create_dummy(DummyType.PLAYER)
        self.__player.deckcapacitylv = 999
        self.__player.getModel(PlayerDeck).save()

        # デッキ.
        deck = Deck(id=self.__player.id)
        cardmaster = self.create_dummy(DummyType.CARD_MASTER)

        arr = []
        for _ in xrange(Defines.DECK_CARD_NUM_MAX - 3):
            cardmaster = self.create_dummy(DummyType.CARD_MASTER)
            card = self.create_dummy(DummyType.CARD, self.__player, cardmaster)
            if not ApiTest.AUTO or len(arr) == 0:
                arr.append(card.id)
        deck.set_from_array(arr)
        deck.save()
        self.__deck = deck

        cardmaster = self.create_dummy(DummyType.CARD_MASTER)
        self.__card = self.create_dummy(DummyType.CARD, self.__player,
                                        cardmaster)

        for _ in xrange(20):
            cardmaster = self.create_dummy(DummyType.CARD_MASTER)
            self.create_dummy(DummyType.CARD, self.__player, cardmaster)
Beispiel #9
0
    def setUp(self):
        # Player.
        self.__player0 = self.create_dummy(DummyType.PLAYER)

        # デッキ.
        deck = Deck(id=self.__player0.id)
        cardmaster = self.create_dummy(DummyType.CARD_MASTER)

        arr = []
        for _ in xrange(Defines.DECK_CARD_NUM_MAX - 3):
            cardmaster = self.create_dummy(DummyType.CARD_MASTER)
            card = self.create_dummy(DummyType.CARD, self.__player0,
                                     cardmaster)
            arr.append(card.id)
        deck.set_from_array(arr)
        deck.save()

        # ボス.
        boss = self.create_dummy(DummyType.BOSS_MASTER)
        boss.hp = 1000000
        boss.defense = 10000
        boss.save()

        # 報酬.
        itemmaster = self.create_dummy(DummyType.ITEM_MASTER)
        cardmaster = self.create_dummy(DummyType.CARD_MASTER)
        prize = self.create_dummy(DummyType.PRIZE_MASTER,
                                  gold=100,
                                  gachapt=10,
                                  item=itemmaster,
                                  card=cardmaster)

        # エリア.
        area = self.create_dummy(DummyType.AREA_MASTER, bossid=boss.id)
        area.prizes = [prize.id]
        area.save()

        # スカウト.
        for _ in xrange(5):
            scout = self.create_dummy(DummyType.SCOUT_MASTER, area=area)
            self.create_dummy(DummyType.SCOUT_PLAY_DATA, self.__player0.id,
                              scout.id, scout.execution)

        self.__area = area

        bosshp, animdata = BackendApi.bossbattle(BackendApi.get_cards(arr),
                                                 boss)

        model_mgr = ModelRequestMgr()
        if bosshp < 1:
            BackendApi.tr_area_clear(model_mgr, self.__player0, area)
        BackendApi.tr_save_bossresult(model_mgr, self.__player0.id, area, boss,
                                      animdata, self.__player0.req_confirmkey)
        model_mgr.write_all()
        model_mgr.write_end()
        self.__battlekey = self.__player0.req_confirmkey

        self.create_dummy(DummyType.EVENT_BANNER_MASTER)
Beispiel #10
0
    def setUp(self):
        # Player.
        self.__player0 = self.create_dummy(DummyType.PLAYER)

        self.__boss = self.create_dummy(DummyType.BOSS_MASTER)
        self.__boss.hp = 1
        self.__boss.save()

        # デッキ.
        deck = Deck(id=self.__player0.id)
        cardmaster = self.create_dummy(DummyType.CARD_MASTER)

        arr = []
        for _ in xrange(Defines.DECK_CARD_NUM_MAX - 3):
            cardmaster = self.create_dummy(DummyType.CARD_MASTER)
            arr.append(
                self.create_dummy(DummyType.CARD, self.__player0,
                                  cardmaster).id)
        deck.set_from_array(arr)
        deck.save()

        self.setUpRaidEvent(self.__player0,
                            dedicated_stage_max=5,
                            is_open=True)

        # 進行情報.
        self.__playdata = self.create_dummy(
            DummyType.RAID_EVENT_SCOUT_PLAY_DATA,
            self.__player0.id,
            self.eventmaster.id,
            stage=1,
            cleared=1,
            progress=1)

        self.__stagemaster = self.getStageByNumber(self.__playdata.stage)

        # ボス.
        bosshp, animdata = BackendApi.bossbattle(BackendApi.get_cards(arr),
                                                 self.__boss)

        model_mgr = ModelRequestMgr()
        if bosshp < 1:
            BackendApi.tr_raidevent_stage_clear(model_mgr, self.eventmaster,
                                                self.__player0,
                                                self.__stagemaster)
        BackendApi.tr_save_bossresult(model_mgr, self.__player0.id,
                                      self.__stagemaster, self.__boss,
                                      animdata, self.__player0.req_confirmkey)
        model_mgr.write_all()
        model_mgr.write_end()
Beispiel #11
0
 def makePlayer(self, power):
     player = self.create_dummy(DummyType.PLAYER)
     player.deckcapacitylv = 999
     player.getModel(PlayerDeck).save()
     
     # デッキ.
     deck = Deck(id=player.id)
     
     arr = []
     for _ in xrange(Defines.DECK_CARD_NUM_MAX - 3):
         cardmaster = self.create_dummy(DummyType.CARD_MASTER, basepower=power, maxpower=power)
         card = self.create_dummy(DummyType.CARD, player, cardmaster)
         arr.append(card.id)
     deck.set_from_array(arr)
     deck.save()
     
     return player
Beispiel #12
0
    def setUp(self):
        # DMMID.
        self.__player = self.create_dummy(DummyType.PLAYER)

        # デッキ.
        deck = Deck(id=self.__player.id)
        cardmaster = self.create_dummy(DummyType.CARD_MASTER)

        arr = []
        for _ in xrange(Defines.DECK_CARD_NUM_MAX - 3):
            cardmaster = self.create_dummy(DummyType.CARD_MASTER)
            arr.append(
                self.create_dummy(DummyType.CARD, self.__player,
                                  cardmaster).id)
        deck.set_from_array(arr)
        deck.save()

        cardmaster = self.create_dummy(DummyType.CARD_MASTER)
        self.__card0 = self.create_dummy(DummyType.CARD, self.__player,
                                         cardmaster)
Beispiel #13
0
 def setUp(self):
     # Player.
     self.__player0 = self.create_dummy(DummyType.PLAYER)
     
     # デッキ.
     deck = Deck(id=self.__player0.id)
     cardmaster = self.create_dummy(DummyType.CARD_MASTER)
     
     arr = []
     for _ in xrange(Defines.DECK_CARD_NUM_MAX - 3):
         cardmaster = self.create_dummy(DummyType.CARD_MASTER)
         arr.append(self.create_dummy(DummyType.CARD, self.__player0, cardmaster).id)
     deck.set_from_array(arr)
     deck.save()
     
     # ボス.
     boss = self.create_dummy(DummyType.BOSS_MASTER)
     boss.hp = 1
     boss.defense = 1
     boss.save()
     
     # 報酬.
     itemmaster = self.create_dummy(DummyType.ITEM_MASTER)
     cardmaster = self.create_dummy(DummyType.CARD_MASTER)
     prize = self.create_dummy(DummyType.PRIZE_MASTER, gold=100, gachapt=10, item=itemmaster, card=cardmaster)
     
     # エリア.
     area = self.create_dummy(DummyType.AREA_MASTER, bossid=boss.id)
     area.prizes = [prize.id]
     area.save()
     
     # スカウト.
     for _ in xrange(5):
         scout = self.create_dummy(DummyType.SCOUT_MASTER, area=area)
         self.create_dummy(DummyType.SCOUT_PLAY_DATA, self.__player0.id, scout.id, scout.execution)
     
     self.__area = area
Beispiel #14
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)
 def handle(self, *args, **options):
     
     print '================================'
     print 'aggregate_deckmember'
     print '================================'
     
     # 出力先.
     path = OSAUtil.get_now().strftime(args[0])
     
     # 書き込むデータをここに溜め込む.
     writer = Command.Writer(path)
     
     # 対象を更新.
     LoginTimeCloneSet.update()
     
     # アクティブユーザだと判定される日数.
     now = OSAUtil.get_now()
     border_date = now - datetime.timedelta(days=Defines.ACTIVE_DAYS)
     
     LIMIT = 300
     
     model_mgr = ModelRequestMgr()
     cardmasters = dict([(master.id, master) for master in model_mgr.get_mastermodel_all(CardMaster, fetch_deleted=True, using=backup_db)])
     cardsortmasters = dict([(master.id, master) for master in model_mgr.get_mastermodel_all(CardSortMaster, fetch_deleted=True, using=backup_db)])
     
     # ヘッダ列.
     title = [u'ユーザID']
     for _ in xrange(Defines.DECK_CARD_NUM_MAX):
         title.extend([u'name', u'rare', u'hklevel', u'level', u'power'])
     for rare in Defines.Rarity.LIST:
         title.append(Defines.Rarity.NAMES[rare])
     writer.add(','.join(title))
     del title
     
     offset = 0
     while True:
         uidlist = LoginTimeCloneSet.fetchByRange(border_date, now, LIMIT, offset)
         
         # デッキ取得.
         decklist = Deck.getByKey(uidlist, using=backup_db)
         
         for deck in decklist:
             row = []
             
             raremap = {}
             
             # カード取得.
             cardidlist = deck.to_array()
             cards = dict([(card.id, card) for card in Card.getByKey(cardidlist, using=backup_db)])
             
             # ユーザID.
             row.append(str(deck.id))
             
             for cardid in cardidlist:
                 card = cards.get(cardid)
                 master = None
                 sortmaster = None
                 if card:
                     master = cardmasters.get(card.mid)
                     sortmaster = cardsortmasters.get(card.mid)
                 
                 if card is None or master is None or sortmaster is None:
                     name = u'不明'
                     rare = u'不明'
                     hklevel = u'不明'
                     level = u'不明'
                     power = u'不明'
                 else:
                     # カード名.
                     name = str(master.name)
                     # レア度.
                     rare = str(sortmaster.rare)
                     # ハメ管理度.
                     hklevel = str(sortmaster.hklevel)
                     # レベル.
                     level = str(card.level)
                     # 接客力.
                     power = str(CardUtil.calcPower(master.gtype, master.basepower, master.maxpower, card.level, master.maxlevel, card.takeover))
                     
                     raremap[sortmaster.rare] = raremap.get(sortmaster.rare, 0) + 1
                 
                 row.extend([name, rare, hklevel, level, power])
             
             for _ in xrange(Defines.DECK_CARD_NUM_MAX - len(cardidlist)):
                 row.extend(['', '', '', '', ''])
             
             for rare in Defines.Rarity.LIST:
                 row.append(str(raremap.get(rare, 0)))
             
             line = ','.join(row)
             writer.add(line)
         
         offset += LIMIT
         
         if len(uidlist) < LIMIT:
             break
     
     writer.output(overwrite=False)
     
     print '================================'
     print 'all done..'
 def handle(self, *args, **options):
     
     print '================================'
     print 'create_benchmark_csv'
     print '================================'
     
     
     USER_ID_START = OSAUtil.BENCH_USER_ID_START
     USER_NUM = 0
     if args:
         USER_NUM = int(args[0])
     USER_NUM = max(OSAUtil.BENCH_USER_ID_NUM, USER_NUM)
     
     print '================================'
     print 'USER_NUM=%d' % USER_NUM
     
     LEVEL = 1
     GOLD = 100000
     GACHA_PT = 3000
     CARD_NUM = 100
     CARD_LIMIT = CARD_NUM + 50
     FRIEND = 50
     FRIEND_REQUEST = 50
     FRIEND_EMPTY = 50
     FRIENDLIMIT = FRIEND + FRIEND_REQUEST * 2 + FRIEND_EMPTY
     RAID_ENDTIME = DateTimeUtil.strToDateTime("20150101", "%Y%m%d")
     RAIDLOG = 100
     GREETLOG = 100
     PRESENT = int(100 / len(Defines.ItemType.PRESENT_TYPES.keys()))
     PRESENT_LIMITTIME = DateTimeUtil.strToDateTime("20150101", "%Y%m%d")
     ITEM_RNUM = 50
     ITEM_VNUM = 50
     DECK_CAPACITY = 1000000
     CABARET_TREASURE = 100000
     
     TREASURE_NUM = 20
     
     OUTPUT_DIR = os.path.join(settings_sub.TMP_DOC_ROOT, 'dummy')
     csvmgr = ModelCSVManager(OUTPUT_DIR)
     
     model_mgr = ModelRequestMgr()
     
     # 各種マスターデータ.
     levelexpmaster = model_mgr.get_model(PlayerLevelExpMaster, LEVEL)
     item_all = model_mgr.get_mastermodel_all(ItemMaster)
     card_all = [master for master in model_mgr.get_mastermodel_all(CardMaster) if master.ckind == Defines.CardKind.NORMAL and master.hklevel == 1]
     happeningall = model_mgr.get_mastermodel_all(HappeningMaster)
     arealist = model_mgr.get_mastermodel_all(AreaMaster, order_by='id')[:2]
     scoutlist = ScoutMaster.fetchValues(filters={'area__in':[area.id for area in arealist]}, order_by='id')
     treasure_gold_all = model_mgr.get_mastermodel_all(TreasureGoldMaster)
     treasure_silver_all = model_mgr.get_mastermodel_all(TreasureSilverMaster)
     treasure_bronze_all = model_mgr.get_mastermodel_all(TreasureBronzeMaster)
     
     now = OSAUtil.get_now()
     
     print '================================'
     print 'players..'
     
     class ModelList:
         def __init__(self):
             self.modellist_all = []
         
         def add(self, modellist):
             csvmgr.setModelList(modellist)
     
     modellist_all = ModelList()
     
     for i in xrange(USER_NUM):
         modellist = []
         
         uid = i + USER_ID_START
         
         # プレイヤー作成.
         player = self.install(uid)
         
         # タイプ決定とか.
         self.regist(player, levelexpmaster, GOLD, GACHA_PT, FRIENDLIMIT, CARD_LIMIT, DECK_CAPACITY, CABARET_TREASURE)
         
         modellist.append(player.getModel(Player))
         for model_cls in ModelPlayer.Meta.MODELS:
             p = player.getModel(model_cls)
             if p:
                 modellist.append(p)
         
         # スカウト完了.
         for scout in scoutlist:
             playdata = ScoutPlayData.makeInstance(ScoutPlayData.makeID(uid, scout.id))
             playdata.progress = scout.execution
             modellist.append(playdata)
             
             # フレンドの近況.
             logdata = ScoutClearLog.makeData(player.id, scout.id)
             modellist.append(logdata)
         
         for area in arealist:
             model = AreaPlayData.makeInstance(AreaPlayData.makeID(uid, area.id))
             model.clevel = levelexpmaster.level
             modellist.append(model)
             
             # フレンドの近況.
             logdata = BossWinLog.makeData(player.id, area.id)
             modellist.append(logdata)
         
         # カード付与.
         playercard = player.getModel(PlayerCard)
         cardidlist = []
         for _ in xrange(CARD_NUM):
             playercard.card += 1
             cardid = Card.makeID(uid, playercard.card)
             
             cardmaster = random.choice(card_all)
             card = BackendApi.create_card_by_master(cardmaster)
             card.id = cardid
             card.uid = uid
             modellist.append(card)
             
             cardidlist.append(cardid)
         
         # デッキ設定.
         deck = Deck()
         deck.id = uid
         deck.set_from_array(cardidlist[:Defines.DECK_CARD_NUM_MAX])
         modellist.append(deck)
         
         # カード獲得フラグ.
         for cardmaster in card_all:
             cardacquisition = CardAcquisition.makeInstance(CardAcquisition.makeID(uid, cardmaster.id))
             cardacquisition.maxlevel = cardmaster.maxlevel
             modellist.append(cardacquisition)
             
             albumacquisition = AlbumAcquisition.makeInstance(AlbumAcquisition.makeID(uid, cardmaster.album))
             modellist.append(albumacquisition)
         
         # アイテム.
         for itemmaster in item_all:
             item = Item.makeInstance(Item.makeID(uid, itemmaster.id))
             item.rnum = ITEM_RNUM
             item.vnum = ITEM_VNUM
             modellist.append(item)
         
         # レイド履歴.
         states = (Defines.HappeningState.END, Defines.HappeningState.MISS, Defines.HappeningState.CANCEL)
         for lognumber in xrange(RAIDLOG):
             happeningmaster = random.choice(happeningall)
             raidmaster = BackendApi.get_raid_master(model_mgr, happeningmaster.boss)
             self.putRaidLog(modellist, player, happeningmaster, raidmaster, states[lognumber % len(states)])
         
         # レイド.
         happeningmaster = random.choice(happeningall)
         raidmaster = BackendApi.get_raid_master(model_mgr, happeningmaster.boss)
         self.putRaid(modellist, player, happeningmaster, raidmaster, RAID_ENDTIME)
         
         # プレゼント.
         def putPresent(itype, itemid, itemvalue):
             presentlist = BackendApi.create_present(model_mgr, 0, uid, itype, itemid, itemvalue, Defines.TextMasterID.ACCESS_BONUS, PRESENT_LIMITTIME, do_set_save=False)
             modellist.extend(presentlist)
             presentlist = BackendApi.create_present(model_mgr, 0, uid, itype, itemid, itemvalue, Defines.TextMasterID.ACCESS_BONUS, now, do_set_save=False)
             modellist.extend(presentlist)
         
         for _ in xrange(PRESENT):
             putPresent(Defines.ItemType.GOLD, 0, 1000)
             putPresent(Defines.ItemType.GACHA_PT, 0, 10)
             putPresent(Defines.ItemType.ITEM, random.choice(item_all).id, 1)
             putPresent(Defines.ItemType.CARD, random.choice(card_all).id, 1)
             putPresent(Defines.ItemType.RAREOVERTICKET, 0, 1)
             putPresent(Defines.ItemType.TRYLUCKTICKET, 0, 1)
             putPresent(Defines.ItemType.MEMORIESTICKET, 0, 1)
             putPresent(Defines.ItemType.GACHATICKET, 0, 1)
             putPresent(Defines.ItemType.GOLDKEY, 0, 1)
             putPresent(Defines.ItemType.SILVERKEY, 0, 1)
         
         # 宝箱.
         def makeTreasure(masterlist, model_cls, etime):
             master = random.choice(masterlist)
             model = model_cls()
             model.uid = uid
             model.mid = master.id
             model.etime = etime
             modellist.append(model)
         
         for _ in xrange(TREASURE_NUM):
             makeTreasure(treasure_gold_all, TreasureGold, now)
             makeTreasure(treasure_gold_all, TreasureGold, PRESENT_LIMITTIME)
             
             makeTreasure(treasure_silver_all, TreasureSilver, now)
             makeTreasure(treasure_silver_all, TreasureSilver, PRESENT_LIMITTIME)
             
             makeTreasure(treasure_bronze_all, TreasureBronze, now)
             makeTreasure(treasure_bronze_all, TreasureBronze, PRESENT_LIMITTIME)
         
         modellist_all.add(modellist)
         
         print 'complete uid=%d' % uid
     
     print '================================'
     print 'friends..'
     
     # ユーザーがそろっていないと作れないレコード.
     for i in xrange(USER_NUM):
         modellist = []
         
         uid = i + USER_ID_START
         
         # フレンド設定.
         self.putFriends(modellist, uid, USER_ID_START, USER_NUM, FRIEND, FRIEND_REQUEST)
         
         # あいさつ履歴.
         fid = uid
         for _ in xrange(GREETLOG):
             fid = ((fid - USER_ID_START + 1) % USER_NUM) + USER_ID_START
             while fid == uid:
                 fid = ((fid - USER_ID_START + 1) % USER_NUM) + USER_ID_START
             
             model = GreetLog()
             model.fromid = fid
             model.toid = uid
             modellist.append(model)
         
         modellist_all.add(modellist)
         
         print 'complete uid=%d' % uid
     
     csvmgr.output()
     
     print '================================'
     print 'all done..'