Beispiel #1
0
    def setUp(self):
        model_mgr = ModelRequestMgr()
        now = OSAUtil.get_now()

        # Player.
        self.__player0 = self.create_dummy(DummyType.PLAYER)

        # アイテム.
        itemmaster = self.create_dummy(DummyType.ITEM_MASTER)
        data = ScoutDropItemData.create(
            Defines.ItemType.ITEM,
            itemmaster.id,
            filters={'ptype': Defines.CharacterType.TYPE_001},
            rate=10000)
        items = [data.get_dropitem_dict()]

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

        # レイドマスター.
        raidmaster = self.create_dummy(DummyType.RAID_MASTER,
                                       hp=1,
                                       prizes=[prize.id],
                                       helpprizes=[prize.id],
                                       cabaretking=100,
                                       demiworld=10)
        self.__raidmaster = raidmaster

        # ハプニング.
        happeningmaster = self.create_dummy(DummyType.HAPPENING_MASTER,
                                            raidmaster.id,
                                            items=items)
        self.__happeningmaster = happeningmaster

        # レイドイベント.
        data = ScoutHappeningData.create(happeningmaster.id, 10000)
        happenings = [data.get_dict()]
        eventmaster = self.create_dummy(DummyType.RAID_EVENT_MASTER,
                                        raidtable=happenings)
        self.__eventmaster = eventmaster

        # イベント発生中設定.
        config = BackendApi.get_current_raideventconfig(model_mgr)
        self.__preconfig_mid = config.mid
        self.__preconfig_starttime = config.starttime
        self.__preconfig_endtime = config.endtime
        self.__preconfig_timebonus = config.timebonus_time
        timebonus_time = [{
            'stime': now,
            'etime': now + datetime.timedelta(days=1),
        }]
        now = OSAUtil.get_now()
        BackendApi.update_raideventconfig(self.__eventmaster.id,
                                          now,
                                          now + datetime.timedelta(days=1),
                                          timebonus_time=timebonus_time)
Beispiel #2
0
    def setUp(self):
        # Player.
        self.__player0 = self.create_dummy(DummyType.PLAYER)

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

        # レイド.
        raidmaster = self.create_dummy(DummyType.RAID_MASTER)

        # ハプニング.
        happeningmaster = self.create_dummy(DummyType.HAPPENING_MASTER,
                                            raidmaster.id,
                                            execution=0)
        data = ScoutHappeningData.create(happeningmaster.id, 10000)
        happenings = [data.get_dict()]
        self.__happeningmaster = happeningmaster

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

        # 進行情報.
        playdata = self.create_dummy(DummyType.SCOUT_PLAY_DATA,
                                     self.__player0.id, self.__scout.id)

        # 経験値情報.
        self.create_dummy(DummyType.PLAYER_LEVEL_EXP_MASTER, 1, exp=0)
        self.create_dummy(DummyType.PLAYER_LEVEL_EXP_MASTER, 2, exp=999)
        self.__player0.level = 1
        self.__player0.exp = 0
        self.__player0.getModel(PlayerExp).save()

        self.__player0.gold = 0
        self.__player0.getModel(PlayerGold).save()

        self.__player0.cardlimititem = 100
        self.__player0.getModel(PlayerDeck).save()

        model_mgr = ModelRequestMgr()
        BackendApi.tr_do_scout(model_mgr, self.__player0, self.__scout,
                               playdata.confirmkey)
        model_mgr.write_all()
        model_mgr.write_end()

        self.__playdata = playdata
Beispiel #3
0
 def getStageParams(self):
     """ステージ情報作成.
     """
     data = ScoutHappeningData.create(self.happeningmaster.id, 10000)
     happenings = [data.get_dict()]
     
     stageparams = {
         'execution' : 100,
         'happenings' : happenings,
     }
     return stageparams
