本文整理汇总了Python中core.achievement.Achievement.has_prizes方法的典型用法代码示例。如果您正苦于以下问题:Python Achievement.has_prizes方法的具体用法?Python Achievement.has_prizes怎么用?Python Achievement.has_prizes使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类core.achievement.Achievement
的用法示例。
在下文中一共展示了Achievement.has_prizes方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: get_attachment
# 需要导入模块: from core.achievement import Achievement [as 别名]
# 或者: from core.achievement.Achievement import has_prizes [as 别名]
def get_attachment(self, prize_id, param=0):
# prizie_id == 1 挂机不在这里
if prize_id == 4:
# 成就
from core.achievement import Achievement
ach = Achievement(self.char_id)
att_msg = ach.get_reward(param)
if ach.has_prizes():
prize_id = None
elif prize_id == 5:
# 任务
from core.task import Task
task = Task(self.char_id)
att_msg = task.get_reward(param)
if task.has_prizes():
prize_id = None
elif prize_id == 6:
# 官职每日登录
# from core.daily import OfficialDailyReward
# od = OfficialDailyReward(self.char_id)
# att_msg = od.get_reward()
att_msg = None
elif prize_id == 7:
# 团队本
att_msg = None
else:
try:
attachment = self.attachment.attachments[str(prize_id)]
except KeyError:
raise SanguoException(
errormsg.ATTACHMENT_NOT_EXIST, self.char_id, "Attachment Get", "{0} not exist".format(prize_id)
)
attachment = json.loads(attachment)
resource = Resource(self.char_id, "Prize {0}".format(prize_id))
standard_drop = resource.add(**attachment)
self.attachment.attachments.pop(str(prize_id))
self.attachment.save()
att_msg = standard_drop_to_attachment_protomsg(standard_drop)
# 删除此prize_id
if prize_id:
if prize_id in self.attachment.prize_ids:
self.attachment.prize_ids.remove(prize_id)
if str(prize_id) in self.attachment.attachments:
self.attachment.attachments.pop(str(prize_id))
self.attachment.save()
self.send_notify()
return att_msg