Skip to content

Commit

Permalink
Update battle.py
Browse files Browse the repository at this point in the history
  • Loading branch information
JhMaic authored May 31, 2020
1 parent 40ee0b5 commit b2052b6
Showing 1 changed file with 25 additions and 21 deletions.
46 changes: 25 additions & 21 deletions src/client/ybplugins/clan_battle/battle.py
Original file line number Diff line number Diff line change
Expand Up @@ -902,30 +902,34 @@ def apply_for_challenge(self,
if group.boss_lock_type != 1:
msg += '\n留言:'+group.challenging_comment
raise GroupError(msg)

# (新增)必须先预约才能申请挑战
rank = Clan_subscribe.select(Clan_subscribe.sid).where(Clan_subscribe.gid == group_id,
Clan_subscribe.qqid == qqid,
Clan_subscribe.subscribe_item == group.boss_num)
if not rank.exists():



##### (新增)必须先预约才能申请挑战 #####################################################
rev_group = Clan_subscribe.select().where(Clan_subscribe.gid == group_id,
Clan_subscribe.subscribe_item == group.boss_num
).order_by(Clan_subscribe.sid)
is_rev = rev_group.select().where(Clan_subscribe.qqid==qqid)
if not is_rev.exists():
msg = '你必须先预约才能申请出刀'
raise GroupError(msg)

# (新增)必须等排自己前面的人打完了才能申请
if rank != 1:
notice = []
# 提醒 前面的人
for subscribe in Clan_subscribe.select().where(
Clan_subscribe.gid == group_id,
Clan_subscribe.sid < rank,
Clan_subscribe.subscribe_item == group.boss_num,
).order_by(Clan_subscribe.sid):
msg = atqq(subscribe.qqid)
notice.append(msg)
warning = '你前面还有{}个人,请等待\n'.format(rank-1)
atlist = '\n'.join(notice)
message = warning + atlist +'\n出完刀后再申请'
raise GroupError(message)
# ####### (新增)必须等排自己前面的人打完了才能申请 #############################
count = 0
notice = []
for rev_er in rev_group:
if rev_er.qqid != qqid:
count += 1
notice.append(atqq(rev_er.qqid))
else:
if count != 0:
warning = '你前面还有{}个人,请等待\n'.format(count)
atlist = '\n'.join(notice)
message = warning + atlist +'\n出完刀后再申请'
raise GroupError(message)
else:
break
###############################################################################


group.challenging_member_qq_id = qqid
Expand Down

1 comment on commit b2052b6

@JhMaic
Copy link
Collaborator Author

@JhMaic JhMaic commented on b2052b6 May 31, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

更新了 3个机制

  1. boss死了,清除该boss的预约(原来为新出现boss的预约)
  2. 申请出刀前必须预约该boss
  3. 申请出刀前必须等排自己前面的取消预约

Please sign in to comment.