Beispiel #4
0
    def setUp(self):
        # Player.
        self.__player0 = self.create_dummy(DummyType.PLAYER)

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

        # レイド.
        raidmaster = self.create_dummy(DummyType.RAID_MASTER)

        # ハプニング.
        happeningmaster = self.create_dummy(DummyType.HAPPENING_MASTER,
                                            raidmaster.id)
        data = ScoutHappeningData.create(happeningmaster.id, 10000)
        happenings = [data.get_dict()]
        self.__happeningmaster = happeningmaster

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

        # 経験値情報.
        self.create_dummy(DummyType.PLAYER_LEVEL_EXP_MASTER, 1, exp=0)
        self.create_dummy(DummyType.PLAYER_LEVEL_EXP_MASTER, 2, exp=999)
        self.__player0.level = 1
        self.__player0.exp = 0
        self.__player0.getModel(PlayerExp).save()

        self.__player0.gold = 0
        self.__player0.getModel(PlayerGold).save()

        self.__player0.cardlimititem = 100
        self.__player0.getModel(PlayerDeck).save()

        # 途中まで進んでいるかもしれないので消しておく.
        playdata = ScoutPlayData.getByKey(
            ScoutPlayData.makeID(self.__player0.id, self.__scout.id))
        if playdata:
            playdata.delete()

        # レイドイベントは止める.
        config = BackendApi.get_current_raideventconfig(ModelRequestMgr())
        self.__preconfig_endtime = config.endtime
        now = OSAUtil.get_now()
        BackendApi.update_raideventconfig(config.mid, config.starttime, now)
Beispiel #5
0
    def setUp(self):
        # Player.
        self.__player0 = self.create_dummy(DummyType.PLAYER)

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

        # レイド.
        raidmaster = self.create_dummy(DummyType.RAID_MASTER)

        # ハプニング.
        happeningmaster = self.create_dummy(DummyType.HAPPENING_MASTER,
                                            raidmaster.id)
        data = ScoutHappeningData.create(happeningmaster.id, 10000)
        happenings = [data.get_dict()]
        self.__happeningmaster = happeningmaster

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

        # 経験値情報.
        self.create_dummy(DummyType.PLAYER_LEVEL_EXP_MASTER, 1, exp=0)
        self.create_dummy(DummyType.PLAYER_LEVEL_EXP_MASTER, 2, exp=999)
        self.__player0.level = 1
        self.__player0.exp = 0
        self.__player0.getModel(PlayerExp).save()

        self.__player0.gold = 0
        self.__player0.getModel(PlayerGold).save()

        self.__player0.cardlimititem = 100
        self.__player0.getModel(PlayerDeck).save()

        # 途中まで進んでいるかもしれないので消しておく.
        playdata = ScoutPlayData.getByKey(
            ScoutPlayData.makeID(self.__player0.id, self.__scout.id))
        if playdata:
            playdata.delete()
Beispiel #6
0
    def setUp(self):
        model_mgr = ModelRequestMgr()

        # Player.
        self.__player0 = self.create_dummy(DummyType.PLAYER)

        # アイテム.
        itemmaster = self.create_dummy(DummyType.ITEM_MASTER)
        data = ScoutDropItemData.create(
            Defines.ItemType.ITEM,
            itemmaster.id,
            filters={'ptype': Defines.CharacterType.TYPE_001},
            rate=10000)
        items = [data.get_dropitem_dict()]

        # 素材.
        materialidlist = []
        materialnumlist = []
        for _ in xrange(Defines.RAIDEVENT_MATERIAL_KIND_MAX):
            materialmaster = self.create_dummy(
                DummyType.RAID_EVENT_MATERIAL_MASTER)
            materialidlist.append(materialmaster.id)
            materialnumlist.append(100)

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

        # レイドマスター.
        raidmaster = self.create_dummy(DummyType.RAID_MASTER,
                                       hp=1,
                                       prizes=[prize.id],
                                       helpprizes=[prize.id],
                                       cabaretking=100,
                                       demiworld=10)
        self.__raidmaster = raidmaster

        # ハプニング.
        happeningmaster = self.create_dummy(DummyType.HAPPENING_MASTER,
                                            raidmaster.id,
                                            items=items)
        self.__happeningmaster = happeningmaster

        # レイドイベント.
        data = ScoutHappeningData.create(happeningmaster.id, 10000)
        happenings = [data.get_dict()]
        destroyprizes = [
            [1, [prize.id]],
        ]
        scenario = self.create_dummy(DummyType.EVENT_SCENARIO_MASTER)
        eventmaster = self.create_dummy(DummyType.RAID_EVENT_MASTER,
                                        raidtable=happenings,
                                        destroyprizes=destroyprizes,
                                        op=scenario.number,
                                        ed=scenario.number,
                                        materiallist=materialidlist)
        self.__eventmaster = eventmaster

        # レシピ.
        recipemaster = self.create_dummy(DummyType.RAID_EVENT_RECIPE_MASTER,
                                         eventmaster.id,
                                         material_num_list=materialnumlist)
        self.__recipemaster = recipemaster

        # 素材の所持数.
        materialdata = self.create_dummy(DummyType.RAID_EVENT_MATERIAL_DATA,
                                         self.__player0.id, eventmaster.id,
                                         materialnumlist)
        self.__materialdata = materialdata

        # イベント用レイド設定.
        raideventraidmaster = self.create_dummy(
            DummyType.RAID_EVENT_RAID_MASTER, self.__eventmaster.id,
            self.__raidmaster.id)
        self.__raideventraidmaster = raideventraidmaster

        # イベント終了設定.
        config = BackendApi.get_current_raideventconfig(model_mgr)
        self.__preconfig_mid = config.mid
        self.__preconfig_starttime = config.starttime
        self.__preconfig_endtime = config.endtime
        self.__preconfig_ticket_endtime = config.ticket_endtime
        config = BackendApi.update_raideventconfig(
            self.__eventmaster.id,
            OSAUtil.get_datetime_min(),
            OSAUtil.get_datetime_min(),
            ticket_endtime=OSAUtil.get_datetime_max())

        # オープニングとタイムボーナスを閲覧済みにする.
        eventflagrecord = self.create_dummy(DummyType.RAID_EVENT_FLAGS,
                                            self.__eventmaster.id,
                                            self.__player0.id,
                                            tbvtime=config.starttime)
        self.__eventflagrecord = eventflagrecord
