Skip to content

Commit

Permalink
Merge branch 'dev'
Browse files Browse the repository at this point in the history
  • Loading branch information
fffonion committed Oct 30, 2013
2 parents 39ec634 + b53a5ef commit f5a7677
Show file tree
Hide file tree
Showing 8 changed files with 88 additions and 19 deletions.
11 changes: 11 additions & 0 deletions build_cython.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
from distutils.core import setup
from distutils.extension import Extension
from Cython.Distutils import build_ext

setup(

cmdclass = {'build_ext': build_ext},

ext_modules = [Extension("maclient_smart", ["maclient_smart.py"])]

)
1 change: 1 addition & 0 deletions db/card.cn.txt
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@
119,玛纳南,1,10,原本是具有超强魔法之力的妖精之中,被称为『海神』『妖精王国之主』等等的最强级别的个体。\n\n据说是超级母体阿瓦隆的真正搭乘者,然而详细资料不明。\n现在的玛纳南与巨大的系统分离而独立存在。\n虽然基本不介入人类社会,然而会将知识与技术赋予自己所欣赏的人类,一直在进行培养英杰的工作。,冷澈的魔法之王,Error 3521acf,攻击力上升50%
120,复制型莉芙,5,11,在试验性研究如何创造次时代骑士的过程中,根据妖精莉菲的因子为原形而制造的复制品。\n\n将信息管制能力转化于更加重视直接战斗的能力,可以释放强大的魔法力量。极其强力然而失控的风险也很高,被当作可发射式的大规模炸弹使用。\n然而其完成度仍不算完美,无法使用『湖』中设施。,摧毁轮廓的光剑,Command ab3d811e,好友越多\n攻击力提升越大
122,露,3,9,原本是具有超强魔法之力的妖精之中,带有『军神』异名的军事妖精。\n\n比较喜欢长射程火力压制,单方面压制性质的战法。\n原本并非是为了宣扬武力,相反而是作为抑止武力的象征所设计,然而不列颠古战场中一些陨石坑一般的地形表明,有曾经被实际运用过的迹象。,正当防卫之剑,Error 924dda71,攻击力上升200%
123,蕾普菈荷,5,12,担任工厂自动生产的妖精。\n\n在『断绝时代』自主进行从长靴的自动生产到贩卖的一系列工作,并同时担任收入管理。随着『断绝时代』的崩坏,地面的工厂已经不复存在,然而地下的大型金库依然得以保存。将不知情而误入金库范围内现代人视为『破坏大型金库的盗贼』进行攻击。,远离珍宝的劳力,Error 11fa78b,第一轮攻击时\n攻击力上升100%
124,第二型毕斯克拉乌莉特,2,2,作为优秀的骑士所制造,然而由于被亲族所憎恶,被魔法化身为狼人的少女。\n\n相反,由于该魔法的力量,获得了凌驾于一般骑士之上的战斗能力。\n虽然因此可以重归骑士行列,然而她却因是否应该回归而感到烦恼。,Strong Hammer,压坏锤=装甲粉碎,攻击力上升50%
125,外敌型卢西乌斯,4,14,根据通过密探从外敌方的中心人物身上冒死获得的因子而制造出的复制品。\n\n并非用于提升战力,而是意欲探寻敌方真实身份而建立的制造计划,然而复制品并没有再现出真正卢西乌斯的秘密。,Hard Arc Sabel,光裂剑=钢铁两断,对手HP越高\n攻击力提升越大
126,第二型柏德玛戈斯,1,6,原本性能很高,却经常遭遇不幸的骑士。\n\n原本有计划针对目前为止的幸运与不幸进行系统分析,然而该计划的搁浅恐怕也是遇到的不幸之一。,Get over Lose,打击剑=败者复活,攻击力上升20%
Expand Down
52 changes: 51 additions & 1 deletion db/card.tw.txt

Large diffs are not rendered by default.

