def lood(self): res_mgr = self._game.res_mgr gids = [] boss_id = 0 for res_guard in res_mgr.deep_guards.itervalues(): if res_guard.is_boss: boss_id = res_guard.get_guards(50, 1) self.boss = res_guard else: gids.append((res_guard.lv1, res_guard.id)) self.get_gd2 = common.make_lv_regions(gids, accept_low=1) #阵型 poses = [] for res_pos in res_mgr.deep_poses.itervalues(): poses.append((res_pos.lv1, res_pos.id)) self.get_pid = common.make_lv_regions(poses, accept_low=1) if boss_id: mid = res_mgr.monster_levels.get(boss_id).mid self.boss_npc_id = res_mgr.monsters.get(mid).npc gd1ids = self.get_gd1_ids() self.gd1_npc_id = res_mgr.monsters.get(gd1ids[0]).npc times = self._game.setting_mgr.setdefault(DEEP_AUTO_TIMES, DEEP_AUTO_TIMES_V) self._auto_times = common.make_lv_regions(times)
def init_setting(): """ 奖励上限,返回:(银币, 练历) """ global arena_level, max_rewards, free_count, arena_coin, arena_ranks, \ arena_rw_succ, arena_rw_fail, arena_rw_weekdays, arena_rewards, \ arena_auto_start setting_mgr = Game.setting_mgr arena_level = setting_mgr.setdefault(ARENA_LEVEL, ARENA_LEVEL_V) auto_times = setting_mgr.setdefault(ARENA_MAX_REWARD, ARENA_MAX_REWARD_V) max_rewards = make_lv_regions(str2dict2(auto_times).items()) free_count = setting_mgr.setdefault(ARENA_FREE_COUNT, ARENA_FREE_COUNT_V) arena_coin = setting_mgr.setdefault(ARENA_YB, ARENA_YB_V) ranks = setting_mgr.setdefault(ARENA_RANK, ARENA_RANK_V) arena_ranks = make_lv_regions(str2dict2(ranks).items()) #奖励 rw_succ = setting_mgr.setdefault(ARENA_RW_SUCC, ARENA_RW_SUCC_v) arena_rw_succ = map(int, rw_succ.split('|')) rw_fail = setting_mgr.setdefault(ARENA_RW_FAIL, ARENA_RW_FAIL_v) arena_rw_fail = map(int, rw_fail.split('|')) arena_rw_weekdays = setting_mgr.setdefault(ARENA_RW_WEEKDAY, ARENA_RW_WEEKDAY_V) arena_rw_weekdays = map(int, arena_rw_weekdays.split('|')) rewards = setting_mgr.setdefault(ARENA_REWARDS, ARENA_REWARDS_V) arena_rewards = make_lv_regions(rewards) arena_auto_start = setting_mgr.setdefault(ARENA_AUTO_START, ARENA_AUTO_START_V)
def get_free_num(self, player): try: return self.mine_free_num(player.data.vip) except TypeError: sett_str = player._game.setting_mgr.setdefault(VIP_MINING_FREE, VIP_MINING_FREE_V) self.mine_free_num = common.make_lv_regions(sett_str) return self.mine_free_num(player.data.vip)
def get_max_f_num(self, player): try: return self.get_free_num(player.data.vip) except TypeError: sett_str = player._game.setting_mgr.setdefault(VIP_LV_FRIENDS, VIP_LV_FRIENDS_V) self.get_free_num = common.make_lv_regions(sett_str) return self.get_free_num(player.data.vip)
def get_rt_num(self, player): try: return self.get_res_time(player.data.vip) except TypeError: sett_str = player._game.setting_mgr.setdefault(VIP_LV_SHOPS, VIP_LV_SHOPS_V) self.get_res_time = common.make_lv_regions(sett_str) return self.get_res_time(player.data.vip)
def fish_max_num(self, player): try: num = self.judge_batch(player.data.vip) except TypeError: sett_str = player._game.setting_mgr.setdefault(VIP_FISH_BATCH, VIP_FISH_BATCH_V) self.judge_batch = common.make_lv_regions(sett_str) num = self.judge_batch(player.data.vip) return num
def update(self, adict): super(ResDeepGuard, self).update(adict) if self.is_boss: #boss self.boss_func = make_lv_regions(self.guard) elif self.guard: self.guard_func = RandomRegion(self.guard) else: log.error(u'深渊怪物配置表(%d)怪物配置缺少', self.id)
def get_max_f_num(self, player): try: return self.get_free_num(player.data.vip) except TypeError: sett_str = player._game.setting_mgr.setdefault( VIP_LV_FRIENDS, VIP_LV_FRIENDS_V) self.get_free_num = common.make_lv_regions(sett_str) return self.get_free_num(player.data.vip)
def fish_max_num(self, player): try: num = self.judge_batch(player.data.vip) except TypeError: sett_str = player._game.setting_mgr.setdefault( VIP_FISH_BATCH, VIP_FISH_BATCH_V) self.judge_batch = common.make_lv_regions(sett_str) num = self.judge_batch(player.data.vip) return num
def _op_sets(self, sets): if isinstance(sets, int): return sets sets = tuple(sets) rfunc = self.SET_RANS.get(sets) if rfunc is None: res_mgr = Game.res_mgr lv_sids = [] for sid in sets: s = res_mgr.equip_sets.get(sid) if s is None: raise ValueError(u'[奖励%s]配置中,套装(%s)找不到' % (self.items, sid)) lv_sids.append((s.lv, sid)) rfunc = make_lv_regions(lv_sids) self.SET_RANS[sets] = rfunc return rfunc
def load(self): #settings = Game.rpc_res_store.query_loads(TN_RES_SETTING, None) settings = Game.rpc_res_store.load_all(TN_RES_SETTING) for setting in settings: self.settings[setting['key']] = setting['value'] if isinstance(setting['value'], (int, float)): continue try: if setting['value'].isdigit(): f = int(setting['value']) else: f = float(setting['value']) if setting['value'].endswith('.0'): f = int(f) self.settings[setting['key']] = f except (ValueError, AttributeError): continue res_size = self.setdefault(VIP_LV_BAGS, VIP_LV_BAGS_V) self.fetch_size = common.make_lv_regions(res_size) self.safe_pub(MSG_RES_RELOAD)
def set_max_free_num(self, num_str): self._free_nums = common.make_lv_regions(num_str)
def _get_rids(self): try: return self.rids except AttributeError: self.rids = make_lv_regions(self.rd) return self.rids
def fetch_res(self, key, value): res_num = self.player._game.setting_mgr.setdefault(key, value) return common.make_lv_regions(res_num)
def _op_ids(self, ids): try: return make_lv_regions(ids) except Exception as e: raise ValueError(u'[奖励%s]ids(%s)配置错误:%s' % (self.items, ids, e))
def _load(self, key, value): return make_lv_regions(Game.setting_mgr.setdefault(key, value))
def init_get_vips_func(): global get_vip_rid vips = Game.setting_mgr.setdefault(VIP_REWARD, VIP_REWARD_V) get_vip_rid = make_lv_regions(vips)
def fetch_res(self, key, value): res_num = self._game.setting_mgr.setdefault(key, value) return common.make_lv_regions(res_num)