Beispiel #7
0
    def setUp(self):
        model_mgr = ModelRequestMgr()
        now = OSAUtil.get_now()

        # Player.
        self.__player0 = self.create_dummy(DummyType.PLAYER)
        self.__player1 = self.create_dummy(DummyType.PLAYER)

        # アイテム.
        itemmaster = self.create_dummy(DummyType.ITEM_MASTER)
        data = ScoutDropItemData.create(
            Defines.ItemType.ITEM,
            itemmaster.id,
            filters={'ptype': Defines.CharacterType.TYPE_001},
            rate=10000)
        items = [data.get_dropitem_dict()]

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

        # レイドマスター.
        raidmaster = self.create_dummy(DummyType.RAID_MASTER,
                                       hp=1,
                                       prizes=[prize.id],
                                       helpprizes=[prize.id],
                                       cabaretking=100,
                                       demiworld=10)
        self.__raidmaster = raidmaster

        # ハプニング.
        happeningmaster = self.create_dummy(DummyType.HAPPENING_MASTER,
                                            raidmaster.id,
                                            items=items)
        self.__happeningmaster = happeningmaster

        # レイドイベント.
        data = ScoutHappeningData.create(happeningmaster.id, 10000)
        happenings = [data.get_dict()]
        eventmaster = self.create_dummy(DummyType.RAID_EVENT_MASTER,
                                        raidtable=happenings,
                                        champagne_num_max=10,
                                        champagne_time=300)
        self.__eventmaster = eventmaster

        # イベント用レイド設定.
        raideventraidmaster = self.create_dummy(
            DummyType.RAID_EVENT_RAID_MASTER,
            self.__eventmaster.id,
            self.__raidmaster.id,
            ownerpoint=10,
            mvppoint=20)
        self.__raideventraidmaster = raideventraidmaster

        # シャンパン情報.
        champagnedata = self.create_dummy(
            DummyType.RAID_EVENT_CHAMPAGNE,
            self.__player0.id,
            eventmaster.id,
            0,
            etime=now + datetime.timedelta(seconds=eventmaster.champagne_time))
        self.__champagnedata = champagnedata

        # イベント発生中設定.
        config = BackendApi.get_current_raideventconfig(model_mgr)
        self.__preconfig_mid = config.mid
        self.__preconfig_starttime = config.starttime
        self.__preconfig_endtime = config.endtime
        self.__preconfig_timebonus = config.timebonus_time
        timebonus_time = [{
            'stime': now,
            'etime': now + datetime.timedelta(days=1),
        }]
        config = BackendApi.update_raideventconfig(
            self.__eventmaster.id,
            now,
            now + datetime.timedelta(days=1),
            timebonus_time=timebonus_time)

        # オープニングとタイムボーナスを閲覧済みにする.
        eventflagrecord = self.create_dummy(DummyType.RAID_EVENT_FLAGS,
                                            self.__eventmaster.id,
                                            self.__player0.id,
                                            tbvtime=config.starttime)
        self.__eventflagrecord = eventflagrecord

        # ハプニング情報.
        happening = self.create_dummy(DummyType.HAPPENING,
                                      self.__player0.id,
                                      self.__happeningmaster.id,
                                      progress=happeningmaster.execution,
                                      eventid=self.__eventmaster.id)
        self.__happening = happening

        # レイド.
        raidboss = self.create_dummy(DummyType.RAID, self.__player0,
                                     happeningmaster, happening)
        raidboss.addDamageRecord(self.__player0.id, 1)
        raidboss.refrectDamageRecord()
        raidboss.raid.save()
        self.__raid = raidboss

        # 救援.
        def addRequest(v_player, o_player):
            model_mgr = ModelRequestMgr()
            BackendApi.tr_add_friendrequest(model_mgr, v_player, o_player)
            model_mgr.write_all()
            model_mgr.write_end()

        def addFriend(v_player, o_player):
            model_mgr = ModelRequestMgr()
            BackendApi.tr_add_friend(model_mgr, v_player.id, o_player.id)
            model_mgr.write_all()
            model_mgr.write_end()

        addRequest(self.__player0, self.__player1)
        addFriend(self.__player1, self.__player0)

        model_mgr = ModelRequestMgr()
        BackendApi.tr_send_raidhelp(model_mgr, self.__player0.id)
        model_mgr.write_all()
        model_mgr.write_end()

        raidboss.addDamageRecord(self.__player1.id, 1)
        raidboss.refrectDamageRecord()
        raidboss.raid.save()

        self.__player0.gold = 0
        self.__player0.getModel(PlayerGold).save()

        self.__player0.cardlimititem = 100
        self.__player0.getModel(PlayerDeck).save()

        self.__playerhappening = BackendApi.get_playerhappening(
            model_mgr, self.__player0.id)

        self.__present_num0 = BackendApi.get_present_num(self.__player0.id)
        self.__present_num1 = BackendApi.get_present_num(self.__player1.id)
    def setUp(self):
        # Player.
        self.__player0 = self.create_dummy(DummyType.PLAYER)

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

        # レイド.
        raidmaster = self.create_dummy(DummyType.RAID_MASTER)

        # ハプニング.
        happeningmaster = self.create_dummy(DummyType.HAPPENING_MASTER,
                                            raidmaster.id,
                                            execution=0)
        data = ScoutHappeningData.create(happeningmaster.id, 10000)
        happenings = [data.get_dict()]
        self.__happeningmaster = happeningmaster

        # レイドイベント.
        data = ScoutHappeningData.create(happeningmaster.id, 10000)
        eventmaster = self.create_dummy(DummyType.RAID_EVENT_MASTER,
                                        happenings,
                                        champagne_num_max=10,
                                        champagne_time=300)
        self.__eventmaster = eventmaster

        # シャンパン情報.
        champagnedata = self.create_dummy(DummyType.RAID_EVENT_CHAMPAGNE,
                                          self.__player0.id, eventmaster.id,
                                          eventmaster.champagne_num_max)
        self.__champagnedata = champagnedata

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

        # 経験値情報.
        self.create_dummy(DummyType.PLAYER_LEVEL_EXP_MASTER, 1, exp=0)
        self.create_dummy(DummyType.PLAYER_LEVEL_EXP_MASTER, 2, exp=999)
        self.__player0.level = 1
        self.__player0.exp = 0
        self.__player0.getModel(PlayerExp).save()

        self.__player0.gold = 0
        self.__player0.getModel(PlayerGold).save()

        self.__player0.cardlimititem = 100
        self.__player0.getModel(PlayerDeck).save()

        # 途中まで進んでいるかもしれないので消しておく.
        playdata = ScoutPlayData.getByKey(
            ScoutPlayData.makeID(self.__player0.id, self.__scout.id))
        if playdata:
            playdata.delete()

        # イベント発生中設定.
        model_mgr = ModelRequestMgr()
        config = BackendApi.get_current_raideventconfig(model_mgr)
        self.__preconfig_mid = config.mid
        self.__preconfig_starttime = config.starttime
        self.__preconfig_endtime = config.endtime
        self.__preconfig_timebonus = config.timebonus_time
        timebonus_time = []
        now = OSAUtil.get_now()
        BackendApi.update_raideventconfig(self.__eventmaster.id,
                                          now,
                                          now + datetime.timedelta(days=1),
                                          timebonus_time=timebonus_time)