6 changes: 5 additions & 1 deletion db/item.tw.txt
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,8 @@
66,鐵罐空瓶,據說是某位少年與少女們喝完的飲料的罐子・・・
67,御茶園點數,御茶園x亞瑟王活動點數
68,七彩輝石,收集的話據說可以到不列顛的某個神祕商店兌換・・・
69,南瓜燈籠,收集到萬聖節的南瓜燈籠的話・・・
69,南瓜燈籠,收集到萬聖節的南瓜燈籠的話・・・
70,溫泉蛋,用溫泉煮出來的蛋・・・
71,兔耳髮飾,不論是男孩還是女孩都會喜歡的髮飾・・・
72,溫泉牛奶,泡完溫泉就是要暢快的喝一瓶牛奶・・・
73,溫泉集點章,集到的點數似乎可以拿來抽獎?
4 changes: 2 additions & 2 deletions db/revision.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
cn,203,203
tw,187,162
cn,204,203
tw,188,163
jp,0,0
17 changes: 10 additions & 7 deletions maclient.py
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,7 @@ def __init__(self,configfile='',savesession=False):
eval_fairy_select_carddeck)
self.evalstr_factor=self._eval_gen(self._read_config('condition','factor'),{})
#tasker须动态生成#self.evalstr_task=self._eval_gen(self._read_config('system','tasker'),{})
logging.debug(du8('system:知识库版本 %s'%maclient_smart.__version__))
logging.debug(du8('system:初始化完成(%s)'%self.loc))
self.lastposttime=0
self.lastfairytime=0
Expand Down Expand Up @@ -364,7 +365,7 @@ def tasker(self,taskname='',cmd=''):
else:
self.set_card(task[1])
elif task[0]=='auto_set' or task[0]=='as':
aim,fairy,maxline,testmode,delta,includes,bclimit='MAX_DMG',None,1,True,1,[],BC_LIMIT_CURRENT
aim,fairy,maxline,testmode,delta,includes,bclimit,fast_mode='MAX_DMG',None,1,True,1,[],BC_LIMIT_CURRENT,True
for arg in task[1:]:
if arg.startswith('aim:'):
aim=arg[4:]
Expand All @@ -390,6 +391,8 @@ def tasker(self,taskname='',cmd=''):
bclimit=int(_l)
elif arg.startswith('delta:'):
delta=float(arg[6:])
elif arg.startswith('nofast'):
fast_mode=False
elif arg.startswith('incl:'):
includes=map(lambda x:int(x),arg[5:].split(','))
elif arg!='':
Expand All @@ -398,7 +401,7 @@ def tasker(self,taskname='',cmd=''):
aim=getattr(maclient_smart,aim.upper())
except AttributeError:
logging.warning(du8('未识别的目标 %s'%aim))
self.invoke_autoset(aim=aim,fairy_info=fairy,maxline=maxline,testmode=testmode,delta=delta,includes=includes,bclimit=bclimit)
self.invoke_autoset(aim=aim,fairy_info=fairy,maxline=maxline,testmode=testmode,delta=delta,includes=includes,bclimit=bclimit,fast_mode=fast_mode)
elif task[0]=='explore' or task[0]=='e':
self.explore(' '.join(task[1:]))
elif task[0]=='factor_battle' or task[0]=='fcb':
Expand Down Expand Up @@ -554,8 +557,8 @@ def check_strict_bc(self,refresh=False):
return False

@plugin.func_hook
def invoke_autoset(self,aim=maclient_smart.MAX_CP,includes=[],maxline=2,seleval='card.lv>45',fairy_info=None,delta=1,testmode=True,bclimit=BC_LIMIT_CURRENT):
return self.set_card('auto_set',aim=aim,includes=includes,maxline=maxline,seleval=seleval,fairy_info=fairy_info,delta=delta,testmode=testmode,bclimit=bclimit)
def invoke_autoset(self,aim=maclient_smart.MAX_CP,includes=[],maxline=2,seleval='card.lv>45',fairy_info=None,delta=1,testmode=True,bclimit=BC_LIMIT_CURRENT,fast_mode=True):
return self.set_card('auto_set',aim=aim,includes=includes,maxline=maxline,seleval=seleval,fairy_info=fairy_info,delta=delta,testmode=testmode,bclimit=bclimit,fast_mode=fast_mode)

