def getMainAccountCardInfo(self): card_info = self.database.getCardFromTheme( self.themeIdList[self.commit_index]) magic_info = commons.getMagicInfo(self.myHttpRequest, constant.USERNAME) exchangBox = commons.get_type_info(constant.EXCHANGEBOX, magic_info) storeBox = commons.get_type_info(constant.STOREBOX, magic_info) account_exchangBox_list = [] account_storeBox_list = [] for key, value in accountManage.AccountManage.account_http_dic.items(): magic_info = commons.getMagicInfo(value, key) account_exchangBox_list.append( commons.get_type_info(constant.EXCHANGEBOX, magic_info)) account_storeBox_list.append( commons.get_type_info(constant.STOREBOX, magic_info)) for card_item in card_info: card_id = card_item[0] card_count = 0 for account_exchangBox in account_exchangBox_list: card_count += account_exchangBox.count(card_id) for account_storeBox in account_storeBox_list: card_count += account_storeBox.count(card_id) self.sloveBoxList.Append([ '', card_item[1], card_item[2], str(exchangBox.count(card_id) + storeBox.count(card_id)), str(card_count) ])
def run(self): user_card_info = commons.getMagicInfo(self.myHttpRequest,constant.USERNAME) self.user_exchange_box = commons.get_type_info(constant.EXCHANGEBOX,user_card_info) card_exchange_dic = {} for i,card_id in enumerate(self.user_exchange_box): if self.thread_stop: break if int(card_id) != 0 : card_info = self.window.database.getCardInfo2(card_id) if self.cardPrice != u'全部': if card_info[2] != self.cardtheme and card_info[1] == self.cardPrice: card_exchange_dic[i] = card_id else: continue elif card_info[2] != self.cardtheme: card_exchange_dic[i] = card_id else: continue print card_exchange_dic # card_info = commons.getMagicInfo2(self.myHttpRequest,constant.USERNAME) # exchange_box = commons.get_type_info(constant.EXCHANGEBOX,card_info) # store_box = commons.get_type_info(constant.STOREBOX,card_info) wx.CallAfter(self.window.updateLog,u'换卡完成') pass
def getSubAccountCard(self): self.has_card_account_dic = {} self.windows.exchang_card_dic = {} self.exchang_card_info_dic = {} magic_info = commons.getMagicInfo(main.RefinedCard.main_http_request,constant.USERNAME) exchangBox = commons.get_type_info(constant.EXCHANGEBOX,magic_info) storeBox = commons.get_type_info(constant.STOREBOX,magic_info) select_card_info = self.windows.database.getCardInfo(self.selectCardId) print select_card_info count = 1 for i,card_id in enumerate(exchangBox): if card_id == 0: continue card_info = self.windows.database.getCardInfo(card_id) if card_info[2] == select_card_info[2]: self.windows.exchang_card_dic[count] = u'使用'+card_info[0]+u'交换' self.windows.exchang_card_info_dic[count] = [0,i,card_id] count += 1 for i,card_id in enumerate(storeBox): if card_id == 0: continue card_info = self.windows.database.getCardInfo(card_id) if card_info[2] == select_card_info[2]: self.windows.exchang_card_dic[count] = u'使用'+card_info[0]+u'交换' self.windows.exchang_card_info_dic[count] = [1,i,card_id] count += 1 self.windows.sloveBoxList2.DeleteAllItems() for key,value in accountManage.AccountManage.account_http_dic.items(): if str(key) == str(constant.USERNAME) : continue magic_info = commons.getMagicInfo(value,key) print 'key',key account_exchangBox = commons.get_type_info(constant.EXCHANGEBOX,magic_info) account_storeBox = commons.get_type_info(constant.STOREBOX,magic_info) if int(self.selectCardId) in account_exchangBox or int(self.selectCardId) in account_storeBox: self.has_card_account_dic[key] = value self.windows.sloveBoxList2.Append([str(key)])
def getMainAccountCardInfo(self): card_info = self.database.getCardFromTheme(self.themeIdList[self.commit_index]) magic_info = commons.getMagicInfo(self.myHttpRequest,constant.USERNAME) exchangBox = commons.get_type_info(constant.EXCHANGEBOX,magic_info) storeBox = commons.get_type_info(constant.STOREBOX,magic_info) account_exchangBox_list = [] account_storeBox_list = [] for key,value in accountManage.AccountManage.account_http_dic.items(): magic_info = commons.getMagicInfo(value,key) account_exchangBox_list.append(commons.get_type_info(constant.EXCHANGEBOX,magic_info)) account_storeBox_list.append(commons.get_type_info(constant.STOREBOX,magic_info)) for card_item in card_info: card_id = card_item[0] card_count = 0 for account_exchangBox in account_exchangBox_list: card_count+=account_exchangBox.count(card_id) for account_storeBox in account_storeBox_list: card_count+=account_storeBox.count(card_id) self.sloveBoxList.Append(['',card_item[1],card_item[2],str(exchangBox.count(card_id)+storeBox.count(card_id)),str(card_count)])
def getMainAccountCardInfo(self): card_info = self.database.getCardFromTheme(self.themeIdList[self.commit_index]) magic_info = commons.getMagicInfo(main.RefinedCard.main_http_request,constant.USERNAME) exchangBox = commons.get_type_info(constant.EXCHANGEBOX,magic_info) storeBox = commons.get_type_info(constant.STOREBOX,magic_info) # account_exchangBox_list = [] # account_storeBox_list = [] # for key,value in accountManage.AccountManage.account_http_dic.items(): # magic_info = commons.getMagicInfo(value,key) # account_exchangBox_list.append(commons.get_type_info(constant.EXCHANGEBOX,magic_info)) # account_storeBox_list.append(commons.get_type_info(constant.STOREBOX,magic_info)) for i,card_item in enumerate(card_info): card_id = card_item[0] self.cardIdDict[i] = card_id #card_count = 0 # for account_exchangBox in account_exchangBox_list: # card_count+=account_exchangBox.count(card_id) # for account_storeBox in account_storeBox_list: # card_count+=account_storeBox.count(card_id) self.sloveBoxList.Append([str(i),card_item[1],card_item[2],str(exchangBox.count(card_id)+storeBox.count(card_id))])
def exchange_card(self,card_exchange_dic): ''' 卡片交换 :param position: :param card_id: :param card_price: :param account: :param type: :return: ''' for key,value in card_exchange_dic.item(): for account,httpRequest in accountManage.AccountManage.account_http_dic.items(): account = account.replace("\n","") if int(account) == int(constant.USERNAME): continue if self.thread_stop: break if account.strip() != '': user_card_info = commons.getMagicInfo(value,key) exchange_box = commons.get_type_info(constant.EXCHANGEBOX,user_card_info) store_box = commons.get_type_info(constant.STOREBOX,user_card_info) for i,card_id in enumerate(exchange_box): if int(card_id) != 0: card_info = self.window.database.getCardInfo2(card_id) if card_info[2] == self.cardtheme and card_info[1] == self.cardPrice: src_card_name = card_info[0] src_card_id = card_id src_type = 0 src_position = i break
def run(self): user_card_info = commons.getMagicInfo(self.myHttpRequest, constant.USERNAME) self.user_exchange_box = commons.get_type_info(constant.EXCHANGEBOX, user_card_info) self.user_store_box = commons.get_type_info(constant.STOREBOX, user_card_info) card_friend_file = open("card_friend.txt", "r") accounts = card_friend_file.readlines() for account in accounts: account = account.replace("\n", "") if self.thread_stop: break if account.strip() != "": card_info = commons.getMagicInfo2(self.myHttpRequest, account) exchange_box = commons.get_type_info(constant.EXCHANGEBOX, card_info) for i, card_id in enumerate(exchange_box): if self.thread_stop: break if int(card_id) != 0: card_info = self.window.database.getCardInfo2(card_id) if self.cardPrice != u"全部": if ( card_info[2] == self.cardtheme and card_info[1] == int(self.cardPrice) and (self.cardDetail == -1 or card_info[2] == self.cardDetail) ): if -1 == self.exchange_card(i, card_id, card_info[1], card_info[0], account, 0): wx.CallAfter(self.window.updateLog, u"未找到对应面值的卡交换") return pass else: continue else: if -1 == self.exchange_card(i, card_id, card_info[1], card_info[0], account, 0): wx.CallAfter(self.window.updateLog, u"未找到对应面值的卡交换") return wx.CallAfter(self.window.updateLog, u"换卡完成") pass
def accountGetMana(self,): ''' 小号420魔力 :param account: :param myhttpRequest: :return: ''' for account in self.account_list: try: myhttpRequest = self.__class__.account_http_dic[account] except KeyError: continue if '-1005' in commons.getMagicInfo(myhttpRequest,account): logging.info(u'用户未开通魔卡,开通魔卡') commons.registerMagic(myhttpRequest) commons.getMagicInfo(myhttpRequest,account) commons.magicCardGuide(myhttpRequest,account,102,0) commons.completeMission(myhttpRequest,102) commons.magicCardGuide(myhttpRequest,account,103,0) commons.magicCardGuide(myhttpRequest,account,103,0) commons.cardExchange(myhttpRequest,account,2,0,1) commons.sellCard(myhttpRequest,account,0,2373,0) for i in range(2,20): commons.buyCard(myhttpRequest,688,85) commons.cardExchange(myhttpRequest,account,0,i,0) for i in range(0,5): commons.buyCard(myhttpRequest,688,85) commons.drawCard(myhttpRequest,2,5) if 'lgiftmana="100"'in commons.completeMission(myhttpRequest,103): wx.CallAfter(self.operateLogUpdate,account+u'step1,100魔力') else: wx.CallAfter(self.operateLogUpdate,account+u'step1,100魔力失败') commons.magicCardGuide(myhttpRequest,account,104,0) commons.magicCardGuide(myhttpRequest,account,104,0) commons.completeMission(myhttpRequest,104) commons.magicCardGuide(myhttpRequest,account,105,0) commons.magicCardGuide(myhttpRequest,account,105,0) if 'lgiftmana="100"'in commons.completeMission(myhttpRequest,105): wx.CallAfter(self.operateLogUpdate,account+u'step2,100魔力') else: wx.CallAfter(self.operateLogUpdate,account+u'step2,100魔力失败') commons.magicCardGuide(myhttpRequest,account,105,3) commons.magicCardGuide(myhttpRequest,account,106,0) commons.magicCardGuide(myhttpRequest,account,106,0) if 'lgiftmana="100"'in commons.completeMission(myhttpRequest,106): wx.CallAfter(self.operateLogUpdate,account+u'step3,100魔力') else: wx.CallAfter(self.operateLogUpdate,account+u'step3,100魔力失败') commons.magicCardGuide(myhttpRequest,account,106,5) commons.completeMission(myhttpRequest,107,40) wx.CallAfter(self.operateLogUpdate,account+u'step4,120魔力') else: wx.CallAfter(self.operateLogUpdate,account+u'用户已开通魔卡') wx.CallAfter(self.operateLogUpdate,u'一键任务完成')
def account_commission(self): ''' 国庆任务提交 :return: ''' for key in self.account_list: try: value = self.__class__.account_http_dic[key] except KeyError: continue try: levelup = commons.getUrl(constant.LEVELUP,value) post_data = { 'uin':key } value.get_response(levelup,post_data).read().decode('utf-8') mobileHttp = myhttp.MyHttpRequest() base_url = commons.getUrl(constant.GQACTIVITY,value) post_data={ 'act':1, } value.get_response(base_url,post_data).read().decode('utf-8') post_data={ 'act':2, } logging.info(value.get_response(base_url,post_data).read().decode('utf-8')) wx.CallAfter(self.operateLogUpdate,str(key)+u'接受国庆任务') post_data = { 'act':3, 'id':13, } page_content = value.get_response(base_url,post_data).read().decode('utf-8') if u'没有完成' in page_content or u'系统繁忙' in page_content : wx.CallAfter(self.operateLogUpdate,str(key)+u'完成每日登陆游戏失败') else: wx.CallAfter(self.operateLogUpdate,str(key)+u'每日登陆任务已完成') wx.CallAfter(self.operateLogUpdate,str(key)+u'检查卡炉是否有可收的卡') mobile_url = constant.MOBILEMAINPAGE mobile_url = mobile_url.replace('SID',urllib.quote(self.accout_sid_dic[key])) page_content = mobileHttp.get_response(mobile_url).read().decode('utf-8') cardcomplete = commons.getStoveBoxInfo(commons.getMagicInfo(value,key)) if u'取卡' in page_content and 1 in cardcomplete: wx.CallAfter(self.operateLogUpdate,str(key)+u'有卡可以收获') mobile_url = constant.MOBILEREFINEDCARD mobile_url.replace('SID',self.accout_sid_dic[key]) position = cardcomplete.index(1) mobile_refined_url = constant.MOBILEREFINEDCARD.replace('SID',urllib.quote(self.accout_sid_dic[key])) mobile_refined_url +=str(position) print mobile_refined_url wx.CallAfter(self.operateLogUpdate,str(key)+u'收获卡片') mobileHttp.get_response(mobile_refined_url).read().decode('utf-8') wx.CallAfter(self.operateLogUpdate,str(key)+u'提交任务收获卡片任务') post_data = { 'act':3, 'id':2, } page_content = value.get_response(base_url,post_data).read().decode('utf-8') print page_content if u'没有完成' in page_content or u'系统繁忙' in page_content : wx.CallAfter(self.operateLogUpdate,str(key)+u'取卡任务失败') else: wx.CallAfter(self.operateLogUpdate,str(key)+u'取卡任务已完成') wx.CallAfter(self.operateLogUpdate,str(key)+u'进行翻牌') commons.fanpai(value) post_data = { 'act':3, 'id':3, } page_content = value.get_response(base_url,post_data).read().decode('utf-8') if u'没有完成' in page_content or u'系统繁忙' in page_content : wx.CallAfter(self.operateLogUpdate,str(key)+u'翻牌任务失败') else: wx.CallAfter(self.operateLogUpdate,str(key)+u'翻牌任务已完成') else: wx.CallAfter(self.operateLogUpdate,str(key)+u'没有可收获的先进行炼卡,请一小时后重新进行任务') mobile_card_url = constant.MOBILELIANCARD.replace('SID',urllib.quote(self.accout_sid_dic[key])) mobileHttp.get_response(mobile_card_url).read() except: wx.CallAfter(self.operateLogUpdate,str(key)+u'做任务出现异常') wx.CallAfter(self.operateLogUpdate,u'一键任务完成')