Beispiel #9
0
 def setUp(self):
     model_mgr = ModelRequestMgr()
     
     trade_num = 8
     recipe_material_num = 10
     self.__trade_num = trade_num
     
     # Player.
     self.__player0 = self.create_dummy(DummyType.PLAYER)
     
     # アイテム.
     itemmaster = self.create_dummy(DummyType.ITEM_MASTER)
     self.__itemmaster = itemmaster
     
     # アイテムの所持数.
     item = self.create_dummy(DummyType.ITEM, self.__player0, itemmaster)
     self.__item = item
     
     # 素材.
     materialidlist = []
     materialnumlist = []
     for _ in xrange(Defines.RAIDEVENT_MATERIAL_KIND_MAX):
         materialmaster = self.create_dummy(DummyType.RAID_EVENT_MATERIAL_MASTER)
         materialidlist.append(materialmaster.id)
         materialnumlist.append(recipe_material_num)
     
     # レイドマスター.
     raidmaster = self.create_dummy(DummyType.RAID_MASTER, hp=1, prizes=[], helpprizes=[], cabaretking=100, demiworld=10)
     self.__raidmaster = raidmaster
     
     # ハプニング.
     happeningmaster = self.create_dummy(DummyType.HAPPENING_MASTER, raidmaster.id, items=[])
     self.__happeningmaster = happeningmaster
     
     # レイドイベント.
     data = ScoutHappeningData.create(happeningmaster.id, 10000)
     happenings = [data.get_dict()]
     destroyprizes = []
     scenario = self.create_dummy(DummyType.EVENT_SCENARIO_MASTER)
     eventmaster = self.create_dummy(DummyType.RAID_EVENT_MASTER, raidtable=happenings, destroyprizes=destroyprizes, op=scenario.number, ed=scenario.number, materiallist=materialidlist)
     self.__eventmaster = eventmaster
     
     # レシピ.
     itype = Defines.ItemType.ITEM
     itemid = self.__itemmaster.id
     itemnum = 1
     recipemaster = self.create_dummy(DummyType.RAID_EVENT_RECIPE_MASTER, eventmaster.id, itype=itype, itemid=itemid, itemnum=itemnum, stock=trade_num, material_num_list=materialnumlist)
     self.__recipemaster = recipemaster
     
     # 交換回数.
     mixdata = self.create_dummy(DummyType.RAID_EVENT_MIX_DATA, self.__player0.id, recipemaster, 0)
     self.__mixdata = mixdata
     
     # 素材の所持数.
     materialdata = self.create_dummy(DummyType.RAID_EVENT_MATERIAL_DATA, self.__player0.id, eventmaster.id, [materialnum * trade_num for materialnum in materialnumlist])
     self.__materialdata = materialdata
     
     # イベント用レイド設定.
     raideventraidmaster = self.create_dummy(DummyType.RAID_EVENT_RAID_MASTER, self.__eventmaster.id, self.__raidmaster.id)
     self.__raideventraidmaster = raideventraidmaster
     
     # イベント終了設定.
     config = BackendApi.get_current_raideventconfig(model_mgr)
     self.__preconfig_mid = config.mid
     self.__preconfig_starttime = config.starttime
     self.__preconfig_endtime = config.endtime
     self.__preconfig_ticket_endtime = config.ticket_endtime
     config = BackendApi.update_raideventconfig(self.__eventmaster.id, OSAUtil.get_datetime_min(), OSAUtil.get_datetime_min(), ticket_endtime=OSAUtil.get_datetime_max())
     
     # オープニングとタイムボーナスを閲覧済みにする.
     eventflagrecord = self.create_dummy(DummyType.RAID_EVENT_FLAGS, self.__eventmaster.id, self.__player0.id, tbvtime=config.starttime)
     self.__eventflagrecord = eventflagrecord
