From 90986fd5a313687471fa0465eaaf11722f8534e8 Mon Sep 17 00:00:00 2001 From: fffonion Date: Sat, 11 Jan 2014 18:30:45 +0800 Subject: [PATCH] bugfix --- maclient.py | 6 +++--- plugins/infinite_guild_fairy.py | 20 +++++++++++++++----- 2 files changed, 18 insertions(+), 8 deletions(-) diff --git a/maclient.py b/maclient.py index 7b44122..d203cfb 100644 --- a/maclient.py +++ b/maclient.py @@ -211,7 +211,7 @@ def _dopost(self, urikey, postdata = '', usecookie = True, setcookie = True, ext if self.cfg_delay == 0: logging.warning('post:NO DELAY!') else: - logging.debug('post:slow down...') + #logging.debug('post:slow down...') time.sleep(random.randint(int(0.75 * self.cfg_delay), int(1.25 * self.cfg_delay))) resp, _dec = self.poster.post(urikey, postdata, usecookie, setcookie, extraheader, noencrypt, savetraffic, no2ndkey) self.lastposttime = time.time() @@ -1285,10 +1285,10 @@ def fairy_floor(f = fairy): # if fairy.race_type == '12':#找不到 # disc_name = '公会妖精' hms = lambda x:x >= 3600 and time.strftime('%H:%M:%S', time.localtime(x + 16 * 3600)) or time.strftime('%M:%S', time.localtime(x)) - logging.info('妖精:%sLv%d hp:%d 发现者:%s 小伙伴:%d 剩余%s %s%s' % ( + logging.info('妖精:%sLv%d hp:%d 发现者:%s 小伙伴:%d 剩余%s%s%s' % ( fairy.name, fairy.lv, fairy.hp, disc_name, len(f_attackers), hms(fairy.time_limit), - fairy.race_type == '12' and '公会' or '', + fairy.race_type == '12' and ' 公会' or '', fairy.wake and ' WAKE!' or '')) if carddeck: cardd = carddeck diff --git a/plugins/infinite_guild_fairy.py b/plugins/infinite_guild_fairy.py index 0811e30..a27a05a 100644 --- a/plugins/infinite_guild_fairy.py +++ b/plugins/infinite_guild_fairy.py @@ -5,7 +5,7 @@ # start meta __plugin_name__ = '狼娘无限舔公会妖' __author = 'fffonion' -__version__ = 0.2 +__version__ = 0.3 __tip__ = '插件已开启,如需关闭请移除plugins下的infinite_guild_fairy' hooks = {'EXIT__fairy_battle':10} # extra cmd hook @@ -15,6 +15,7 @@ class plugin(plugin_prototype): def __init__(self): self.__name__ = __plugin_name__ self.mac_instance = None + self._ori_logfile = '' def fairy_floor(self,fairy): paramfl = 'check=1&race_type=%s&serial_id=%s&user_id=%s' % ( @@ -27,18 +28,27 @@ def fairy_floor(self,fairy): def EXIT__fairy_battle(self, *args, **kwargs): self.logger = args[0].logger + if not self._ori_logfile:#不记录 + self._ori_logfile = self.logger.logfile + self.logger.setlogfile('.IGF.log') fairy=args[1] if fairy.race_type == '12' and fairy.time_limit != '0': - print(du8("工会妖精!")) + print(du8("公会妖精!")) self.mac_instance = args[0] self.mac_instance.lastfairytime=0 if self.mac_instance.player.bc['current']>=2: time.sleep(5) fairy=self.fairy_floor(fairy) - if fairy.hp == '0': + if fairy.hp == '0' or fairy.time_limit == '0': + #rollback + self.logger.setlogfile(self._ori_logfile) + self._ori_logfile = '' return self.mac_instance._fairy_battle(fairy, kwargs) else: - print(du8("BC<2,两分钟后再战ww")) - time.sleep(120) + if not self.mac_instance.red_tea(silent = True): + print(du8("BC<2,两分钟后再战ww")) + time.sleep(120) + self.mac_instance._fairy_battle(fairy, kwargs) +