Permalink
Browse files

Don't !enter multiple times.

  • Loading branch information...
1 parent 5046cb5 commit f6c3bbfbf1da1a490628eb5b9470801918706425 @FiXato committed May 10, 2013
Showing with 7 additions and 2 deletions.
  1. +7 −2 battlearena.py
View
@@ -57,6 +57,7 @@
attack_tech_hook2 = None
attack_out_of_tp_hook = None
battle_has_ended_hook = None
+in_battle = False
def arena_buffer():
channel_name = OPTIONS['channel']
@@ -362,7 +363,10 @@ def cb_completion_available_techs(data, completion_item, buffer, completion):
#==========================Other callbacks
def cb_enter_portal(data, buffer, date, tags, displayed, highlight, prefix, message):
- weechat.hook_timer((choice([2,3,4])) * 1000, 0, 1, "cb_battlecommand", "!enter")
+ global in_battle
+ if not in_battle:
+ in_battle = True
+ weechat.hook_timer((choice([2,3,4])) * 1000, 0, 1, "cb_battlecommand", "!enter")
return weechat.WEECHAT_RC_OK
def cb_attack_tech_hook(data, buffer, date, tags, displayed, highlight, prefix, message):
@@ -384,8 +388,9 @@ def cb_attack_out_of_tp_hook(data, buffer, date, tags, displayed, highlight, pre
return weechat.WEECHAT_RC_OK
def cb_battle_has_ended_hook(data, buffer, date, tags, displayed, highlight, prefix, message):
- global tp_delay
+ global tp_delay, in_battle
tp_delay = 0
+ in_battle = False
return weechat.WEECHAT_RC_OK
def select_enemy():

0 comments on commit f6c3bbf

Please sign in to comment.