Beispiel #10
0
    def setUp(self):
        model_mgr = ModelRequestMgr()
        now = OSAUtil.get_now()

        # Player.
        self.__player0 = self.create_dummy(DummyType.PLAYER)

        # アイテム.
        itemmaster = self.create_dummy(DummyType.ITEM_MASTER)
        data = ScoutDropItemData.create(
            Defines.ItemType.ITEM,
            itemmaster.id,
            filters={'ptype': Defines.CharacterType.TYPE_001},
            rate=10000)
        items = [data.get_dropitem_dict()]

        # 報酬.
        prize = self.create_dummy(DummyType.PRIZE_MASTER,
                                  gold=100,
                                  gachapt=10,
                                  item=itemmaster)
        self.__prize = prize

        # レイドマスター.
        raidmaster = self.create_dummy(DummyType.RAID_MASTER,
                                       hp=1,
                                       prizes=[prize.id],
                                       helpprizes=[prize.id],
                                       cabaretking=100,
                                       demiworld=10)
        self.__raidmaster = raidmaster

        # ハプニング.
        happeningmaster = self.create_dummy(DummyType.HAPPENING_MASTER,
                                            raidmaster.id,
                                            items=items)
        self.__happeningmaster = happeningmaster

        # レイドイベント.
        data = ScoutHappeningData.create(happeningmaster.id, 10000)
        happenings = [data.get_dict()]
        destroyprizes = [
            [1, [prize.id]],
        ]
        eventmaster = self.create_dummy(DummyType.RAID_EVENT_MASTER,
                                        raidtable=happenings,
                                        destroyprizes=destroyprizes)
        self.__eventmaster = eventmaster

        # イベント用レイド設定.
        raideventraidmaster = self.create_dummy(
            DummyType.RAID_EVENT_RAID_MASTER, self.__eventmaster.id,
            self.__raidmaster.id)
        self.__raideventraidmaster = raideventraidmaster

        # イベント発生中設定.
        config = BackendApi.get_current_raideventconfig(model_mgr)
        self.__preconfig_mid = config.mid
        self.__preconfig_starttime = config.starttime
        self.__preconfig_endtime = config.endtime
        self.__preconfig_timebonus = config.timebonus_time
        timebonus_time = [{
            'stime': now,
            'etime': now + datetime.timedelta(days=1),
        }]
        config = BackendApi.update_raideventconfig(
            self.__eventmaster.id,
            now,
            now + datetime.timedelta(days=1),
            timebonus_time=timebonus_time)

        # オープニングとタイムボーナスを閲覧済みにする.
        eventflagrecord = self.create_dummy(DummyType.RAID_EVENT_FLAGS,
                                            self.__eventmaster.id,
                                            self.__player0.id,
                                            tbvtime=config.starttime)
        self.__eventflagrecord = eventflagrecord

        # イベントスコア.
        eventscore = self.create_dummy(DummyType.RAID_EVENT_SCORE,
                                       self.__eventmaster.id,
                                       self.__player0.id,
                                       destroy=1)
        self.__eventscore = eventscore

        # ハプニング情報.
        happening = self.create_dummy(DummyType.HAPPENING,
                                      self.__player0.id,
                                      self.__happeningmaster.id,
                                      progress=happeningmaster.execution,
                                      eventid=self.__eventmaster.id)
        self.__happening = happening

        # レイド.
        raidboss = self.create_dummy(DummyType.RAID, self.__player0,
                                     happeningmaster, happening)
        raidboss.addDamageRecord(self.__player0.id, 1)
        raidboss.refrectDamageRecord()
        raidboss.raid.save()
        self.__raid = raidboss

        # プレゼント数.
        self.__present_num = BackendApi.get_present_num(self.__player0.id)
