def get_pvp_data(character_id): char_obj = tb_character_info.getObj(character_id) if character_id >= 10000 and char_obj.exists(): keys = ['level', 'attackPoint', 'best_skill', 'unpars', 'current_unpar', 'copy_units', 'copy_units2'] pvp_data = char_obj.hmget(keys) pvp_data['character_id'] = character_id pvp_data['unpar_skill'] = pvp_data['current_unpar'] skill_level = pvp_data['unpars'].get(pvp_data['current_unpar'], 1) pvp_data['unpar_skill_level'] = skill_level # print 'get pvp data player:', pvp_data return pvp_data robot_obj = tb_character_info.getObj('robot') if robot_obj.hexists(character_id): pvp_data = robot_obj.hget(character_id) # print 'get pvp data robot:', pvp_data pvp_data['copy_units2'] = pvp_data['copy_units'] return pvp_data return {}
def _with_pvp_info(response, character_id): char_obj = tb_character_info.getObj(character_id) robot_obj = tb_character_info.getObj('robot') data = {} if character_id >= 10000 and char_obj.exists(): keys = ['line_up_slots', 'level', 'nickname', 'attackPoint', 'heads'] data = char_obj.hmget(keys) heads = Heads_DB() heads.ParseFromString(data['heads']) data['head'] = heads.now_head hero_nos, hero_levels = _get_hero_no_and_level(data['line_up_slots']) data['hero_ids'] = hero_nos data['hero_levels'] = hero_levels data['character_id'] = character_id elif robot_obj.hexists(character_id): data = robot_obj.hget(character_id) else: logger.error('no pvp info:%s', character_id) return response.level = data.get('level') response.nickname = data.get('nickname') response.ap = int(data.get('attackPoint')) response.hero_ids.extend([_ for _ in data['hero_ids']]) response.hero_levels.extend([_ for _ in data['hero_levels']]) response.head_no = data.get('head_no', 0) response.character_id = data.get('character_id')
def deal_player_infos(player, response): player_ids = player.pvp.rob_treasure rank_name, last_rank_name = rank_helper.get_power_rank_name() for player_id, ap in player_ids: if player_id >= 10000: player_data = tb_character_info.getObj(player_id) isexist = player_data.exists() if not isexist: logger.error('deal_player_infos, player id error') continue player_info = player_data.hmget( ['id', 'nickname', 'heads', 'vip_level', 'guild_id']) player_pb = response.player_info.add() player_pb.color = player.rob_treasure.get_target_color_info( player_id).id player_pb.id = player_info.get('id') player_pb.nickname = player_info.get('nickname', 'nickname') player_pb.vip_level = player_info.get('vip_level') if player_info.get('guild_id') and type( player_info.get('guild_id')) is types.StringType: player_pb.guild_id = player_info.get('guild_id') player_heads = Heads_DB() player_heads.ParseFromString(player_info['heads']) player_pb.now_head = player_heads.now_head rank_no = rank_helper.get_rank_by_key(rank_name, player_id) if not rank_no: logger.error('deal_player_infos, rank_no is None') continue [(_id, rankinfo)] = rank_helper.get_rank(rank_name, rank_no, rank_no) player_pb.power = int(rankinfo / const.power_rank_xs) player_pb.level = int(rankinfo % const.power_rank_xs) else: robot_obj = tb_character_info.getObj('robot') data = robot_obj.hget(player_id) player_pb = response.player_info.add() player_pb.color = player.rob_treasure.get_target_color_info( player_id).id player_pb.id = player_id player_pb.nickname = data.get('nickname') player_pb.vip_level = 0 player_pb.now_head = data.get('head_no', 0) player_pb.guild_id = '' player_pb.power = int(data.get('attackPoint')) player_pb.level = data.get('level')
def deal_player_infos(player, response): player_ids = player.pvp.rob_treasure rank_name, last_rank_name = rank_helper.get_power_rank_name() for player_id, ap in player_ids: if player_id >= 10000: player_data = tb_character_info.getObj(player_id) isexist = player_data.exists() if not isexist: logger.error('deal_player_infos, player id error') continue player_info = player_data.hmget(['id', 'nickname', 'heads', 'vip_level', 'guild_id']) player_pb = response.player_info.add() player_pb.color = player.rob_treasure.get_target_color_info(player_id).id player_pb.id = player_info.get('id') player_pb.nickname = player_info.get('nickname', 'nickname') player_pb.vip_level = player_info.get('vip_level') if player_info.get('guild_id') and type(player_info.get('guild_id')) is types.StringType: player_pb.guild_id = player_info.get('guild_id') player_heads = Heads_DB() player_heads.ParseFromString(player_info['heads']) player_pb.now_head = player_heads.now_head rank_no = rank_helper.get_rank_by_key(rank_name, player_id) if not rank_no: logger.error('deal_player_infos, rank_no is None') continue [(_id, rankinfo)] = rank_helper.get_rank(rank_name, rank_no, rank_no) player_pb.power = int(rankinfo/const.power_rank_xs) player_pb.level = int(rankinfo % const.power_rank_xs) else: robot_obj = tb_character_info.getObj('robot') data = robot_obj.hget(player_id) player_pb = response.player_info.add() player_pb.color = player.rob_treasure.get_target_color_info(player_id).id player_pb.id = player_id player_pb.nickname = data.get('nickname') player_pb.vip_level = 0 player_pb.now_head = data.get('head_no', 0) player_pb.guild_id = '' player_pb.power = int(data.get('attackPoint')) player_pb.level = data.get('level')
def save_data(self): props = {} for no, chip in self._chips.items(): if chip.chip_num: # 如果chip num == 0, 则不保存 props[no] = chip.chip_num items_data = tb_character_info.getObj(self.owner.base_info.id) items_data.hset('equipment_chips', props)
def save_data(self): activity = tb_character_info.getObj(self.owner.base_info.id) data = dict(buy_times=self._buy_times, #extra_can_buy_times=self._extra_can_buy_times, last_time=self._last_time ) activity.hset('buy_coin', data)
def reset_overcome(self): _times = self.pvp_overcome_refresh_count + 1 if _times > self.owner.base_info.buyGgzj_times: logger.error('overcome reset times error:%s-%s', self.pvp_overcome_refresh_count, self.owner.base_info.buyGgzj_times) return False character_info = tb_character_info.getObj(self.owner.base_info.id) types = [20001, 20002, 20003] ids = get_player_ids(self.owner.base_info.id, int(character_info.hget('attackPoint')), types, 47) if not ids: return False logger.debug('reset overcome:%s', ids) self._pvp_overcome = ids self._pvp_overcome_refresh_time = time.time() self._pvp_overcome_refresh_count += 1 self._pvp_overcome_current = 1 self._pvp_overcome_awards = [] self._pvp_overcome_stars = 0 self._pvp_overcome_buff_init = {} self._pvp_overcome_buff = {} self._pvp_overcome_failed = False self.save_data() tlog_action.log('OvercomeReset', self.owner, self._pvp_overcome_refresh_count) return True
def reset_rob_treasure(self): # types = [30001, 30002, 30003] character_info = tb_character_info.getObj(self.owner.base_info.id) types = game_configs.base_config.get('indianaMatch') num = 0 for _id in types: item1 = game_configs.arena_fight_config.get(_id) item = CommonItem(item1) if not item: logger.error('arena_fight_config:%d', _id) for x in item.play_rank: if x > num: num = x power = character_info.hget('attackPoint') if not power: power = 100 ids = get_player_ids(self.owner.base_info.id, power, types, num+1) if [0, 0] in ids: ids.remove([0, 0]) self._rob_treasure = ids print ids, '============================reset rob treasure'
def init_player_info(self): logger.debug("init_player_info===========") character_obj = tb_character_info.getObj(self._pid) character_info = character_obj.hgetall() for k, c in self._components.items(): print(k) c.init_data(character_info)
def save_data(self, prop_names=[]): props = { 'line_up_slots': dict([(slot_no, slot.dumps()) for slot_no, slot in self._line_up_slots.items()]), 'sub_slots': dict([(slot_no, sub_slot.dumps()) for slot_no, sub_slot in self._sub_slots.items()]), 'line_up_order': self._line_up_order, 'unpar_level': self._unpar_level, 'unpar_type': self._unpar_type, 'unpar_other_id': self._unpar_other_id, 'ever_have_heros': self._ever_have_heros, 'unpar_names': self._unpar_names, 'friend_fight_times': self._friend_fight_times, 'hight_power': self._hight_power, 'caption_pos': self._caption_pos, } if not prop_names or 'line_up_slots' in prop_names or 'sub_slots' in prop_names: power = self.combat_power props['attackPoint'] = power hook_task(self.owner, CONDITIONId.FIGHT_POWER, power) if ('copy_units' in prop_names) or (not prop_names): props['copy_units'] = self.owner.fight_cache_component.red_unit props['copy_slots'] = line_up_info(self.owner).SerializeToString() line_up_obj = tb_character_info.getObj(self.character_id) line_up_obj.hmset(props)
def create_character_data(self): character_info = {'id': self._pid} for k, c in self._components.items(): newdict = c.new_data() character_info.update(newdict) char_obj = tb_character_info.getObj(self._pid) logger.debug('new player db:%s:level:%s', character_info['id'], character_info['level']) char_obj.new(character_info) tb_character_info.sadd('new', self._pid) # fake============================================ if self._pid != 999: logger.debug('add hero %s', game_configs.base_config.get('initialHero')) for pos, hero_id in game_configs.base_config.get('initialHero').items(): hero = self.hero_component.add_hero(hero_id) hero.hero_no = hero_id hero.level = 1 hero.break_level = 0 hero.exp = 0 hero.save_data() self.line_up_component.change_hero(1, hero_id, 0) self.line_up_component.save_data() self.friends.add_applicant(999) self.friends.add_friend(999) self.friends.save_data()
def fight_start(stage, fid, player): """开始战斗 """ # 校验信息:是否开启,是否达到次数上限等 res = stage.check() if not res.get('result'): return res fight_cache_component = player.fight_cache_component fight_cache_component.stage_id = stage.stage_id fight_cache_component.stage = stage red_units, blue_units, drop_num, monster_unpara = fight_cache_component.fighting_start( ) # 好友 char_obj = tb_character_info.getObj(fid) lord_data = char_obj.hget('lord_attr_info') f_unit = None if lord_data and not is_not_open(player, FO_FRIEND_SUPPORT): info = lord_data.get('info') f_unit = BattleUnit.loads(info) else: logger.debug('can not find friend id :%d' % fid) return dict(result=True, red_units=red_units, blue_units=blue_units, drop_num=drop_num, monster_unpara=monster_unpara, f_unit=f_unit, result_no=0)
def new_hero_data(self, hero): pid = self.owner.character_id hero_property = hero.hero_proerty_dict() char_obj = tb_character_info.getObj(pid).getObj('heroes') result = char_obj.hsetnx(hero_property['hero_no'], hero_property) if not result: logger.error('new hero error!:%s', hero_property['hero_no'])
def _new_mail_data(self, mail): character_id = self.owner.base_info.id char_obj = tb_character_info.getObj(character_id).getObj('mails') result = char_obj.hsetnx(mail.mail_id, mail.SerializePartialToString()) if not result: logger.error('add mail error!:%s', mail.mail_id)
def save_mail(self, mail_id): if mail_id not in self._mails: return mail = self._mails[mail_id] char_obj = tb_character_info.getObj( self.owner.base_info.id).getObj('mails') char_obj.hset(mail.mail_id, mail.SerializePartialToString())
def save_data(self): props = {'fine_hero_last_pick_time': self._fine_hero, 'excellent_hero_last_pick_time': self._excellent_hero, 'fine_equipment_last_pick_time': self._fine_equipment, 'excellent_equipment_last_pick_time': self._excellent_equipment} character_obj = tb_character_info.getObj(self.owner.base_info.id) character_obj.hmset(props)
def save_data(self): props = { 'stage_info': dict([(stage_id, stage.dumps()) for stage_id, stage in self._stage_info.iteritems()]), 'award_info': dict([(chapter_id, stage_award.dumps()) for chapter_id, stage_award in self._award_info.iteritems() ]), 'elite_stage': self._elite_stage_info, 'plot_chapter': self._plot_chapter, 'act_stage': self._act_stage_info, 'star_num': self._star_num, 'stage_progress': self._stage_progress, 'rank_stage_progress': self._rank_stage_progress, 'stage_up_time': self._stage_up_time, 'already_look_hide_stage': self._already_look_hide_stage, 'act_lucky_heros': self._act_lucky_heros } char_obj = tb_character_info.getObj(self.owner.base_info.id) char_obj.hmset(props)
def init_data(self, c): character_id = self.owner.base_info.id char_obj = tb_character_info.getObj(self.owner.base_info.id).getObj('equipments') equipments = char_obj.hgetall() for eid, equipment_data in equipments.items(): equipment_info = equipment_data.get('equipment_info') equipment_id = equipment_data.get('id') equipment_no = equipment_info.get('equipment_no') # 装备编号 strengthen_lv = equipment_info.get('slv') # 装备强化等级 awakening_lv = equipment_info.get('alv') # 装备觉醒等级 main_attr = equipment_info.get('main_attr', {}) minor_attr = equipment_info.get('minor_attr', {}) is_guard = equipment_info.get('is_guard') # guard exp = equipment_info.get('exp', 0) prefix = equipment_info.get('prefix') # prefix attr_id = equipment_info.get('attr_id', 0) # attr_id enhance_info = equipment_data.get('enhance_info') # 装备强化花费记录 nobbing_effect = equipment_data.get('nobbing_effect') # 装备锤炼效果 equipment_obj = Equipment(character_id, equipment_id, '', equipment_no, strengthen_lv, awakening_lv, enhance_info, nobbing_effect, is_guard, main_attr, minor_attr, prefix, attr_id, exp) self._equipments_obj[equipment_id] = equipment_obj
def add_data(self, character_id, attr_id=0): no = self._base_info.equipment_no mainAttr, minorAttr, prefix, equip_attr_id = init_equipment_attr(no, attr_id) print mainAttr, minorAttr, prefix, equip_attr_id, '============================================equipment_attr' self._attribute.main_attr = mainAttr self._attribute.minor_attr = minorAttr self._attribute.prefix = prefix self._attribute.attr_id = equip_attr_id data = dict(id=self._base_info.id, equipment_info=dict(equipment_no=no, slv=self._attribute.strengthen_lv, alv=self._attribute.awakening_lv, is_guard=self._attribute.is_guard, exp=self._attribute.exp, main_attr=mainAttr, minor_attr=minorAttr, prefix=prefix, attr_id=equip_attr_id), enhance_info=self._record.enhance_record, nobbing_effect=self._attribute.nobbing_effect) char_obj = tb_character_info.getObj(character_id).getObj('equipments') result = char_obj.hsetnx(self._base_info.id, data) if not result: logger.error('add equipment error!:%s', self._base_info.id)
def save(self): data_obj = tb_character_info.getObj(self.owner.base_info.id) data_obj.hmset({'travel': self._travel, 'travel_item': self._travel_item, 'chest_time': self._chest_time, 'auto': self._auto, 'fight_cache': self._fight_cache})
def save_data(self): data_obj = tb_character_info.getObj(self.owner.base_info.id) data_obj.hmset({'truce': self._truce, 'ltruce_item': self._truce_item, 'refresh_time': self._refresh_time, 'can_receive': self._can_receive, })
def fight_start(stage, fid, player): """开始战斗 """ # 校验信息:是否开启,是否达到次数上限等 res = stage.check() if not res.get('result'): return res fight_cache_component = player.fight_cache_component fight_cache_component.stage_id = stage.stage_id fight_cache_component.stage = stage red_units, blue_units, drop_num, monster_unpara = fight_cache_component.fighting_start() # 好友 char_obj = tb_character_info.getObj(fid) lord_data = char_obj.hget('lord_attr_info') f_unit = None if lord_data and not is_not_open(player, FO_FRIEND_SUPPORT): info = lord_data.get('info') f_unit = BattleUnit.loads(info) else: logger.debug('can not find friend id :%d' % fid) return dict(result=True, red_units=red_units, blue_units=blue_units, drop_num=drop_num, monster_unpara=monster_unpara, f_unit=f_unit, result_no=0)
def save_data(self): character_info = tb_character_info.getObj(self.id) self._upgrade_time = int(time.time()) data = dict(level=self._level, nickname=self._base_name, exp=self.exp, gag=self._gag, closure=self._closure, newbee_guide=self._newbee_guide, current_newbee_guide=self._current_newbee_guide, vip_level=self._vip_level, upgrade_time=self._upgrade_time, heads=self._heads.SerializeToString(), google_consume_id=self._google_consume_id, google_consume_data=self._google_consume_data, apple_transaction_id=self._apple_transaction_id, first_recharge_ids=self._first_recharge_ids, recharge_accumulation=self._recharge, gen_balance=self._gen_balance, tomorrow_gift=self._tomorrow_gift, battle_speed=self._battle_speed, is_open_next_day_activity=self._is_open_next_day_activity, first_recharge_activity=self._first_recharge_activity, story_id=self._story_id, button_one_time=self._button_one_time, hero_awake_time=self._hero_awake_time, max_single_recharge=self._max_single_recharge, flowid=self._flowid, one_dollar_flowid=self._one_dollar_flowid) character_info.hmset(data)
def save_data(self): char_obj = tb_character_info.getObj(self.owner.base_info.id) data = {} for k, boss in self._bosses.items(): data[k] = boss.get_data_dict() char_obj.hset('world_boss', data)
def save_data(self): shop = tb_character_info.getObj(self.owner.base_info.id) if shop: data = {'shop': self._shop_data, 'shop_extra_args': self._shop_extra_args} shop.hmset(data) else: logger.error('cant find shop:%s', self.owner.base_info.id)
def create_character_data(self): character_info = {'id': self._pid} for k, c in self._components.items(): newdict = c.new_data() character_info.update(newdict) char_obj = tb_character_info.getObj(self._pid) logger.debug('new player db:%s:level:%s', character_info['id'], character_info['level']) char_obj.new(character_info) tb_character_info.sadd('new', self._pid) # fake============================================ if self._pid != 999: logger.debug('add hero %s', game_configs.base_config.get('initialHero')) for pos, hero_id in game_configs.base_config.get( 'initialHero').items(): hero = self.hero_component.add_hero(hero_id) hero.hero_no = hero_id hero.level = 1 hero.break_level = 0 hero.exp = 0 hero.save_data() self.line_up_component.change_hero(1, hero_id, 0) self.line_up_component.save_data() self.friends.add_applicant(999) self.friends.add_friend(999) self.friends.save_data()
def save_data(self): mine_obj = tb_character_info.getObj(self.owner.base_info.id) if mine_obj: data = {'stones': {'1': self._stones}} mine_obj.hmset(data) else: logger.error('cant find mine:%s', self.owner.base_info.id)
def save(self): data_obj = tb_character_info.getObj(self.owner.base_info.id) data_obj.hmset({'m_runt': self._m_runt, 'stone1': self._stone1, 'stone2': self._stone2, 'refresh_runt': self._refresh_runt, 'refresh_times': self._refresh_times})
def delete_mail(self, mail_id): if mail_id not in self._mails: return mail = self._mails[mail_id] char_obj = tb_character_info.getObj( self.owner.base_info.id).getObj('mails') result = char_obj.hdel(mail.mail_id) del self._mails[mail_id]
def save_data(self): pid = self.base_info.id character_info = tb_character_info.getObj(pid) character_info.update_multi( dict(level=self._level.level, exp=self.level.exp, pvp_times=self._pvp_times, vip_level=self._vip.vip_level))
def init_data(self, c): pid = self.owner.base_info.id char_obj = tb_character_info.getObj(pid).getObj('heroes') heros = char_obj.hgetall() for hid, data in heros.items(): hero = Hero(pid) hero.init_data(data) self._heros[hero.hero_no] = hero
def save_data(self): props = {} for item_no, item in self._items.iteritems(): props[item_no] = item.num char_obj = tb_character_info.getObj(self.owner.base_info.id) logger.debug(str(props)) char_obj.hset('items', props)
def save_data(self): data_obj = tb_character_info.getObj(self.owner.base_info.id) data_obj.hmset({ 'conditions': self._conditions, 'conditions_day': self._conditions_day, 'tasks': self._tasks, 'last_day': self._last_day })
def init_data(self, c): pid = self.owner.base_info.id char_obj = tb_character_info.getObj(pid).getObj('mails') mails = char_obj.hgetall() for mid, mail_data in mails.items(): mail = Mail_PB() mail.ParseFromString(mail_data) self._mails[mail.mail_id] = mail
def save_data(self): data_obj = tb_character_info.getObj(self.owner.base_info.id) data_obj.hmset({ 'truce': self._truce, 'ltruce_item': self._truce_item, 'refresh_time': self._refresh_time, 'can_receive': self._can_receive, })
def save_data(self): data_obj = tb_character_info.getObj(self.owner.base_info.id) data_obj.hmset({ 'free_time': self._free_time, 'draw_times': self._draw_times, 'integral_draw_times': self._integral_draw_times, 'activity_id': self._activity_id })
def save_data(self): check_mine(self._mine) mine_obj = tb_character_info.getObj(self.owner.base_info.id) data = dict(mine=self._mine, reset_day=self._reset_day, reset_times=self._reset_times, day_before=self._tby, lively=self._lively) mine_obj.hmset(data)
def save_data(self): char_obj = tb_character_info.getObj(self.owner.base_info.id) if char_obj: char_obj.hset('rebate', self._rebate) char_obj.hset('month_buy', self._month_buy) char_obj.hset('last_time', self._last_time) char_obj.hset('mail_id', self._mail_id) else: logger.error('cant find Rebate:%s', self.owner.base_info.id)
def save(self): data_obj = tb_character_info.getObj(self.owner.base_info.id) data_obj.hmset({ 'm_runt': self._m_runt, 'stone1': self._stone1, 'stone2': self._stone2, 'refresh_runt': self._refresh_runt, 'refresh_times': self._refresh_times })
def save_data(self): props = dict(sign_round=self._sign_round, sign_in_days=self._sign_in_days, continuous_sign_in_prize=self._continuous_sign_in_prize, box_sign_in_prize=self._box_sign_in_prize, repair_sign_in_times=self._repair_sign_in_times) sign_in_data = tb_character_info.getObj(self.owner.base_info.id) sign_in_data.hset('sign_in', props)
def query_1243(data, player): """ 查看矿点详细信息 """ request = mine_pb2.positionRequest() request.ParseFromString(data) response = mine_pb2.mineDetail() response.position = request.position detail_info = player.mine.detail_info(request.position) # print detail_info last_increase = detail_info.get('increase', 0) stype = detail_info['type'] mine_item = game_configs.mine_config[detail_info['mine_id']] limit = mine_item.outputLimited normal = detail_info['normal'] lucky = detail_info['lucky'] guard_time = detail_info.get('guard_time', 0) stage_id = detail_info.get('stage_id', 0) seek_help = detail_info.get('seek_help', 0) response.res.result = True mstatus = player.mine.mine_info(request.position) one_mine_info(player, mstatus, response.mine) response.limit = limit for sid, num in normal.items(): one_type = response.normal.add() one_type.stone_id = int(sid) one_type.stone_num = num for sid, num in lucky.items(): one_type = response.lucky.add() one_type.stone_id = int(sid) one_type.stone_num = num response.increase = int(last_increase) if stype == 2: response.stage_id = int(stage_id) response.seek_help = seek_help line_up_info(player, response.lineup) if stype == 1: response.accelerate_times = detail_info.get('accelerate_times', 0) _uid = detail_info['uid'] char_obj = tb_character_info.getObj(_uid) if char_obj.exists(): lineup = char_obj.hget('copy_slots') response.lineup.ParseFromString(lineup) mid = player.mine.mid(request.position) mine_item = game_configs.mine_config.get(mid) response.genUnit = mine_item.timeGroup1 / mine_item.outputGroup1 response.rate = mine_item.increase response.incrcost = mine_item.increasePrice response.guard_time = int(guard_time) player.mine.save_data() print response, '=========================aaa' return response.SerializePartialToString()
def save_data(self): props = { 'fine_hero_last_pick_time': self._fine_hero, 'excellent_hero_last_pick_time': self._excellent_hero, 'fine_equipment_last_pick_time': self._fine_equipment, 'excellent_equipment_last_pick_time': self._excellent_equipment } character_obj = tb_character_info.getObj(self.owner.base_info.id) character_obj.hmset(props)
def save_data(self): data_obj = tb_character_info.getObj(self.owner.base_info.id) data_obj.hmset({'guild_id': self._g_id, 'position': self._position, 'contribution': self._contribution, 'all_contribution': self._all_contribution, 'bless': self._bless, 'praise': self._praise, 'apply_guilds': self._apply_guilds, 'exit_time': self._exit_time})
def save_data(self): props = dict( sign_round=self._sign_round, sign_in_days=self._sign_in_days, continuous_sign_in_prize=self._continuous_sign_in_prize, box_sign_in_prize=self._box_sign_in_prize, repair_sign_in_times=self._repair_sign_in_times) sign_in_data = tb_character_info.getObj(self.owner.base_info.id) sign_in_data.hset('sign_in', props)
def save_data(self): sign_in_data = tb_character_info.getObj(self.owner.base_info.id) sign_in_data.hset('login_gift', { 'cumulative_day': self._cumulative_day, 'continuous_day': self._continuous_day, 'continuous_day_num': self._continuous_day_num, 'cumulative_day_num': self._cumulative_day_num, 'continuous_7day': self._continuous_7day, 'continuous_7day_num': self._continuous_7day_num, 'last_login': self._last_login})
def save_data(self): props = {} for no, chip in self._chips.items(): if chip.num <= 0: del self._chips[no] continue props[no] = chip.num items_data = tb_character_info.getObj(self.owner.base_info.id) items_data.hset('hero_chips', props)