def check(self): # 店舗情報の確認. storeplayerdata = CabaClubStorePlayerData.getByKey( CabaClubStorePlayerData.makeID(self.__player.id, self.__storemaster.id)) store = CabaclubStoreSet(self.__storemaster, storeplayerdata) if not store.is_alive(OSAUtil.get_now()): raise AppTestError(u'期限が切れています') elif not store.playerdata.is_open: raise AppTestError(u'開店していません') elif storeplayerdata.utime.strftime( "%Y%m%d%H%M%S") != self.__cabaclub_dummy.now.strftime( "%Y%m%d%H%M%S"): raise AppTestError(u'utimeが正しくありません') elif storeplayerdata.etime.strftime( "%Y%m%d%H%M%S") != self.__cabaclub_dummy.now.strftime( "%Y%m%d%H%M%S"): raise AppTestError(u'etimeが正しくありません') elif storeplayerdata.event_id != self.__eventmaster.id: raise AppTestError(u'イベントが設定されていません') # 獲得ポイントの確認. scoredata_weekly = CabaClubScorePlayerDataWeekly.getByKey( self.__cabaclub_dummy.score_weekly.id) scoredata_weekly_prev = CabaClubScorePlayerDataWeekly.getByKey( self.__cabaclub_dummy.score_weekly_prev.id) customer_thisweek, proceeds_thisweek = self.calcCustomerAndProceeds( self.__cabaclub_dummy.master, self.__storemaster, 1, self.__storeplayerdata.scoutman_add, self.__cabaclub_dummy.cardlist, 100, 100) customer_lastweek, proceeds_lastweek = self.calcCustomerAndProceeds( self.__cabaclub_dummy.master, self.__storemaster, self.__exec_cnt - 1, self.__storeplayerdata.scoutman_add, self.__cabaclub_dummy.cardlist, 100 * (self.__exec_cnt - 1), 100 * (self.__exec_cnt - 1)) customer = customer_thisweek + customer_lastweek proceeds = proceeds_thisweek + proceeds_lastweek if (storeplayerdata.customer - self.__storeplayerdata.customer) != customer: # 仮. raise AppTestError(u'集客数が正しくありません') elif (storeplayerdata.proceeds - self.__storeplayerdata.proceeds) != proceeds: # 仮. raise AppTestError(u'売上が正しくありません') elif (scoredata_weekly.customer - self.__cabaclub_dummy.score_weekly.customer ) != customer_thisweek: # 仮. raise AppTestError(u'週間集客数が正しくありません') elif (scoredata_weekly.proceeds - self.__cabaclub_dummy.score_weekly.proceeds ) != proceeds_thisweek: # 仮. raise AppTestError(u'週間売上が正しくありません') elif (scoredata_weekly_prev.customer - self.__cabaclub_dummy.score_weekly_prev.customer ) != customer_lastweek: # 仮. raise AppTestError(u'先週の週間集客数が正しくありません') elif (scoredata_weekly_prev.proceeds - self.__cabaclub_dummy.score_weekly_prev.proceeds ) != proceeds_lastweek: # 仮. raise AppTestError(u'先週の週間売上が正しくありません')
def check(self): storeplayerdata = CabaClubStorePlayerData.getByKey( CabaClubStorePlayerData.makeID(self.__player.id, self.__storemaster.id)) store = CabaclubStoreSet(self.__storemaster, storeplayerdata) if not store.is_alive(OSAUtil.get_now()): raise AppTestError(u'期限が切れています') elif not store.playerdata.is_open: raise AppTestError(u'開店していません')
def check(self): arr = ( 'cabaclub_management_info', 'cabaclubstoreevent', 'url_store', 'url_title', ) for k in arr: if not self.response.has_key(k): raise AppTestError(u'%sが設定されていない' % k) # 店舗情報の確認. storeplayerdata = CabaClubStorePlayerData.getByKey( CabaClubStorePlayerData.makeID(self.__player.id, self.__storemaster.id)) store = CabaclubStoreSet(self.__storemaster, storeplayerdata) if not store.is_alive(OSAUtil.get_now()): raise AppTestError(u'期限が切れています') elif not store.playerdata.is_open: raise AppTestError(u'開店していません') elif storeplayerdata.utime.strftime( "%Y%m%d%H%M%S") != self.__cabaclub_dummy.now.strftime( "%Y%m%d%H%M%S"): raise AppTestError(u'utimeが正しくありません') elif storeplayerdata.etime.strftime( "%Y%m%d%H%M%S") != self.__cabaclub_dummy.now.strftime( "%Y%m%d%H%M%S"): raise AppTestError(u'etimeが正しくありません') elif storeplayerdata.event_id != self.__eventmaster.id: raise AppTestError(u'イベントが設定されていません') # 獲得ポイントの確認. scoredata_weekly = CabaClubScorePlayerDataWeekly.getByKey( self.__cabaclub_dummy.score_weekly.id) customer, proceeds = self.calcCustomerAndProceeds( self.__cabaclub_dummy.master, self.__storemaster, self.__exec_cnt, self.__storeplayerdata.scoutman_add, self.__cabaclub_dummy.cardlist, 100 * self.__exec_cnt, 100 * self.__exec_cnt) if (storeplayerdata.customer - self.__storeplayerdata.customer) != customer: # 仮. raise AppTestError(u'集客数が正しくありません') elif (storeplayerdata.proceeds - self.__storeplayerdata.proceeds) != proceeds: # 仮. raise AppTestError(u'売上が正しくありません') elif (scoredata_weekly.customer - self.__cabaclub_dummy.score_weekly.customer) != customer: # 仮. raise AppTestError(u'週間集客数が正しくありません') elif (scoredata_weekly.proceeds - self.__cabaclub_dummy.score_weekly.proceeds) != proceeds: # 仮. raise AppTestError(u'週間売上が正しくありません')
def check(self): # 店舗情報の確認. storeplayerdata = CabaClubStorePlayerData.getByKey( CabaClubStorePlayerData.makeID(self.__player.id, self.__storemaster.id)) store = CabaclubStoreSet(self.__storemaster, storeplayerdata) if not store.is_alive(OSAUtil.get_now()): raise AppTestError(u'借り入れできていません') elif storeplayerdata.customer != 0 or storeplayerdata.proceeds != 0: raise AppTestError(u'スコア情報がリセットされていません') # 特別なマネーの確認. scoredata = CabaClubScorePlayerData.getByKey(self.__player.id) if (self.__cabaclub_dummy.score.money - scoredata.money) != self.__storemaster.cost_0: raise AppTestError(u'特別なマネーが正しく消費されていません')
def check(self): # 店舗情報の確認. storeplayerdata = CabaClubStorePlayerData.getByKey( CabaClubStorePlayerData.makeID(self.__player.id, self.__storemaster.id)) store = CabaclubStoreSet(self.__storemaster, storeplayerdata) if not store.is_alive(OSAUtil.get_now()): raise AppTestError(u'期限が切れています') elif not store.playerdata.is_open: raise AppTestError(u'開店していません') elif storeplayerdata.utime.strftime( "%Y%m%d%H%M%S") != self.__cabaclub_dummy.now.strftime( "%Y%m%d%H%M%S"): raise AppTestError(u'utimeが正しくありません') elif storeplayerdata.etime.strftime("%Y%m%d%H%M%S") != ( self.__cabaclub_dummy.now - datetime.timedelta( seconds=(self.__storemaster.customer_interval * (self.__exec_cnt - 1)) % Defines.CABARETCLUB_STORE_EVENT_INTERVAL) ).strftime("%Y%m%d%H%M%S"): raise AppTestError(u'etimeが正しくありません') elif storeplayerdata.event_id != self.__eventmaster.id: raise AppTestError(u'イベントが設定されていません') # 獲得ポイントの確認. scoredata_weekly = CabaClubScorePlayerDataWeekly.getByKey( self.__cabaclub_dummy.score_weekly.id) customer, proceeds = self.calcCustomerAndProceeds( self.__cabaclub_dummy.master, self.__storemaster, self.__exec_cnt, self.__storeplayerdata.scoutman_add, self.__cabaclub_dummy.cardlist, self.__eventmaster.customer_up * self.__exec_cnt, self.__eventmaster.proceeds_up * self.__exec_cnt) if (storeplayerdata.customer - self.__storeplayerdata.customer) != customer: # 仮. raise AppTestError(u'集客数が正しくありません') elif (storeplayerdata.proceeds - self.__storeplayerdata.proceeds) != proceeds: # 仮. raise AppTestError(u'売上が正しくありません') elif (scoredata_weekly.customer - self.__cabaclub_dummy.score_weekly.customer) != customer: # 仮. raise AppTestError(u'週間集客数が正しくありません') elif (scoredata_weekly.proceeds - self.__cabaclub_dummy.score_weekly.proceeds) != proceeds: # 仮. raise AppTestError(u'週間売上が正しくありません')
def process(self): args = self.getUrlArgs('/item_useyesno/') try: mid = int(args.get(0)) use_num = int(self.request.get(Defines.URLQUERY_NUMBER, 1)) if use_num < 1: raise CabaretError() except: raise CabaretError(u'リクエストが正しくありません', CabaretError.Code.ILLEGAL_ARGS) model_mgr = self.getModelMgr() v_player = self.getViewerPlayer() # 使用するアイテム情報. num = BackendApi.get_item_nums(model_mgr, v_player.id, [mid], using=settings.DB_READONLY).get(mid, 0) if num < 1: # 手に入れたことすらない. if settings_sub.IS_LOCAL: raise CabaretError(u'リクエストが正しくありません', CabaretError.Code.ILLEGAL_ARGS) url = UrlMaker.itemlist() self.appRedirect(self.makeAppLinkUrlRedirect(url)) return master = BackendApi.get_itemmaster(model_mgr, mid, using=settings.DB_READONLY) self.html_param['item'] = Objects.item(self, master, num) self.html_param['use_num'] = use_num if num < use_num: self.html_param['is_not_enough'] = True elif mid in Defines.ItemEffect.ACTION_RECOVERY_ITEMS: if v_player.get_ap() == v_player.get_ap_max(): self.html_param['is_overlimit'] = True # テンション全回復. elif mid in Defines.ItemEffect.TENSION_RECOVERY_ITEMS: if v_player.get_bp() == v_player.get_bp_max(): self.html_param['is_overlimit'] = True elif mid == Defines.ItemEffect.CARD_BOX_EXPANSION: if Defines.CARDLIMITITEM_MAX < (v_player.cardlimititem + master.evalue): self.html_param['is_overlimit'] = True elif mid in Defines.ItemEffect.SCOUT_GUM_ITEMS: eventmaster = BackendApi.get_current_scouteventmaster( model_mgr, using=settings.DB_READONLY) if eventmaster is None: self.html_param['is_noevent'] = True else: playdata = BackendApi.get_event_playdata( model_mgr, eventmaster.id, v_player.id, using=settings.DB_READONLY) now = OSAUtil.get_now() if now <= playdata.feveretime: self.html_param['is_fever'] = True elif mid == Defines.ItemEffect.CABACLUB_SCOUTMAN: # 店舗. cabaclubstoremaster = None if Defines.FromPages.CABACLUB_STORE == self.getFromPageName(): args = self.getFromPageArgs() if args: cabaclubstoremaster = BackendApi.get_cabaretclub_store_master( model_mgr, int(args[0]), using=settings.DB_READONLY) if cabaclubstoremaster is None: raise CabaretError(u'店舗が存在しません', CabaretError.Code.ILLEGAL_ARGS) playerdata = BackendApi.get_cabaretclub_storeplayerdata( model_mgr, v_player.id, cabaclubstoremaster.id, using=settings.DB_READONLY) storeset = CabaclubStoreSet(cabaclubstoremaster, playerdata) if not storeset.is_alive(OSAUtil.get_now()): self.appRedirect( self.makeAppLinkUrlRedirect( UrlMaker.cabaclubstore(cabaclubstoremaster.id))) return # 使用可能にする. self.html_param['item']['master']['useable'] = True # 残りを確認. rest = cabaclubstoremaster.scoutman_add_max - storeset.playerdata.scoutman_add if rest < (master.evalue * use_num): self.html_param['is_overlimit'] = True elif mid == Defines.ItemEffect.CABACLUB_PREFERENTIAL: itemdata = BackendApi.get_cabaretclub_item_playerdata( model_mgr, v_player.id, using=settings.DB_READONLY) storeset = CabaclubStoreSet(None, None, itemdata=itemdata) if storeset.get_current_preferential_item_id( OSAUtil.get_now()) == mid: self.html_param['is_overlimit'] = True elif mid == Defines.ItemEffect.CABACLUB_BARRIER: itemdata = BackendApi.get_cabaretclub_item_playerdata( model_mgr, v_player.id, using=settings.DB_READONLY) storeset = CabaclubStoreSet(None, None, itemdata=itemdata) if storeset.get_current_barrier_item_id(OSAUtil.get_now()) == mid: self.html_param['is_overlimit'] = True # アイテム結果URLを取得. # url = OSAUtil.addQuery(UrlMaker.item_use(mid, num), Defines.URLQUERY_NUMBER, use_num) url = OSAUtil.addQuery( UrlMaker.item_use2(mid, v_player.req_confirmkey), Defines.URLQUERY_NUMBER, use_num) self.html_param['url_use'] = self.makeAppLinkUrl(url) self.putFromBackPageLinkUrl() if mid in Defines.ItemEffect.SCOUT_GUM_ITEMS: eventmaster = BackendApi.get_current_scouteventmaster( model_mgr, using=settings.DB_READONLY) if eventmaster is not None: self.html_param[ 'url_scoutevent_scouttop'] = self.makeAppLinkUrl( UrlMaker.scoutevent()) self.writeAppHtml('item/useyesno')