Beispiel #11
0
    def setUp(self):
        # Player.
        self.__player0 = self.create_dummy(DummyType.PLAYER)

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

        # カード.
        cardmaster = self.create_dummy(DummyType.CARD_MASTER)
        data = ScoutDropItemData.create(
            Defines.ItemType.CARD,
            cardmaster.id,
            filters={'ptype': Defines.CharacterType.TYPE_001},
            rate=10000)
        dropitems = [data.get_dropitem_dict()]
        self.__cardmaster = cardmaster

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

        # 報酬.
        prize = self.create_dummy(DummyType.PRIZE_MASTER, gold=100, gachapt=10)

        # レイドマスター.
        raidmaster = self.create_dummy(DummyType.RAID_MASTER,
                                       hp=1,
                                       prizes=[prize.id],
                                       helpprizes=[prize.id],
                                       cabaretking=100,
                                       demiworld=10)
        self.__raidmaster = raidmaster

        # ハプニング.
        happeningmaster = self.create_dummy(DummyType.HAPPENING_MASTER,
                                            raidmaster.id)
        self.__happeningmaster = happeningmaster

        # レイドイベント.
        data = ScoutHappeningData.create(happeningmaster.id, 10000)
        happenings = [data.get_dict()]
        eventmaster = self.create_dummy(DummyType.RAID_EVENT_MASTER,
                                        happenings,
                                        champagne_num_max=10,
                                        champagne_time=300)
        self.__eventmaster = eventmaster

        # シャンパン情報.
        champagnedata = self.create_dummy(DummyType.RAID_EVENT_CHAMPAGNE,
                                          self.__player0.id, eventmaster.id,
                                          eventmaster.champagne_num_max)
        self.__champagnedata = champagnedata

        # 経験値情報.
        self.create_dummy(DummyType.PLAYER_LEVEL_EXP_MASTER, 1, exp=0)
        self.create_dummy(DummyType.PLAYER_LEVEL_EXP_MASTER, 2, exp=999)
        self.__player0.level = 1
        self.__player0.exp = 0
        self.__player0.getModel(PlayerExp).save()

        self.__player0.gold = 0
        self.__player0.getModel(PlayerGold).save()

        self.__player0.cardlimititem = 100
        self.__player0.getModel(PlayerDeck).save()

        # 途中まで進んでいるかもしれないので消しておく.
        playdata = ScoutPlayData.getByKey(
            ScoutPlayData.makeID(self.__player0.id, self.__scout.id))
        if playdata:
            playdata.delete()

        # イベント発生中設定.
        model_mgr = ModelRequestMgr()
        config = BackendApi.get_current_raideventconfig(model_mgr)
        self.__preconfig_mid = config.mid
        self.__preconfig_starttime = config.starttime
        self.__preconfig_endtime = config.endtime
        self.__preconfig_timebonus = config.timebonus_time
        timebonus_time = []
        now = OSAUtil.get_now()
        BackendApi.update_raideventconfig(self.__eventmaster.id,
                                          now,
                                          now + datetime.timedelta(days=1),
                                          timebonus_time=timebonus_time)
