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) # スカウト. scout = self.create_dummy(DummyType.SCOUT_MASTER, area=area, execution=1) 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=1) self.__player0.level = 1 self.__player0.exp = 0 self.__player0.getModel(PlayerExp).save() self.__player0.gold = 0 self.__player0.getModel(PlayerGold).save() # 途中まで進んでいるかもしれないので消しておく. playdata = ScoutPlayData.getByKey( ScoutPlayData.makeID(self.__player0.id, self.__scout.id)) if playdata: playdata.delete()
def check(self): model_mgr = ModelRequestMgr() # 進行情報があるかを確認. playdata = ScoutPlayData.getByKey( ScoutPlayData.makeID(self.__player0.id, self.__scout.id)) if playdata is None: raise AppTestError(u'進行情報が保存されていない') elif playdata.progress == 0: raise AppTestError(u'進行度が進んでいない') # 報酬. resultlist = playdata.result.get('result', None) if not resultlist: raise AppTestError(u'結果が設定されていない') for result in resultlist: self.__player0.exp += result['exp_add'] self.__player0.gold += result['gold_add'] # お金確認. playergold = PlayerGold.getByKey(playdata.uid) if playergold.gold != self.__player0.gold: raise AppTestError(u'お金が正しくない') # 経験値. playerexp = PlayerExp.getByKey(playdata.uid) if playerexp.exp != self.__player0.exp: raise AppTestError(u'お金が正しくない') # イベント設定されているか. eventlist = playdata.result.get('event', None) if not eventlist: raise AppTestError(u'イベントが設定されていない') # ハプニング発生のイベントが設定されているか. targetevent = None for event in eventlist: if event.get_type() == Defines.ScoutEventType.HAPPENING: targetevent = event if targetevent is None: raise AppTestError(u'ハプニング発生イベントが設定されていない') elif targetevent.happening != self.__happeningmaster.id: raise AppTestError( u'ハプニング発生イベントに正しくハプニングが設定されていない.%d vs %d' % (targetevent.happening, self.__happeningmaster.id)) happeningset = BackendApi.get_current_happening( model_mgr, self.__player0.id) if happeningset is None or happeningset.happening.mid != self.__happeningmaster.id: raise AppTestError(u'ハプニングが開始されていない.') raidboss = BackendApi.get_raid( model_mgr, happeningset.id, happening_eventvalue=HappeningUtil.make_raideventvalue( self.__eventmaster.id)) record = raidboss.getDamageRecord(self.__player0.id) if not record.champagne: raise AppTestError(u'シャンパンコールのフラグが立っていない.')
def check(self): self.checkResponseStatus() # 進行情報があるかを確認. playdata = ScoutPlayData.getByKey( ScoutPlayData.makeID(self.__player0.id, self.__scout.id)) if playdata is None: raise AppTestError(u'進行情報が保存されていない') elif playdata.progress == 0: raise AppTestError(u'進行度が進んでいない') # 報酬. resultlist = playdata.result.get('result', None) if not resultlist: raise AppTestError(u'結果が設定されていない') for result in resultlist: self.__player0.exp += result['exp_add'] self.__player0.gold += result['gold_add'] # お金確認. playergold = PlayerGold.getByKey(playdata.uid) if playergold.gold != self.__player0.gold: raise AppTestError(u'お金が正しくない') # 経験値. playerexp = PlayerExp.getByKey(playdata.uid) if playerexp.exp != self.__player0.exp: raise AppTestError(u'お金が正しくない') # デッキコスト. playerdeck = PlayerDeck.getByKey(playdata.uid) if playerdeck.deckcapacityscout != (self.__player0.deckcapacityscout + 1): raise AppTestError(u'デッキコスト上限が正しくない') # イベント設定されているか. eventlist = playdata.result.get('event', None) if not eventlist: raise AppTestError(u'イベントが設定されていない') # レベルアップとスカウト完了のイベントが設定されているか. levelupevent = None completeevent = None for event in eventlist: if event.get_type() == Defines.ScoutEventType.LEVELUP: levelupevent = event elif event.get_type() == Defines.ScoutEventType.COMPLETE: completeevent = event if levelupevent is None: raise AppTestError(u'レベルアップイベントが設定されていない') elif completeevent is None: raise AppTestError(u'スカウト完了イベントが設定されていない') elif playerexp.level != levelupevent.level: raise AppTestError(u'レベルアップイベントに正しくレベルが設定されていない.%d vs %d' % (playerexp.level, levelupevent.level)) elif playdata.mid != completeevent.scoutid: raise AppTestError(u'完了イベントに正しくスカウトIDが設定されていない.%d vs %d' % (playdata.mid, completeevent.scoutid))
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)
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) # 宝箱(中身はなんでもいい). self.__treasuremaster = self.create_dummy( DummyType.TREASURE_GOLD_MASTER, Defines.ItemType.GOLD, 0, 100) # 出現テーブル. self.__treasuretablemaster = self.create_dummy( DummyType.TREASURE_TABLE_GOLD_MASTER, [self.__treasuremaster.id]) # スカウト. scout = self.create_dummy(DummyType.SCOUT_MASTER, area=area, execution=100, treasuregold=1) 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() self.__treasure_num = BackendApi.get_treasure_num( model_mgr, Defines.TreasureType.GOLD, self.__player0.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) 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()
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) # 経験値情報. 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()
def check(self): self.checkResponseStatus() model_mgr = ModelRequestMgr() # 進行情報があるかを確認. playdata = ScoutPlayData.getByKey( ScoutPlayData.makeID(self.__player0.id, self.__scout.id)) if playdata is None: raise AppTestError(u'進行情報が保存されていない') elif playdata.progress == 0: raise AppTestError(u'進行度が進んでいない') # 報酬. resultlist = playdata.result.get('result', None) if not resultlist: raise AppTestError(u'結果が設定されていない') for result in resultlist: self.__player0.exp += result['exp_add'] self.__player0.gold += result['gold_add'] # お金確認. playergold = PlayerGold.getByKey(playdata.uid) if playergold.gold != self.__player0.gold: raise AppTestError(u'お金が正しくない') # 経験値. playerexp = PlayerExp.getByKey(playdata.uid) if playerexp.exp != self.__player0.exp: raise AppTestError(u'お金が正しくない') # 宝箱獲得のイベントが設定されているか. targetevent = BackendApi.find_scout_event( playdata, Defines.ScoutEventType.GET_TREASURE) if targetevent is None: raise AppTestError(u'宝箱獲得イベントが設定されていない') elif targetevent.treasuretype != Defines.TreasureType.GOLD: raise AppTestError(u'宝箱獲得イベントに正しくカードが設定されていない.%d' % targetevent.treasuretype) treasure_num = BackendApi.get_treasure_num(model_mgr, Defines.TreasureType.GOLD, self.__player0.id) if (self.__treasure_num + 1) != treasure_num: raise AppTestError(u'宝箱の所持数が想定外.%d vs %d' % ((self.__treasure_num + 1), treasure_num))
def check(self): self.checkResponseStatus() # 進行情報があるかを確認. playdata = ScoutPlayData.getByKey( ScoutPlayData.makeID(self.__player0.id, self.__scout.id)) if playdata is None: raise AppTestError(u'進行情報が保存されていない') elif playdata.progress == 0: raise AppTestError(u'進行度が進んでいない') # 報酬. resultlist = playdata.result.get('result', None) if not resultlist: raise AppTestError(u'結果が設定されていない') for result in resultlist: self.__player0.exp += result['exp_add'] self.__player0.gold += result['gold_add'] # お金確認. playergold = PlayerGold.getByKey(playdata.uid) if playergold.gold != self.__player0.gold: raise AppTestError(u'お金が正しくない') # 経験値. playerexp = PlayerExp.getByKey(playdata.uid) if playerexp.exp != self.__player0.exp: raise AppTestError(u'お金が正しくない') # イベント設定されているか. eventlist = playdata.result.get('event', None) if not eventlist: raise AppTestError(u'イベントが設定されていない') # レベルアップのイベントが設定されているか. targetevent = None for event in eventlist: if event.get_type() == Defines.ScoutEventType.LEVELUP: targetevent = event if targetevent is None: raise AppTestError(u'レベルアップイベントが設定されていない') elif playerexp.level != targetevent.level: raise AppTestError(u'イベントに正しくレベルが設定されていない.%d vs %d' % (playerexp.level, targetevent.level))
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) # スカウト. scout = self.create_dummy(DummyType.SCOUT_MASTER, area=area, execution=100, apcost=100) self.__scout = scout for _ in xrange(5): scout = self.create_dummy(DummyType.SCOUT_MASTER, area=area, opencondition=scout.id) # 経験値情報. for i in xrange(Defines.BIGINNER_PLAYERLEVEL): self.create_dummy(DummyType.PLAYER_LEVEL_EXP_MASTER, i + 1, exp=i + 1) self.create_dummy(DummyType.PLAYER_LEVEL_EXP_MASTER, Defines.BIGINNER_PLAYERLEVEL + 1, exp=999) self.__player0.level = Defines.BIGINNER_PLAYERLEVEL self.__player0.exp = Defines.BIGINNER_PLAYERLEVEL 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()
def check(self): self.checkResponseStatus() # 進行情報があるかを確認. playdata = ScoutPlayData.getByKey( ScoutPlayData.makeID(self.__player0.id, self.__scout.id)) if playdata is None: raise AppTestError(u'進行情報が保存されていない') # 報酬. resultlist = playdata.result.get('result', None) if resultlist is None: raise AppTestError(u'結果が設定されていない') for result in resultlist: self.__player0.exp += result['exp_add'] self.__player0.gold += result['gold_add'] # お金確認. playergold = PlayerGold.getByKey(playdata.uid) if playergold.gold != self.__player0.gold: raise AppTestError(u'お金が正しくない') # 経験値. playerexp = PlayerExp.getByKey(playdata.uid) if playerexp.exp != self.__player0.exp: raise AppTestError(u'お金が正しくない') # イベント設定されているか. eventlist = playdata.result.get('event', None) if not eventlist: raise AppTestError(u'イベントが設定されていない') # 体力不足のイベントが設定されているか. targetevent = None for event in eventlist: if event.get_type() == Defines.ScoutEventType.AP_NONE: targetevent = event if targetevent is None: raise AppTestError(u'体力不足イベントが設定されていない')
def check(self): self.checkResponseStatus() # 進行情報があるかを確認. playdata = ScoutPlayData.getByKey( ScoutPlayData.makeID(self.__player0.id, self.__scout.id)) if playdata is None: raise AppTestError(u'進行情報が保存されていない') elif playdata.progress == 0: raise AppTestError(u'進行度が進んでいない') # 報酬. resultlist = playdata.result.get('result', None) if not resultlist: raise AppTestError(u'結果が設定されていない') for result in resultlist: self.__player0.exp += result['exp_add'] self.__player0.gold += result['gold_add'] # お金確認. playergold = PlayerGold.getByKey(playdata.uid) if playergold.gold != self.__player0.gold: raise AppTestError(u'お金が正しくない') # 経験値. playerexp = PlayerExp.getByKey(playdata.uid) if playerexp.exp != self.__player0.exp: raise AppTestError(u'お金が正しくない') # カード獲得のイベントが設定されているか. targetevent = BackendApi.find_scout_event( playdata, Defines.ScoutEventType.GET_CARD) if targetevent is None: raise AppTestError(u'カード獲得イベントが設定されていない') elif targetevent.card != self.__cardmaster.id: raise AppTestError(u'カード獲得イベントに正しくカードが設定されていない.%d vs %d' % (targetevent.card, self.__cardmaster.id)) elif targetevent.is_received: raise AppTestError(u'カード受取判定済になってしまっている')
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)
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)