@plugin.func_hook
def set_card(self,deckkey,**kwargs):
Expand Down Expand Up @@ -904,7 +907,7 @@ def _explore_floor(self,area,floor=None):
def _boss_battle(self,area_id=None,floor_id=None):
if not (area_id and floor_id):
return False
self.invoke_autoset(aim=maclient_smart.MAX_CP,maxline=4,seleval='card.lv>45',testmode=False,bclimit=BC_LIMIT_MAX)
self.invoke_autoset(aim=maclient_smart.MAX_DMG,maxline=4,seleval='card.lv>45',testmode=False,bclimit=BC_LIMIT_MAX,fast_mode=True)
param="area_id=%s&floor_id=%s"%(area_id,floor_id)
resp,ct=self._dopost('exploration/battle',postdata=param)
if resp['error']:
Expand Down Expand Up @@ -1494,7 +1497,7 @@ def friends(self,choice='',autodel=False):
user.logintime=31
else :
user.logintime=0
if user.logintime>delfriend and user.logintime>maxlogintime:
if user.logintime>=delfriend and user.logintime>=maxlogintime:
deluser=user
maxlogintime=user.logintime
i+=1
Expand Down Expand Up @@ -1698,7 +1701,7 @@ def factor_battle(self,minbc=0,sel_lake=''):
if 'event_point' in cmp_parts:
logging.info(du8('BP:%s Rank:%s x%s %s left.'%(
cmp_parts.event_point,cmp_parts.event_rank,cmp_parts.event_bonus_rate,
time.strftime('%M\'%S"',time.localtime(int(cmp_parts.event_bonus_end_time)/1000-time.time())))))
time.strftime('%M\'%S"',time.localtime(int(cmp_parts.event_bonus_end_time)/1000-time.time())) if cmp_parts.event_bonus_end_time!='0' else '0')))
random.shuffle(lakes)
if sel_lake==['']:
l=lakes[0]
Expand Down
7 changes: 3 additions & 4 deletions maclient_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,8 +111,7 @@ def macs(uri,header={},body='',method='GET'):
reload(sys)
sys.setdefaultencoding('utf-8')
#ht=httplib2.Http(timeout=30)
intro='v%s%s'%(__version__,os.name=='nt' and ' by fffonion' or '')
print(du8('%s%s%s%s'%('='*((getTerminalSize()[0]-len(intro)-18)/2),'丧心病狂的MA客户端',intro,'='*((getTerminalSize()[0]-len(intro)-18)/2))))
print(du8('%s%sv%s%s'%('='*((getTerminalSize()[0]-5-18)/2),'丧心病狂的MA客户端',__version__,'='*((getTerminalSize()[0]-5-18)/2))))
if len(sys.argv)>2:
maclient1=maclient.maClient(configfile=sys.argv[1],savesession=True)
#auth()
Expand Down Expand Up @@ -145,7 +144,7 @@ def macs(uri,header={},body='',method='GET'):
try:
maclient1.tasker()
except KeyboardInterrupt:
os._exit(1)
continue
elif ch=='h':
print(du8('登陆 login/l,设置卡组 set_card/sc,因子战 factor_battle/fcb,秘境探索 explore/e,'
'刷列表中的妖精 fairy_battle/fyb,嗑药 red_tea/rt,嗑药 green_tea/gt,自动卖卡 sell_card/slc,'
Expand Down Expand Up @@ -290,7 +289,7 @@ def macs(uri,header={},body='',method='GET'):
else:
maclient1.tasker(cmd=ch)
except KeyboardInterrupt:
maclient1._exit(0)
continue
else:
maclient.logging.error(du8('嗯-v-?'))
print(' %s %s'%('-'*(getTerminalSize()[0]-2),'\n'))
9 changes: 5 additions & 4 deletions maclient_smart.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import time
import math
import itertools
__version__='1.0-build20131030'
#server specified configutaions
max_card_count_cn=max_card_count_kr=200
max_card_count_tw=max_card_count_jp=250
Expand All @@ -20,8 +21,8 @@
app_ver_kr=100
app_ver_jp=236
#wake
name_wake_rare=['禁書目錄']
name_wake=name_wake_rare+['觉醒','覺醒','雷蒂麗']
name_wake_rare=['逆迴十六夜']
name_wake=name_wake_rare+['觉醒','覺醒','妖刀']
#snda gplus, not working
class snda_gplus():
#thanks to luw2007(https://github.com/luw2007/libMA/blob/master/push.py)
Expand Down Expand Up @@ -194,7 +195,7 @@ def carddeck_gen(player_cards,aim=DEFEAT,bclimit=999,includes=[],maxline=2,selev
return_lambda=lambda x:(-x[3],x[0])
elif aim==MAX_DMG or aim==MAX_CP:
if aim==MAX_DMG:
deckcnts=[i*3 for i in range(maxline,0,-1)]
deckcnts=[i*3 for i in range(maxline,0,-1)]+[1,2]
return_lambda=lambda x:(sum(x[0])*x[1])
_cards=sorted(_cards,key=lambda x:x[ATK]*x[HP],reverse=True)#[:min(3*maxline+3,len(_cards))]
#_cards=sorted(_cards,key=lambda x:x[ATK]*x[HP]/player_cards.db[x[MID]][2],reverse=True)[:len(_cards)/2]
Expand All @@ -203,7 +204,7 @@ def carddeck_gen(player_cards,aim=DEFEAT,bclimit=999,includes=[],maxline=2,selev
return_lambda=lambda x:(1.0*(x[1]*sum(x[0]))/x[2])
_cards=sorted(_cards,key=lambda x:x[ATK]*x[HP]/player_cards.db[x[MID]][2],reverse=True)#[:min(3*maxline+3,len(_cards))]
if fast_mode:
_cards=_cards[:min(3*maxline*2,len(_cards))]
_cards=_cards[:min(3*maxline+6,len(_cards))]
for deckcnt in deckcnts:
for deck in _iter_gen(deckcnt):
mids=map(lambda d: d[MID],deck)
Expand Down

0 comments on commit f5a7677

Please sign in to comment.