Beispiel #12
0
    def setUp(self):
        model_mgr = ModelRequestMgr()

        # Player.
        self.__player0 = self.create_dummy(DummyType.PLAYER, friendlimit=100)

        # アイテム.
        itemmaster = self.create_dummy(DummyType.ITEM_MASTER)
        data = ScoutDropItemData.create(
            Defines.ItemType.ITEM,
            itemmaster.id,
            filters={'ptype': Defines.CharacterType.TYPE_001},
            rate=10000)
        items = [data.get_dropitem_dict()]

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

        # レイドマスター.
        raidmaster = self.create_dummy(DummyType.RAID_MASTER,
                                       hp=1,
                                       prizes=[prize.id],
                                       helpprizes=[prize.id],
                                       cabaretking=100,
                                       demiworld=10)
        self.__raidmaster = raidmaster

        # ハプニング.
        happeningmaster = self.create_dummy(DummyType.HAPPENING_MASTER,
                                            raidmaster.id,
                                            items=items)
        self.__happeningmaster = happeningmaster

        # レイドイベント.
        data = ScoutHappeningData.create(happeningmaster.id, 10000)
        happenings = [data.get_dict()]
        eventmaster = self.create_dummy(DummyType.RAID_EVENT_MASTER,
                                        raidtable=happenings)
        self.__eventmaster = eventmaster

        # イベント用レイド設定.
        raideventraidmaster = self.create_dummy(
            DummyType.RAID_EVENT_RAID_MASTER, self.__eventmaster.id,
            self.__raidmaster.id)
        self.__raideventraidmaster = raideventraidmaster

        # イベント発生中設定.
        config = BackendApi.get_current_raideventconfig(model_mgr)
        self.__preconfig_mid = config.mid
        self.__preconfig_starttime = config.starttime
        self.__preconfig_endtime = config.endtime
        self.__preconfig_timebonus = config.timebonus_time
        timebonus_time = []
        now = OSAUtil.get_now()
        BackendApi.update_raideventconfig(self.__eventmaster.id,
                                          now,
                                          now + datetime.timedelta(days=1),
                                          timebonus_time=timebonus_time)

        # 救援.
        def addRequest(v_player, o_player):
            model_mgr = ModelRequestMgr()
            BackendApi.tr_add_friendrequest(model_mgr, v_player, o_player)
            model_mgr.write_all()
            model_mgr.write_end()

        def addFriend(v_player, o_player):
            model_mgr = ModelRequestMgr()
            BackendApi.tr_add_friend(model_mgr, v_player.id, o_player.id)
            model_mgr.write_all()
            model_mgr.write_end()

        for _ in xrange(20):
            player = self.create_dummy(DummyType.PLAYER, friendlimit=100)
            addRequest(self.__player0, player)
            addFriend(player, self.__player0)

            # ハプニング情報.
            happening = self.create_dummy(DummyType.HAPPENING,
                                          player.id,
                                          self.__happeningmaster.id,
                                          progress=happeningmaster.execution,
                                          eventid=self.__eventmaster.id)

            # レイド.
            raidboss = self.create_dummy(DummyType.RAID, player,
                                         happeningmaster, happening)
            raidboss.addDamageRecord(player.id, 1)
            raidboss.refrectDamageRecord()
            raidboss.raid.save()

            model_mgr = ModelRequestMgr()
            BackendApi.tr_send_raidhelp(model_mgr, player.id)
            model_mgr.write_all()
            model_mgr.write_end()
