本文整理汇总了Python中shared.tlog.tlog_action.log函数的典型用法代码示例。如果您正苦于以下问题:Python log函数的具体用法?Python log怎么用?Python log使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了log函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: compose_equipment_403
def compose_equipment_403(pro_data, player):
"""合成装备
@param dynamic_id:
@param pro_data:
@return:
"""
request = equipment_request_pb2.ComposeEquipmentRequest()
request.ParseFromString(pro_data)
equipment_chip_no = request.no
response = equipment_response_pb2.ComposeEquipmentResponse()
data = compose_equipment(equipment_chip_no, player)
result = data.get('result')
res = response.res
if not result:
res.result_no = data.get('result_no')
res.message = data.get('message')
return response.SerializePartialToString()
equipment_obj = data.get('equipment_obj')
equ = response.equ
equipment_obj.update_pb(equ)
tlog_action.log('EquipmentCompose', player,
equipment_obj.base_info.equipment_no,
equipment_obj.base_info.id)
res.result = True
return response.SerializePartialToString()
示例2: change_hero
def change_hero(self, slot_no, hero_no, change_type):
"""更换阵容主将
@param slot_no:
@param hero_no:
@:param change_type: 0:阵容 1:助威
@return:
"""
if not change_type:
slot_obj = self._line_up_slots.get(slot_no)
else:
slot_obj = self._sub_slots.get(slot_no)
origin_hero_no = slot_obj.hero_slot.hero_no
origin_hero = self.owner.hero_component.get_hero(origin_hero_no)
if origin_hero:
origin_hero.is_online = False
else:
origin_hero_no = 0
slot_obj.change_hero(hero_no)
target_hero = self.owner.hero_component.get_hero(hero_no)
if hero_no != 0:
assert target_hero != None, "change hero can not be None!"
target_hero.is_online = True
tlog_action.log('LineUpChange', self.owner, slot_no, origin_hero_no,
hero_no, change_type)
# 如果无双条件不满足,则无双设为空
hero_nos = set(self.hero_nos) # 阵容英雄编号
for skill_id, item in game_configs.warriors_config.items():
if skill_id not in self._unpars:
conditions = item.get('conditions')
if conditions and hero_nos.issuperset(conditions):
self._unpars[skill_id] = 1
示例3: melting_equipment
def melting_equipment(equipment_id, response, player):
"""熔炼
@param dynamic_id:
@param equipment_ids:
@param kwargs:
@return:
"""
if is_not_open(player, FO_EQUIP_SACRIFICE):
return {"result": False, "result_no": 837}
equipment_obj = player.equipment_component.get_equipment(equipment_id)
if not equipment_obj:
return {'result': False, 'result_no': 401, 'message': u''}
melting_items = equipment_obj.melting_item
gain = item_group_helper.gain(player, melting_items, const.MELTING_EQUIPMENT)
item_group_helper.get_return(player, gain, response.cgr)
tlog_action.log('EquipmentMelting', player,
equipment_obj.base_info.equipment_no,
equipment_obj.base_info.id)
# 删除装备
player.equipment_component.delete_equipment(equipment_id)
# 添加强化金币
strength_coin = 0
for record in equipment_obj.enhance_record.enhance_record:
strength_coin += record[2]
strength_coin = int(strength_coin*game_configs.base_config.get("equRefundRatio"))
return strength_coin
示例4: upgrade_guild_skill_2404
def upgrade_guild_skill_2404(pro_data, player):
"""
升级军团技能
"""
request = guild_pb2.UpGuildSkillRequest()
request.ParseFromString(pro_data)
logger.error("request %s" % request)
response = guild_pb2.UpGuildSkillResponse()
logger.error("request %s" % request)
skill_type = request.skill_type
data = remote_gate['world'].guild_boss_init_remote(player.guild.g_id)
guild_skills = data.get("guild_skills")
build = data.get("build")
skill_level = guild_skills.get(skill_type)
logger.debug("skill level %s" % skill_level)
# check
guild_skill_item = game_configs.guild_skill_config.get(skill_type).get(skill_level)
logger.debug("guild_skill_config %s" % guild_skill_item)
response.res.result = False
if guild_skills.get(skill_type) >= 10:
logger.debug("guild skill %s has reach the max!" % skill_type)
response.res.result_no = 24044
return response.SerializeToString()
#if not is_afford(player, guild_skill_item.Consume).get('result'):
#logger.debug("consume not enough!")
#response.res.result_no = 24041
#return response.SerializeToString()
for condition2 in guild_skill_item.Skill_condition[2]:
tmp_guild_skill_item = game_configs.guild_skill_config.get(condition2)
_skill_type = tmp_guild_skill_item.type
skill_level = tmp_guild_skill_item.Skill_level
if skill_level > guild_skills[_skill_type]:
logger.debug("skill level conidtion not enough!")
response.res.result_no = 24042
return response.SerializeToString()
for condition1 in guild_skill_item.Skill_condition[1]:
tmp_guild_item = game_configs.guild_config.get(condition1)
guild_type = tmp_guild_item.type
guild_level = tmp_guild_item.level
if guild_level > build[guild_type]:
logger.debug("guild build level not enough!")
response.res.result_no = 24043
return response.SerializeToString()
res = remote_gate['world'].upgrade_guild_skill_remote(player.guild.g_id, skill_type)
if res.get("result"):
# consume
#return_data = consume(player, guild_skill_item.Consume, const.UPGRADE_GUILD_SKILL)
#get_return(player, return_data, response.consume)
response.guild_skill_point = guild_skill_item.Consumption
response.res.result = res.get("result")
tlog_action.log('UpgradeGuildSkill', player, player.guild.g_id,
skill_type, guild_skills.get(skill_type)+1, guild_skill_item.Consumption)
logger.debug("response %s" % response)
return response.SerializeToString()
示例5: invite_1908
def invite_1908(data, player):
"""发送/接受邀请"""
request = escort_pb2.InviteEscortTaskRequest()
request.ParseFromString(data)
logger.debug("request %s" % request)
response = common_pb2.CommonResponse()
task_id = request.task_id
send_or_in = request.send_or_in
protect_or_rob = request.protect_or_rob
task_guild_id = request.task_guild_id
rob_no = request.rob_no
escort_open_time_item = game_configs.base_config.get("EscortOpenTime")
if not is_in_period(escort_open_time_item):
logger.error("feature not open!")
response.result = False
response.result_no = 30000
return response.SerializePartialToString()
res = None
if send_or_in == 1:
res = send_invite(player, task_id, protect_or_rob, task_guild_id, rob_no)
elif send_or_in == 2:
res = in_invite(player, task_id, protect_or_rob, task_guild_id, rob_no)
response.result = res.get('result')
if not res.get('result'):
response.result_no = res.get('result_no')
return response.SerializePartialToString()
tlog_action.log('GuildTaskInvite', player, task_id, task_guild_id, send_or_in, protect_or_rob, rob_no)
response.result = True
return response.SerializePartialToString()
示例6: func
def func():
player.sign_in_component.sign_in(day)
player.sign_in_component.save_data()
sign_round = player.sign_in_component.sign_round
print game_configs.sign_in_config.get(sign_round), "---------"
print game_configs.sign_in_config.get(sign_round).get(day), "-------"
if not game_configs.sign_in_config.get(sign_round) or not game_configs.sign_in_config.get(sign_round).get(day):
return
sign_in_info = game_configs.sign_in_config.get(sign_round).get(day)
#vip双倍
if player.base_info.vip_level > 0 and \
sign_in_info.get("vipDouble") and \
player.base_info.vip_level >= sign_in_info.get("vipDouble"):
is_double = 1
else:
is_double = 0
if is_double:
return_data = gain(player, sign_in_info.get("reward"), const.REPAIR_SIGN, multiple=2)
get_return(player, return_data, response.gain)
else:
return_data = gain(player, sign_in_info.get("reward"), const.REPAIR_SIGN)
get_return(player, return_data, response.gain)
player.sign_in_component.repair_sign_in_times += 1
player.sign_in_component.save_data()
tlog_action.log('RepairSignIn', player, day, len(player.sign_in_component.sign_in_days), sign_in_info.get("id"))
示例7: melting_equipment
def melting_equipment(equipment_id, response, player):
"""熔炼
@param dynamic_id:
@param equipment_ids:
@param kwargs:
@return:
"""
equipment_obj = player.equipment_component.get_equipment(equipment_id)
if not equipment_obj:
return {'result': False, 'result_no': 401, 'message': u''}
melting_items = equipment_obj.melting_item
gain = item_group_helper.gain(player, melting_items, const.MELTING_EQUIPMENT)
item_group_helper.get_return(player, gain, response.cgr)
tlog_action.log('EquipmentMelting', player,
equipment_obj.base_info.equipment_no,
equipment_obj.base_info.id)
# 删除装备
player.equipment_component.delete_equipment(equipment_id)
# 添加强化金币
strength_coin = 0
for record in equipment_obj.enhance_record.enhance_record:
strength_coin += record[2]
strength_coin = int(strength_coin*game_configs.base_config.get("equRefundRatio"))
player.finance.coin += strength_coin
player.finance.save_data()
response.cgr.finance.coin += strength_coin
change = response.cgr.finance.finance_changes.add()
change.item_type = 107
change.item_num = strength_coin
change.item_no = 1
示例8: compose_equipment_403
def compose_equipment_403(pro_data, player):
"""合成装备
@param dynamic_id:
@param pro_data:
@return:
"""
request = equipment_request_pb2.ComposeEquipmentRequest()
request.ParseFromString(pro_data)
equipment_chip_no = request.no
response = equipment_response_pb2.ComposeEquipmentResponse()
open_stage_id = game_configs.base_config.get('equAssembleOpenStage')
if player.stage_component.get_stage(open_stage_id).state != 1:
response.res.result = False
response.res.result_no = 837
return response.SerializeToString()
data = compose_equipment(equipment_chip_no, player)
result = data.get('result')
res = response.res
if not result:
res.result_no = data.get('result_no')
res.message = data.get('message')
return response.SerializePartialToString()
equipment_obj = data.get('equipment_obj')
equ = response.equ
equipment_obj.update_pb(equ)
tlog_action.log('EquipmentCompose', player,
equipment_obj.base_info.equipment_no,
equipment_obj.base_info.id)
res.result = True
return response.SerializePartialToString()
示例9: change_hero
def change_hero(self, slot_no, hero_no, change_type):
"""更换阵容主将
@param slot_no:
@param hero_no:
@:param change_type: 0:阵容 1:助威
@return:
"""
if not change_type:
slot_obj = self._line_up_slots.get(slot_no)
else:
slot_obj = self._sub_slots.get(slot_no)
origin_hero_no = slot_obj.hero_slot.hero_no
origin_hero = self.owner.hero_component.get_hero(origin_hero_no)
if origin_hero:
origin_hero.is_online = False
else:
origin_hero_no = 0
slot_obj.change_hero(hero_no)
if hero_no == 0 and slot_no == self.caption_pos:
# 队长下阵,更改队长
self.remove_caption_hero()
target_hero = self.owner.hero_component.get_hero(hero_no)
if hero_no != 0:
assert target_hero != None, "change hero can not be None!"
target_hero.is_online = True
# 更新 七日奖励
target_update(self.owner, [55])
tlog_action.log('LineUpChange', self.owner, slot_no, origin_hero_no,
hero_no, change_type)
示例10: settle
def settle(self, result, response):
"""
战斗结算
"""
player = self._player
stage_id = self._stage_id
conf = self.get_stage_config()
# todo: 更新战斗次数
# 体力
if result:
player.stamina.stamina -= conf.vigor
player.stamina.save_data()
# 活跃度
# 结算
stage_util.settle(player, result, response, conf, stage_type=1)
# hook task
hook_task(player, CONDITIONId.ANY_STAGE, 1)
hook_task(player, CONDITIONId.STAGE, stage_id)
tlog_action.log('RoundFlow', player, stage_id, 1, 0, 1)
else:
tlog_action.log('RoundFlow', player, stage_id, 1, 0, 0)
示例11: get_level_gift_1131
def get_level_gift_1131(data, player):
"""get online gift"""
request = level_gift_pb2.GetLevelGift()
request.ParseFromString(data)
response = level_gift_pb2.GetLevelGiftResponse()
activity_level_gift = game_configs.activity_config.get(3)
if request.gift_id in player.level_gift.received_gift_ids:
response.result = False
return response.SerializeToString()
for a in activity_level_gift:
if request.gift_id == a['id']:
gain_data = a['reward']
return_data = gain(player, gain_data, const.LEVEL_GIFT)
get_return(player, return_data, response.gain)
player.level_gift.received_gift_ids.append(request.gift_id)
player.level_gift.save_data()
tlog_action.log('LevelGift', player, request.gift_id)
response.result = True
return response.SerializeToString()
response.result = False
return response.SerializeToString()
示例12: get_act_gift_1832
def get_act_gift_1832(data, player):
args = activity_pb2.GetActGiftRequest()
args.ParseFromString(data)
act_id = args.act_id
response = activity_pb2.GetActGiftResponse()
response.res.result = False
act_conf = game_configs.activity_config.get(act_id)
is_open = player.act.is_activiy_open(act_id)
if not act_conf or not is_open:
response.res.result_no = 800
return response.SerializeToString()
act_type = act_conf.type
received_ids = player.act.received_ids.get(act_type)
if received_ids and act_id in received_ids:
response.res.result_no = 801
return response.SerializeToString()
if act_type == 20: # 战力
res = get_20_gift(player, act_conf, response)
tlog_arg = player.line_up_component.combat_power
elif act_type == 21: # 通关关卡
res = get_21_gift(player, act_conf, response)
tlog_arg = player.stage_component.stage_progress
if res:
if received_ids:
player.act.received_ids.get(act_type).append(act_id)
else:
player.act.received_ids[act_type] = [act_id]
player.act.save_data()
response.res.result = True
tlog_action.log('Activity', player, act_id, tlog_arg)
return response.SerializeToString()
示例13: recharge_gain
def recharge_gain(self, recharge_item, response, is_tencent=False):
"""
充值掉落
"""
logger.debug("recharge_gain========1")
isfirst = 0
if not is_tencent:
return_data = gain(self._owner, recharge_item.get('setting'),
const.RECHARGE) # 获取
get_return(self._owner, return_data, response.gain)
if recharge_item.get('type') == 2:
logger.debug("recharge_gain========")
rebate_call(self._owner, recharge_item)
self._owner.recharge.send_mail(recharge_item) #发送奖励邮件
else:
rres = self._owner.base_info.first_recharge(recharge_item, response)
if rres:
#首次充值
isfirst = 1
self._owner.recharge.send_mail(recharge_item) #发送奖励邮件
tlog_action.log('Recharge', self._owner, isfirst,
recharge_item.get('id'))
charge_num = recharge_item.get('activity') # 充值元宝数量
# vip
self._owner.base_info.recharge += charge_num
self._owner.base_info.set_vip_level(self._owner.base_info.recharge)
# 活动
self._owner.recharge.charge(charge_num)
if not is_tencent:
self._owner.recharge.get_recharge_response(response.info) # recharge
示例14: refresh_tasks_1904
def refresh_tasks_1904(data, player):
"""刷新任务列表"""
response = escort_pb2.RefreshEscortTaskResponse()
response.res.result = True
escort_component = player.escort_component
if escort_component.refresh_times >= game_configs.base_config.get("EscortRefreshFrequencyMax"):
logger.error("reach the max refresh time!")
response.res.result = False
response.res.result_no = 190401
return response.SerializePartialToString()
price = game_configs.base_config.get("EscortRefreshPrice")
need_gold = price[escort_component.refresh_times]
def func():
escort_component.refresh_tasks() #刷新任务
escort_component.refresh_times = escort_component.refresh_times + 1
escort_component.save_data()
for _, task in escort_component.tasks.items():
task_pb = response.tasks.add()
update_task_pb(task, task_pb)
player.pay.pay(need_gold, const.REFRESH_ESCORT_TASKS, func)
tlog_action.log('RefreshEscortTasks', player, escort_component.refresh_times+1)
logger.debug("response %s" % response)
return response.SerializePartialToString()
示例15: hero_break_logic
def hero_break_logic(hero_no, player, response):
hero = player.hero_component.get_hero(hero_no)
hero_info = game_configs.hero_config.get(hero_no)
# 验证武将是否突破到上限
if hero.break_level == hero_info.breakLimit:
return {"result": False, "result_no": 201}
consume_info = hero_info.get('consume' + str(hero.break_level+1))
item_group = parse(consume_info)
hero_info = game_configs.hero_config.get(hero.hero_no)
# 判断是否足够
result = is_afford(player, item_group) # 校验
if not result.get('result'):
return {"result": False, "result_no": result.get('result_no')}
# 返回消耗
return_data = consume(player, item_group, const.HERO_BREAK)
get_return(player, return_data, response.consume)
hero.break_level += 1
notice_item = game_configs.notes_config.get(2003)
if hero.break_level in notice_item.parameter1:
push_notice(2003, player_name=player.base_info.base_name, hero_no=hero.hero_no, hero_break_level=hero.break_level)
hero.save_data()
# 3、返回
tlog_action.log('HeroBreak', player, hero_no, hero.break_level)
return {"result": True, "break_level": hero.break_level}