def check_time(self): """docstring for check_time""" logger.debug("login_time================== %s" % days_to_current(self._last_login)) if days_to_current(self._last_login) > 1: activity_infos = game_configs.activity_config.get(2, []) for info in activity_infos: self._continuous_day[info.id] = -1 self._continuous_day[2001] = 0 self._continuous_day_num = 1 # 7天乐 activity_infos = game_configs.activity_config.get(18, []) for info in activity_infos: self._continuous_7day[info.id] = -1 self._continuous_7day[18001] = 0 self._continuous_7day_num = 1 elif days_to_current(self._last_login) == 1: self._continuous_day_num += 1 for k in sorted(self._continuous_day.keys()): v = self._continuous_day[k] activity_info = game_configs.activity_config.get(k, []) if v == -1 or activity_info.parameterA == 7: self._continuous_day[k] = 0 break # 7天乐 self._continuous_7day_num += 1 for k in sorted(self._continuous_7day.keys()): v = self._continuous_7day[k] activity_info = game_configs.activity_config.get(k, []) if v == -1: self._continuous_7day[k] = 0 break if days_to_current(self._last_login) > 0: self._cumulative_day_num+= 1 for k in sorted(self._cumulative_day.keys()): v = self._cumulative_day[k] if v == -1: self._cumulative_day[k] = 0 break activity_infos = game_configs.activity_config.get(2, []) days_to_register = days_to_current(self._owner.base_info.register_time) if activity_infos and days_to_register >= activity_infos[0].parameterB: self._cumulative_day_num = -1 activity_infos = game_configs.activity_config.get(18, []) if activity_infos and days_to_register >= activity_infos[0].parameterB: self._continuous_7day_num = -1 self._last_login = get_current_timestamp() self.save_data()
def check_open_date(self, open_info): logger.debug("open_info============%s" % open_info) days = open_info.keys()[0] ts = open_info.values()[0][0] register_time = self._owner.base_info.register_time logger.debug("days %s tocurrent_days %s %s %s" % (days, days_to_current(register_time), string_to_timestamp_hms(ts), get_current_timestamp())) if days_to_current(register_time) > days - 1 or ( days_to_current(register_time) == days - 1 and string_to_timestamp_hms(ts) < get_current_timestamp()): logger.debug("check open date True") return True return False
def clear_sign_days(self): """docstring for clear_sign_days""" sign_round = days_to_current(self.owner.base_info.register_time) / 30 + 1 if self._sign_in_days and sign_round - self._sign_round != 0: self._sign_round = sign_round self._sign_in_days = [] self.save_data()
def clear_sign_days(self): """docstring for clear_sign_days""" sign_round = days_to_current(self.owner.base_info.register_time) / 30 + 1 if self._sign_in_days and sign_round - self._sign_round != 0: self._sign_round = sign_round self._sign_in_days = [] self._continuous_sign_in_prize = [] self._repair_sign_in_times = 0 self._box_sign_in_prize = [] self.save_data()
def clear_sign_days(self): """docstring for clear_sign_days""" sign_round = days_to_current( self.owner.base_info.register_time) / 30 + 1 if self._sign_in_days and sign_round - self._sign_round != 0: self._sign_round = sign_round self._sign_in_days = [] self._continuous_sign_in_prize = [] self._repair_sign_in_times = 0 self._box_sign_in_prize = [] self.save_data()
def check_time(self): """docstring for check_time""" logger.debug("login_time================== %s" % days_to_current(self._last_login)) if days_to_current(self._last_login) > 1 and self.is_open(2001): activity_infos = game_configs.activity_config.get(2, []) for info in activity_infos: if not self.is_open(info.id): self._continuous_day[info.id] = -1 self._continuous_day[2001] = 0 self._continuous_day_num = 1 if days_to_current(self._last_login) > 1 and self.is_open(18001): # 7天乐 activity_infos = game_configs.activity_config.get(18, []) for info in activity_infos: self._continuous_7day[info.id] = -1 self._continuous_7day[18001] = 0 self._continuous_7day_num = 1 elif days_to_current(self._last_login) == 1 and self.is_open(2001): self._continuous_day_num += 1 for k in sorted(self._continuous_day.keys()): v = self._continuous_day[k] activity_info = game_configs.activity_config.get(k, []) if v == -1 or activity_info.parameterA == 7: self._continuous_day[k] = 0 break if days_to_current(self._last_login) > 1 and self.is_open(18001): # 7天乐 self._continuous_7day_num += 1 for k in sorted(self._continuous_7day.keys()): v = self._continuous_7day[k] activity_info = game_configs.activity_config.get(k, []) if v == -1: self._continuous_7day[k] = 0 break if days_to_current(self._last_login) > 0 and self.is_open(1001): self._cumulative_day_num += 1 for k in sorted(self._cumulative_day.keys()): v = self._cumulative_day[k] if v == -1: self._cumulative_day[k] = 0 break #activity_infos = game_configs.activity_config.get(2, []) #days_to_register = days_to_current(self._owner.base_info.register_time) #if activity_infos and days_to_register >= activity_infos[0].parameterB: #self._cumulative_day_num = -1 #activity_infos = game_configs.activity_config.get(18, []) #if activity_infos and days_to_register >= activity_infos[0].parameterB: #self._continuous_7day_num = -1 self._last_login = get_current_timestamp() self.save_data()
def check_time(self): """docstring for check_time""" for act_id, act_info in self._act_info.items(): #act_item = game_configs.activity_config.get(act_id) if not self.owner.act.is_activiy_open(act_id): logger.debug("act %s not in the open time") # if act_item.timeStart > get_current_timestamp() or act_item.timeEnd < get_current_timestamp(): # 如果不在活动期间内,则清空属性 act_info["act_times"] = 0 act_info["finished"] = False act_info["last_time"] = 0 if act_id in [PROTECT_ESCORT_ACT_EVERY_DAY, ROB_ESCORT_ACT_EVERY_DAY, GUILD_BOSS_ACT_EVERY_DAY]: if days_to_current(act_info.get("last_time")) > 0: act_info["act_times"] = 0 act_info["finished"] = False act_info["last_time"] = 0
def get_buy_coin_activity_1407(data, player): """招财进宝初始化信息 request: 无 respone: GetBuyCoinInfoResponse """ response = buy_coin_activity_pb2.GetBuyCoinInfoResponse() if days_to_current(player.buy_coin.last_time) > 0: player.buy_coin.buy_times = 0 player.buy_coin.save_data() print("buy_times", player.buy_coin.buy_times) response.buy_times = player.buy_coin.buy_times item_no = 63002 item = player.item_package.get_item(item_no) if not item: response.extra_can_buy_times = 0 else: response.extra_can_buy_times = item.num return response.SerializePartialToString()
def check_time(self): """docstring for check_time""" for act_id, act_info in self._act_info.items(): #act_item = game_configs.activity_config.get(act_id) if not self.owner.act.is_activiy_open(act_id): logger.debug("act %s not in the open time") # if act_item.timeStart > get_current_timestamp() or act_item.timeEnd < get_current_timestamp(): # 如果不在活动期间内,则清空属性 act_info["act_times"] = 0 act_info["finished"] = False act_info["last_time"] = 0 if act_id in [ PROTECT_ESCORT_ACT_EVERY_DAY, ROB_ESCORT_ACT_EVERY_DAY, GUILD_BOSS_ACT_EVERY_DAY ]: if days_to_current(act_info.get("last_time")) > 0: act_info["act_times"] = 0 act_info["finished"] = False act_info["last_time"] = 0
def get_heros_101(pro_data, player): """取得武将列表 """ response = hero_response_pb2.GetHerosResponse() clear_or_not = days_to_current(player.base_info._hero_awake_time) > 0 for hero in player.hero_component.get_heros(): if clear_or_not: logger.debug("clear hero awake") hero.awake_exp = 0 hero.save_data() hero_pb = response.heros.add() hero.update_pb(hero_pb) #if hero_pb.hero_no == 10045: #logger.debug("%s %s " % (hero.hero_no, hero_pb.is_guard)) player.base_info._hero_awake_time = get_current_timestamp() player.base_info.save_data() return response.SerializePartialToString()
def update_65(self, res_type, num): """docstring for add_times""" act_confs = game_configs.activity_config.get(65, []) state2_acts = [] for act_conf in act_confs: act_id = act_conf.id if act_conf.parameterE.items()[0][0] != res_type: continue if not self.is_activiy_open(act_id): continue act_info = self._act_infos.get(act_id) if not act_info: self._act_infos[act_id] = [1, num, int(time.time())] else: if days_to_current(act_info[2]) != 0: self._act_infos[act_id] = [1, num, int(time.time())] else: act_info[1] += num act_info = get_act_info(self.owner, act_conf.id) if act_info.get('state') == 2: state2_acts.append(act_conf.id) self.fulfil_activity(state2_acts) self.save_data()
def update_daily_70_72_74(self, type, v): act_confs = game_configs.activity_config.get(type, []) state2_acts = [] for act_conf in act_confs: act_id = act_conf.id if not self.is_activiy_open(act_id): continue if v not in act_conf.parameterC: continue act_info = self._act_infos.get(act_id) if not act_info: self._act_infos[act_id] = [1, 1, int(time.time())] else: if days_to_current(act_info[2]) != 0: self._act_infos[act_id] = [1, 1, int(time.time())] else: act_info[1] += 1 act_info = get_act_info(self.owner, act_conf.id) if act_info.get('state') == 2: state2_acts.append(act_conf.id) self.fulfil_activity(state2_acts) self.save_data()
def get_act_info(player, act_id): act_info = player.act.act_infos.get(act_id) act_conf = game_configs.activity_config.get(act_id) jindu = 0 day = player.base_info.login_day print act_conf, '==========get act info , act config' if act_conf.type not in [65, 70, 72, 74]: # 每日的 if act_info and act_info[0] == 3: return {'state': 3, 'jindu': act_info[1]} elif act_info and act_info[0] == 2: return {'state': 2, 'jindu': act_info[1]} if act_conf.type == 1: # 累计登录 if not act_info: player.act.act_infos[act_id] = [1, [1, int(time.time())]] act_info = player.act.act_infos.get(act_id) jindu = 1 else: if days_to_current(act_info[1][1]) > 0: act_info[1][0] += 1 act_info[1][1] = int(time.time()) jindu = act_info[1][0] if jindu >= act_conf.parameterA: act_info[0] = 2 print act_info, '==========get act info 1' return {'state': act_info[0], 'jindu': act_info[1][0]} elif act_conf.type == 18: # 连续登录 if not act_info: player.act.act_infos[act_id] = [1, [1, int(time.time())]] act_info = player.act.act_infos.get(act_id) jindu = 1 else: if days_to_current(act_info[1][1]) == 1: act_info[1][0] += 1 act_info[1][1] = int(time.time()) elif days_to_current(act_info[1][1]) > 1: act_info[1][0] = 1 act_info[1][1] = int(time.time()) # 重置前面的天数里的活动 for up_act_id in act_conf.parameterC: up_act_info = player.act.act_infos.get(up_act_id) up_act_conf = game_configs.activity_config.get(up_act_id) if not up_act_info or not up_act_conf: continue up_act_state = 1 if up_act_conf.parameterA == 1: up_act_state = 2 player.act.act_infos[up_act_id] = [up_act_state, [1, int(time.time())]] jindu = act_info[1][0] if jindu >= act_conf.parameterA: act_info[0] = 2 print act_info, '==========get act info 18' return {'state': act_info[0], 'jindu': act_info[1][0]} elif act_conf.type == 29: # jindu = get_condition(conditions, 29) # if jindu and jindu[int(act_conf.parameterA)-1]: if day >= act_conf.parameterA: return {'state': 2} else: return {'state': 1} elif act_conf.type == 30: if not act_info: player.act.act_infos[act_id] = [2, 0] return {'state': 2} else: return {'state': act_info[0], 'jindu': act_info[1]} elif act_conf.type == 31: if act_info and act_info[0] == 2: return {'state': 2} state = 1 jindu = 0 # 上阵全部武将达到20级 line_up_slots = player.line_up_component.line_up_slots for slot in line_up_slots.values(): if not slot.activation: # 如果卡牌位未激活 continue hero_obj = slot.hero_slot.hero_obj # 英雄实例 if hero_obj: if hero_obj.level >= act_conf.parameterA: jindu += 1 if jindu >= act_conf.parameterB: state = 2 if state == 2: player.act.act_infos[act_id][0] = 2 return {'state': 2} else: if jindu and act_info and act_info[0] < jindu: player.act.act_infos[act_id] = [1, jindu] return {'state': state, 'jindu': jindu} elif act_conf.type == 32: state = 1 jindu = 0 # 拥有3名突破1的武将 line_up_slots = player.line_up_component.line_up_slots for slot in line_up_slots.values(): if not slot.activation: # 如果卡牌位未激活 continue hero_obj = slot.hero_slot.hero_obj # 英雄实例 if hero_obj: if hero_obj.break_level >= act_conf.parameterA: jindu += 1 if jindu >= act_conf.parameterB: state = 2 if state == 2: player.act.act_infos[act_id][0] = 2 return {'state': 2} else: if jindu and act_info and act_info[0] < jindu: player.act.act_infos[act_id] = [1, jindu] return {'state': state, 'jindu': jindu} elif act_conf.type == 33: # 竞技场排名到1500名 jindu = player.pvp.pvp_high_rank if jindu <= act_conf.parameterA: state = 2 player.act.act_infos[act_id] = [2, jindu] return {'state': 2} else: if not act_info or jindu < act_info[1]: player.act.act_infos[act_id] = [1, jindu] return {'state': 1, 'jindu': jindu} else: return {'state': 1, 'jindu': act_info[1]} elif act_conf.type == 34: state = 1 jindu = 0 # 每个上阵武将经脉激活3个穴位 line_up_slots = player.line_up_component.line_up_slots for slot in line_up_slots.values(): if not slot.activation: # 如果卡牌位未激活 continue hero_obj = slot.hero_slot.hero_obj # 英雄实例 if hero_obj: if hero_obj.refine >= act_conf.parameterA: jindu += 1 if jindu >= act_conf.parameterB: state = 2 if state == 2: player.act.act_infos[act_id][0] = 2 return {'state': 2} else: if jindu and act_info and act_info[0] < jindu: player.act.act_infos[act_id] = [1, jindu] return {'state': state, 'jindu': jindu} elif act_conf.type == 35: # 过关斩将通关第十关 jindu = player.pvp.pvp_overcome_current - 1 if jindu >= act_conf.parameterA: player.act.act_infos[act_id] = [2, jindu] return {'state': 2} else: if not act_info or jindu > act_info[1]: player.act.act_infos[act_id] = [1, jindu] return {'state': 1, 'jindu': jindu} else: return {'state': 1, 'jindu': act_info[1]} elif act_conf.type == 36: jindu = 0 for equipment_id in player.line_up_component.on_equipment_ids: equipment_obj = player.equipment_component.get_equipment(equipment_id) if equipment_obj.attribute.strengthen_lv >= act_conf.parameterA: jindu += 1 if jindu >= act_conf.parameterB: player.act.act_infos[act_id] = [2, jindu] return {'state': 2} else: if not act_info or jindu > act_info[1]: player.act.act_infos[act_id] = [1, jindu] return {'state': 1, 'jindu': jindu} else: return {'state': 1, 'jindu': act_info[1]} elif act_conf.type == 37: # 武将觉醒等级 jindu = 0 line_up_slots = player.line_up_component.line_up_slots for slot in line_up_slots.values(): if not slot.activation: # 如果卡牌位未激活 continue hero_obj = slot.hero_slot.hero_obj # 英雄实例 if hero_obj: if hero_obj.break_level >= act_conf.parameterA: jindu += 1 if jindu >= act_conf.parameterB: player.act.act_infos[act_id] = [2, jindu] return {'state': 2} else: if not act_info or jindu > act_info[1]: player.act.act_infos[act_id] = [1, jindu] return {'state': 1, 'jindu': jindu} else: return {'state': 1, 'jindu': act_info[1]} elif act_conf.type == 38: # 黄巾起义 累积伤害 if not act_info: player.act.act_infos[act_id] = [1, 0] jindu = 0 else: jindu = act_info[1] elif act_conf.type == 39: # 黄巾起义 最高伤害 if not act_info: player.act.act_infos[act_id] = [1, 0] jindu = 0 else: jindu = act_info[1] elif act_conf.type == 40: # 镶嵌A个B级别宝石 jindu = 0 line_up_slots = player.line_up_component.line_up_slots for slot in line_up_slots.values(): if not slot.activation: # 如果卡牌位未激活 continue hero_obj = slot.hero_slot.hero_obj # 英雄实例 if hero_obj: for (runt_type, item) in hero_obj.runt.items(): for (runt_po, runt_info) in item.items(): # [runt_no, runt_id, main_attr, minor_attr] = runt_info quality = game_configs.stone_config.get('stones'). \ get(runt_info[1]).quality if quality == act_conf.parameterB: jindu += 1 if jindu >= act_conf.parameterA: player.act.act_infos[act_id] = [2, jindu] return {'state': 2} else: if not act_info or jindu > act_info[1]: player.act.act_infos[act_id] = [1, jindu] return {'state': 1, 'jindu': jindu} else: return {'state': 1, 'jindu': act_info[1]} elif act_conf.type == 41: # 占领矿达到a个 if not act_info: player.act.act_infos[act_id] = [1, 0] jindu = 0 else: jindu = act_info[1] elif act_conf.type == 45: if player.stage_component.get_stage(act_conf.parameterA).state != 1: return {'state': 1} else: return {'state': 2} elif act_conf.type == 44: if not act_info: player.act.act_infos[act_id] = [1, 0] jindu = 0 else: jindu = act_info[1] elif act_conf.type == 43: # 战队等级 达到a jindu = player.base_info.level elif act_conf.type == 46: # 战斗力达到a jindu = int(player.line_up_component.hight_power) elif act_conf.type == 55: # 阵容条件: 武将数量,品质,突破等级 jindu = line_up_activity_jindu(player, act_conf) logger.debug("jindu %s " % jindu) elif act_conf.type in [56, 57, 58, 59]: # 秘境条件: 刷新秘境,占领矿点,宝石收取,宝石合成 jindu = player.act.mine_activity_jindu(act_conf) if jindu >= act_conf.parameterA: return {'state': 2, 'jindu': jindu} else: return {'state': 1, 'jindu': jindu} elif act_conf.type in [60, 61, 62, 63]: # 宝物:合成,品质,数量 jindu = player.act.treasure_activity_jindu(act_conf) if jindu >= act_conf.parameterA: return {'state': 2, 'jindu': jindu} else: return {'state': 1, 'jindu': jindu} elif act_conf.type == 51: if not act_info: player.act.act_infos[act_id] = [0, []] return {'state': 0, 'jindu': []} if len(act_info[1]) < int(act_conf.parameterA): return {'state': 1, 'jindu': act_info[1]} if act_conf.parameterB > player.base_info.level: return {'state': 1, 'jindu': act_info[1]} if len(act_conf.parameterC) == 1 and \ act_conf.parameterC[0] > player.line_up_component.hight_power: return {'state': 1, 'jindu': act_info[1]} if len(act_conf.parameterD) == 1 and \ player.stage_component.get_stage(act_conf.parameterD[0]).state != 1: return {'state': 1, 'jindu': act_info[1]} player.act.act_infos[act_id][0] = 2 return {'state': 2, 'jindu': act_info[1]} elif act_conf.type == 50: if not act_info: player.act.act_infos[act_id] = [0, [0, 0, 0]] return {'state': 1, 'jindu': [0, 0, 0]} base_info = player.base_info if int(act_conf.parameterA) > base_info.vip_level: return {'state': 1, 'jindu': act_info[1]} if len(act_conf.parameterC) == 1 and \ not act_conf.parameterC[0] > act_info[1][0]: return {'state': 1, 'jindu': act_info[1]} if len(act_conf.parameterD) == 1 and \ not act_conf.parameterD[0] > act_info[1][1]: return {'state': 1, 'jindu': act_info[1]} return {'state': 2, 'jindu': act_info[1]} elif act_conf.type in [70, 72, 74, 65]: if not act_info: player.act.act_infos[act_id] = [1, 0, int(time.time())] return {'state': 1, 'jindu': 0} if days_to_current(act_info[2]) != 0: player.act.act_infos[act_id] = [1, 0, int(time.time())] return {'state': 1, 'jindu': 0} if act_info and act_info[0] == 3: return {'state': 3, 'jindu': act_info[1]} elif act_info and act_info[0] == 2: return {'state': 2, 'jindu': act_info[1]} if act_info[1] < int(act_conf.parameterA): return {'state': 1, 'jindu': act_info[1]} player.act.act_infos[act_id][0] = 2 return {'state': 2, 'jindu': act_info[1]} elif act_conf.type in [71, 73, 75, 76, 77]: if not act_info: player.act.act_infos[act_id] = [1, 0] return {'state': 1, 'jindu': 0} if act_info[1] < int(act_conf.parameterA): return {'state': 1, 'jindu': act_info[1]} player.act.act_infos[act_id][0] = 2 return {'state': 2, 'jindu': act_info[1]} else: logger.error('get act info type error') return {'state': 0, 'jindu': 0} # 到到a的统一在这里返回 if jindu >= act_conf.parameterA: player.act.act_infos[act_id] = [2, jindu] return {'state': 2} else: if not act_info or jindu > act_info[1]: player.act.act_infos[act_id] = [1, jindu] return {'state': 1, 'jindu': jindu} else: return {'state': 1, 'jindu': act_info[1]}
def get_act_info(player, act_id): act_info = player.act.act_infos.get(act_id) act_conf = game_configs.activity_config.get(act_id) jindu = 0 day = player.base_info.login_day print act_conf, '==========get act info , act config' if act_conf.type not in [65, 70, 72, 74]: # 每日的 if act_info and act_info[0] == 3: return {'state': 3, 'jindu': act_info[1]} elif act_info and act_info[0] == 2: return {'state': 2, 'jindu': act_info[1]} if act_conf.type == 1: # 累计登录 if not act_info: player.act.act_infos[act_id] = [1, [1, int(time.time())]] act_info = player.act.act_infos.get(act_id) jindu = 1 else: if days_to_current(act_info[1][1]) > 0: act_info[1][0] += 1 act_info[1][1] = int(time.time()) jindu = act_info[1][0] if jindu >= act_conf.parameterA: act_info[0] = 2 print act_info, '==========get act info 1' return {'state': act_info[0], 'jindu': act_info[1][0]} elif act_conf.type == 18: # 连续登录 if not act_info: player.act.act_infos[act_id] = [1, [1, int(time.time())]] act_info = player.act.act_infos.get(act_id) jindu = 1 else: if days_to_current(act_info[1][1]) == 1: act_info[1][0] += 1 act_info[1][1] = int(time.time()) elif days_to_current(act_info[1][1]) > 1: act_info[1][0] = 1 act_info[1][1] = int(time.time()) # 重置前面的天数里的活动 for up_act_id in act_conf.parameterC: up_act_info = player.act.act_infos.get(up_act_id) up_act_conf = game_configs.activity_config.get(up_act_id) if not up_act_info or not up_act_conf: continue up_act_state = 1 if up_act_conf.parameterA == 1: up_act_state = 2 player.act.act_infos[up_act_id] = [ up_act_state, [1, int(time.time())] ] jindu = act_info[1][0] if jindu >= act_conf.parameterA: act_info[0] = 2 print act_info, '==========get act info 18' return {'state': act_info[0], 'jindu': act_info[1][0]} elif act_conf.type == 29: # jindu = get_condition(conditions, 29) # if jindu and jindu[int(act_conf.parameterA)-1]: if day >= act_conf.parameterA: return {'state': 2} else: return {'state': 1} elif act_conf.type == 30: if not act_info: player.act.act_infos[act_id] = [2, 0] return {'state': 2} else: return {'state': act_info[0], 'jindu': act_info[1]} elif act_conf.type == 31: if act_info and act_info[0] == 2: return {'state': 2} state = 1 jindu = 0 # 上阵全部武将达到20级 line_up_slots = player.line_up_component.line_up_slots for slot in line_up_slots.values(): if not slot.activation: # 如果卡牌位未激活 continue hero_obj = slot.hero_slot.hero_obj # 英雄实例 if hero_obj: if hero_obj.level >= act_conf.parameterA: jindu += 1 if jindu >= act_conf.parameterB: state = 2 if state == 2: player.act.act_infos[act_id][0] = 2 return {'state': 2} else: if jindu and act_info and act_info[0] < jindu: player.act.act_infos[act_id] = [1, jindu] return {'state': state, 'jindu': jindu} elif act_conf.type == 32: state = 1 jindu = 0 # 拥有3名突破1的武将 line_up_slots = player.line_up_component.line_up_slots for slot in line_up_slots.values(): if not slot.activation: # 如果卡牌位未激活 continue hero_obj = slot.hero_slot.hero_obj # 英雄实例 if hero_obj: if hero_obj.break_level >= act_conf.parameterA: jindu += 1 if jindu >= act_conf.parameterB: state = 2 if state == 2: player.act.act_infos[act_id][0] = 2 return {'state': 2} else: if jindu and act_info and act_info[0] < jindu: player.act.act_infos[act_id] = [1, jindu] return {'state': state, 'jindu': jindu} elif act_conf.type == 33: # 竞技场排名到1500名 jindu = player.pvp.pvp_high_rank if jindu <= act_conf.parameterA: state = 2 player.act.act_infos[act_id] = [2, jindu] return {'state': 2} else: if not act_info or jindu < act_info[1]: player.act.act_infos[act_id] = [1, jindu] return {'state': 1, 'jindu': jindu} else: return {'state': 1, 'jindu': act_info[1]} elif act_conf.type == 34: state = 1 jindu = 0 # 每个上阵武将经脉激活3个穴位 line_up_slots = player.line_up_component.line_up_slots for slot in line_up_slots.values(): if not slot.activation: # 如果卡牌位未激活 continue hero_obj = slot.hero_slot.hero_obj # 英雄实例 if hero_obj: if hero_obj.refine >= act_conf.parameterA: jindu += 1 if jindu >= act_conf.parameterB: state = 2 if state == 2: player.act.act_infos[act_id][0] = 2 return {'state': 2} else: if jindu and act_info and act_info[0] < jindu: player.act.act_infos[act_id] = [1, jindu] return {'state': state, 'jindu': jindu} elif act_conf.type == 35: # 过关斩将通关第十关 jindu = player.pvp.pvp_overcome_current - 1 if jindu >= act_conf.parameterA: player.act.act_infos[act_id] = [2, jindu] return {'state': 2} else: if not act_info or jindu > act_info[1]: player.act.act_infos[act_id] = [1, jindu] return {'state': 1, 'jindu': jindu} else: return {'state': 1, 'jindu': act_info[1]} elif act_conf.type == 36: jindu = 0 for equipment_id in player.line_up_component.on_equipment_ids: equipment_obj = player.equipment_component.get_equipment( equipment_id) if equipment_obj.attribute.strengthen_lv >= act_conf.parameterA: jindu += 1 if jindu >= act_conf.parameterB: player.act.act_infos[act_id] = [2, jindu] return {'state': 2} else: if not act_info or jindu > act_info[1]: player.act.act_infos[act_id] = [1, jindu] return {'state': 1, 'jindu': jindu} else: return {'state': 1, 'jindu': act_info[1]} elif act_conf.type == 37: # 武将觉醒等级 jindu = 0 line_up_slots = player.line_up_component.line_up_slots for slot in line_up_slots.values(): if not slot.activation: # 如果卡牌位未激活 continue hero_obj = slot.hero_slot.hero_obj # 英雄实例 if hero_obj: if hero_obj.break_level >= act_conf.parameterA: jindu += 1 if jindu >= act_conf.parameterB: player.act.act_infos[act_id] = [2, jindu] return {'state': 2} else: if not act_info or jindu > act_info[1]: player.act.act_infos[act_id] = [1, jindu] return {'state': 1, 'jindu': jindu} else: return {'state': 1, 'jindu': act_info[1]} elif act_conf.type == 38: # 黄巾起义 累积伤害 if not act_info: player.act.act_infos[act_id] = [1, 0] jindu = 0 else: jindu = act_info[1] elif act_conf.type == 39: # 黄巾起义 最高伤害 if not act_info: player.act.act_infos[act_id] = [1, 0] jindu = 0 else: jindu = act_info[1] elif act_conf.type == 40: # 镶嵌A个B级别宝石 jindu = 0 line_up_slots = player.line_up_component.line_up_slots for slot in line_up_slots.values(): if not slot.activation: # 如果卡牌位未激活 continue hero_obj = slot.hero_slot.hero_obj # 英雄实例 if hero_obj: for (runt_type, item) in hero_obj.runt.items(): for (runt_po, runt_info) in item.items(): # [runt_no, runt_id, main_attr, minor_attr] = runt_info quality = game_configs.stone_config.get('stones'). \ get(runt_info[1]).quality if quality == act_conf.parameterB: jindu += 1 if jindu >= act_conf.parameterA: player.act.act_infos[act_id] = [2, jindu] return {'state': 2} else: if not act_info or jindu > act_info[1]: player.act.act_infos[act_id] = [1, jindu] return {'state': 1, 'jindu': jindu} else: return {'state': 1, 'jindu': act_info[1]} elif act_conf.type == 41: # 占领矿达到a个 if not act_info: player.act.act_infos[act_id] = [1, 0] jindu = 0 else: jindu = act_info[1] elif act_conf.type == 45: if player.stage_component.get_stage(act_conf.parameterA).state != 1: return {'state': 1} else: return {'state': 2} elif act_conf.type == 44: if not act_info: player.act.act_infos[act_id] = [1, 0] jindu = 0 else: jindu = act_info[1] elif act_conf.type == 43: # 战队等级 达到a jindu = player.base_info.level elif act_conf.type == 46: # 战斗力达到a jindu = int(player.line_up_component.hight_power) elif act_conf.type == 55: # 阵容条件: 武将数量,品质,突破等级 jindu = line_up_activity_jindu(player, act_conf) logger.debug("jindu %s " % jindu) elif act_conf.type in [56, 57, 58, 59]: # 秘境条件: 刷新秘境,占领矿点,宝石收取,宝石合成 jindu = player.act.mine_activity_jindu(act_conf) if jindu >= act_conf.parameterA: return {'state': 2, 'jindu': jindu} else: return {'state': 1, 'jindu': jindu} elif act_conf.type in [60, 61, 62, 63]: # 宝物:合成,品质,数量 jindu = player.act.treasure_activity_jindu(act_conf) if jindu >= act_conf.parameterA: return {'state': 2, 'jindu': jindu} else: return {'state': 1, 'jindu': jindu} elif act_conf.type == 51: if not act_info: player.act.act_infos[act_id] = [0, []] return {'state': 0, 'jindu': []} if len(act_info[1]) < int(act_conf.parameterA): return {'state': 1, 'jindu': act_info[1]} if act_conf.parameterB > player.base_info.level: return {'state': 1, 'jindu': act_info[1]} if len(act_conf.parameterC) == 1 and \ act_conf.parameterC[0] > player.line_up_component.hight_power: return {'state': 1, 'jindu': act_info[1]} if len(act_conf.parameterD) == 1 and \ player.stage_component.get_stage(act_conf.parameterD[0]).state != 1: return {'state': 1, 'jindu': act_info[1]} player.act.act_infos[act_id][0] = 2 return {'state': 2, 'jindu': act_info[1]} elif act_conf.type == 50: if not act_info: player.act.act_infos[act_id] = [0, [0, 0, 0]] return {'state': 1, 'jindu': [0, 0, 0]} base_info = player.base_info if int(act_conf.parameterA) > base_info.vip_level: return {'state': 1, 'jindu': act_info[1]} if len(act_conf.parameterC) == 1 and \ not act_conf.parameterC[0] > act_info[1][0]: return {'state': 1, 'jindu': act_info[1]} if len(act_conf.parameterD) == 1 and \ not act_conf.parameterD[0] > act_info[1][1]: return {'state': 1, 'jindu': act_info[1]} return {'state': 2, 'jindu': act_info[1]} elif act_conf.type in [70, 72, 74, 65]: if not act_info: player.act.act_infos[act_id] = [1, 0, int(time.time())] return {'state': 1, 'jindu': 0} if days_to_current(act_info[2]) != 0: player.act.act_infos[act_id] = [1, 0, int(time.time())] return {'state': 1, 'jindu': 0} if act_info and act_info[0] == 3: return {'state': 3, 'jindu': act_info[1]} elif act_info and act_info[0] == 2: return {'state': 2, 'jindu': act_info[1]} if act_info[1] < int(act_conf.parameterA): return {'state': 1, 'jindu': act_info[1]} player.act.act_infos[act_id][0] = 2 return {'state': 2, 'jindu': act_info[1]} elif act_conf.type in [71, 73, 75, 76, 77]: if not act_info: player.act.act_infos[act_id] = [1, 0] return {'state': 1, 'jindu': 0} if act_info[1] < int(act_conf.parameterA): return {'state': 1, 'jindu': act_info[1]} player.act.act_infos[act_id][0] = 2 return {'state': 2, 'jindu': act_info[1]} else: logger.error('get act info type error') return {'state': 0, 'jindu': 0} # 到到a的统一在这里返回 if jindu >= act_conf.parameterA: player.act.act_infos[act_id] = [2, jindu] return {'state': 2} else: if not act_info or jindu > act_info[1]: player.act.act_infos[act_id] = [1, jindu] return {'state': 1, 'jindu': jindu} else: return {'state': 1, 'jindu': act_info[1]}
def current_day(self): return days_to_current(self.owner.base_info.register_time) % 30 + 1