Beispiel #13
0
    def setUpRaidEvent(self, player, dedicated_stage_max=0, is_open=True):
        model_mgr = ModelRequestMgr()
        now = OSAUtil.get_now()

        # アイテム.
        itemmaster = self.create_dummy(DummyType.ITEM_MASTER)
        data = ScoutDropItemData.create(
            Defines.ItemType.ITEM,
            itemmaster.id,
            filters={'ptype': Defines.CharacterType.TYPE_001},
            rate=10000)
        items = [data.get_dropitem_dict()]

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

        # レイドマスター.
        raidmaster = self.create_dummy(DummyType.RAID_MASTER,
                                       hp=1,
                                       prizes=[prize.id],
                                       helpprizes=[prize.id],
                                       cabaretking=100,
                                       demiworld=10)
        self.__raidmaster = raidmaster

        # ハプニング.
        happeningmaster = self.create_dummy(DummyType.HAPPENING_MASTER,
                                            raidmaster.id,
                                            execution=0,
                                            items=items)
        self.__happeningmaster = happeningmaster

        # レイドイベント.
        data = ScoutHappeningData.create(happeningmaster.id, 10000)
        happenings = [data.get_dict()]
        destroyprizes = [
            [1, [prize.id]],
        ]
        eventmaster = self.create_dummy(
            DummyType.RAID_EVENT_MASTER,
            raidtable=happenings,
            destroyprizes=destroyprizes,
            flag_dedicated_stage=0 < dedicated_stage_max)
        self.__eventmaster = eventmaster

        # イベント用レイド設定.
        raideventraidmaster = self.create_dummy(
            DummyType.RAID_EVENT_RAID_MASTER, self.eventmaster.id,
            self.raidmaster.id)
        self.__raideventraidmaster = raideventraidmaster

        # イベント用ステージ作成.
        stageparams = self.getStageParams() or {}
        stagelist = []
        for stagenumber in xrange(1, dedicated_stage_max + 1):
            stagelist.append(
                self.create_dummy(DummyType.RAID_EVENT_SCOUT_STAGE_MASTER,
                                  self.eventmaster.id,
                                  stagenumber,
                                  prizes=[prize.id],
                                  **stageparams))
        self.__stagelist = stagelist

        # イベント発生中設定.
        config = BackendApi.get_current_raideventconfig(model_mgr)
        self.__preconfig_mid = config.mid
        self.__preconfig_starttime = config.starttime
        self.__preconfig_endtime = config.endtime
        self.__preconfig_timebonus = config.timebonus_time
        timebonus_time = [{
            'stime': now,
            'etime': now + datetime.timedelta(days=1),
        }]
        if is_open:
            starttime = now
            endtime = now + datetime.timedelta(days=1)
        else:
            starttime = now - datetime.timedelta(days=1)
            endtime = now
        config = BackendApi.update_raideventconfig(
            self.eventmaster.id,
            starttime,
            endtime,
            timebonus_time=timebonus_time)
        self.raidevent_config = config