def send_char_query_to_thread(self): self.char_find_btn.setEnabled(False) self.charSearchTag = len(self.charHistory) url = 'http://census.daybreakgames.com/s:fyang/get/eq2/character?' cmd = '' if self.char_name_input.text() is not '': cmd += 'name.first_lower=^{}'.format( self.char_name_input.text().lower().strip()) if self.char_world_combox.currentText() is not '': cmd += '&locationdata.world={}'.format( self.char_world_combox.currentText()) if self.char_class_min_line.text() is not '': cmd += '&type.level=]{}'.format(self.char_class_min_line.text()) if self.char_class_max_line.text() is not '': cmd += '&type.level=[{}'.format(self.char_class_max_line.text()) if self.char_class_combox.currentText() is not '': cmd += '&type.class={}'.format( self.char_class_combox.currentText()) if self.char_trade_class_min_line.text() is not '': cmd += '&type.ts_level=]{}'.format( self.char_trade_class_min_line.text()) if self.char_trade_class_max_line.text() is not '': cmd += '&type.ts_level=[{}'.format( self.char_trade_class_max_line.text()) if self.char_trade_class_combox.currentText() is not '': cmd += '&type.ts_class={}'.format( self.char_trade_class_combox.currentText().lower()) cmd += '&c:show=displayname,type.class,type.level,type.ts_class,type.ts_level,guild.name,guild.id&c:limit=1000' self.qy = eq2s_quary.Queries(url + cmd, 'char') self.qy.rst_sent_chars_to_main.connect(self.char_result_received) self.qy.start()
def sendGuildQueryToThread(self): self.refreshBtn.setEnabled(False) url = 'http://census.daybreakgames.com/s:fyang/get/eq2/guild' query1 = '?id={}'.format(self.id) query2 = '&c:resolve=members(name,type,guild)' self.qy = eq2s_quary.Queries(url + query1 + query2, 'guild_detail') self.qy.rst_sent_guild_detail.connect(self.whenGuildInfoReceived) self.qy.start()
def whenAchieveBtnClicked(self): self.achieveBtn.setEnabled(False) query = 'http://census.daybreakgames.com/s:fyang/get/eq2/character?id=' query += str(self.charDitail['id']) query += '&c:resolve=achievements&c:show=achievements' self.qy = eq2s_quary.Queries(query, 'char_detail') self.qy.rst_sent_chars_detail.connect(self.achievementReceived) self.qy.start()
def sendCharQueryToThread(self): self.refreshBtn.setEnabled(False) url = 'http://census.daybreakgames.com/s:fyang/get/eq2/character' query1 = '?id={}'.format(self.id) query2 = '&c:resolve=equipmentslots' self.qy = eq2s_quary.Queries(url + query1 + query2, 'char_detail') self.qy.rst_sent_chars_detail.connect(self.whenCharInfoReceived) self.qy.start()
def send_contains_query_to_thread(self): self.contains_btn.setEnabled(False) item_list = [ x['id'] for x in self.item_detail['typeinfo']['item_list'] ] url = 'http://census.daybreakgames.com/s:fyang/get/eq2/item' query = '?id={}'.format(','.join([str(x) for x in item_list])) self.qy = eq2s_quary.Queries(url + query, 'contains') self.qy.rst_sent_sets_info.connect(self.contains_sub_windows_build) self.qy.start()
def send_sets_query_to_thread(self): self.sets_btn.setEnabled(False) sets_name = self.item_detail['setbonus_info']['displayname'] url = 'http://census.daybreakgames.com/s:fyang/get/eq2/item' query = \ '?setbonus_info.displayname={}&c:limit=20&c:show=displayname,leveltouse,iconid,tier,type,setbonus_info,slot_list'\ .format(sets_name) self.qy = eq2s_quary.Queries(url + query, 'sets') self.qy.rst_sent_sets_info.connect(self.sets_sub_windows_build) self.qy.start()
def adornCollect(self, eqpLst): # I need a list those keys contain all of this character's adornments and slot id information aid = {} for eachitem in eqpLst: if 'item' in eachitem.keys( ) and 'adornment_list' in eachitem['item'].keys(): for eachadorn in eachitem['item']['adornment_list']: if 'id' in eachadorn.keys(): # first one is adornment's id which the index is 0 # second one is the id that adorn attached to which the index is 1 self.adornIDList.append( [eachadorn['id'], eachitem['id']]) aid[eachadorn['id']] = 1 if len(aid): query = 'http://census.daybreakgames.com/s:fyang/get/eq2/item?id=' for each in aid.keys(): query += '{},'.format(each) query = query[:-1] + '&c:show=displayname,modifiers,effect_list' self.qy = eq2s_quary.Queries(query, 'item_detail') self.qy.rst_sent_items_detail.connect(self.adornInfoReceived) self.qy.start()
def send_disco_query_to_thread(self): self.dico_btn.setEnabled(False) try: disco_list = self.item_detail['_extended']['discovered'][ 'world_list'] query = 'http://census.daybreakgames.com/s:fyang/get/eq2/character?id=' for each in disco_list: query += '{},'.format(each['charid']) self.item_detail_disco_info.append([ each['charid'], eq2s_func.worldid2name(each['id']), datetime.fromtimestamp( each['timestamp']).isoformat().replace('T', ' ') ]) query = query[:-1] + '&c:show=name.first' self.qy = eq2s_quary.Queries(query, 'disco') self.qy.rst_sent_disco_info.connect(self.build_disco_info) self.qy.start() except KeyError as err: QMessageBox().warning(self, 'None', 'No one discovered.\n{}'.format(err))
def whenCollectionReceived(self, returned): try: col_brief = returned['character_misc_list'][0]['collection_list'] except KeyError: QMessageBox().critical( self, 'Loading Error', 'Time out or this character did not discover any collection.' '\nTry again.') return self.actived_tree = {} for each in col_brief: self.actived_tree[each['crc']] = each['item_list'] try: for ea in each['item_list']: self.foundList.append(ea['crc']) except KeyError: continue trees_id = tuple(self.actived_tree.keys()) q = 'http://census.daybreakgames.com/s:fyang/get/eq2/collection?id=' qstart = 0 qend = 100 self.qcount = 0 self.received = 0 sliced_tree = trees_id[qstart:qend] while len(sliced_tree): ids = '' for each in sliced_tree: ids += '{},'.format(each) qy = eq2s_quary.Queries(q + ids[:-1], 'collection', self) qy.rst_sent_items_detail.connect(self.whenCollectionTreesReceived) qy.setTerminationEnabled(True) qy.start() qstart += 100 qend += 100 sliced_tree = trees_id[qstart:qend] self.qcount += 1
def send_guild_query_to_thread(self): self.guild_find_btn.setEnabled(False) self.guildSearchdTag = len(self.guildHistory) url = 'http://census.daybreakgames.com/s:fyang/get/eq2/guild?' cmd = '' if self.guild_name_input.text() is not '': cmd += 'name_lower=^{}'.format( self.guild_name_input.text().lower()) if self.guild_world_combox.currentText() is not '': cmd += '&world={}'.format(self.guild_world_combox.currentText()) if self.guild_level_min_line.text() is not '': cmd += '&level=]{}'.format(self.guild_level_min_line.text()) if self.guild_level_max_line.text() is not '': cmd += '&level=[{}'.format(self.guild_level_max_line.text()) if self.guild_account_min_line.text() is not '': cmd += '&accounts=]{}'.format(self.guild_account_min_line.text()) if self.guild_account_max_line.text() is not '': cmd += '&level=[{}'.format(self.guild_account_max_line.text()) cmd += '&c:show=name,world,level,accounts&c:limit=1000' self.qy = eq2s_quary.Queries(url + cmd, 'guild') self.qy.rst_sent_guild_to_main.connect(self.guild_result_received) self.qy.start()
def send_query(self, char_id): q = 'http://census.daybreakgames.com/s:fyang/get/eq2/character_misc?id={}&c:show=collection_list'\ .format(char_id) self.qy = eq2s_quary.Queries(q, 'collection') self.qy.rst_sent_items_detail.connect(self.whenCollectionReceived) self.qy.start()
def sendItemQueryToThread(self): query = 'http://census.daybreakgames.com/s:fyang/get/eq2/item?id={}'.format( self.itemid) self.qy = eq2s_quary.Queries(query, 'item_detail') self.qy.rst_sent_items_detail.connect(self.cook_detail) self.qy.start()
def send_item_query_to_thread(self): self.item_find_btn.setEnabled(False) self.itemSearchTag = len(self.itemHistory) url = 'http://census.daybreakgames.com/s:fyang/get/eq2/item?' # logic for making query cmd = '' if self.item_name_input.text() is not '': cmd += 'displayname_lower=*{}'.format( self.item_name_input.text().lower().strip()) if self.statusLine.text() is not '': cmd += self.cook_status_query() if self.item_level_require_line_min.text() is not '': cmd += '&leveltouse=]{}'.format( self.item_level_require_line_min.text()) if self.item_level_require_line_max.text() is not '': cmd += '&leveltouse=[{}'.format( self.item_level_require_line_max.text()) if self.item_level_min_line.text() is not '': cmd += '&itemlevel=]{}'.format(self.item_level_min_line.text()) if self.item_level_max_line.text() is not '': cmd += '&itemlevel=[{}'.format(self.item_level_min_line.text()) if self.item_tier_combox.currentText() is not '': cmd += '&tier={}'.format(self.item_tier_combox.currentText()) if self.item_type_combox.currentText() is not '': t = self.item_type_combox.currentText().lower().split(' ')[-1] if t == '*': cmd += '&type=Item' else: cmd += '&typeinfo.name={}'.format(t) if self.classCombox.currentText() is not '': cmd += '&c:has=typeinfo.classes.{}'.format( self.classCombox.currentText().lower()) if self.slotCombox.currentText() is not '': cmd += '&slot_list.name={}'.format(self.slotCombox.currentText()) if self.adornCombox.currentText() is not '': cmd += '&adornmentslot_list.color={}'.format( self.adornCombox.currentText().lower()) if self.effectLine.text() is not '': cmd += '&adornment_list.name=*{}&c:case=false'.format( self.effectLine.text()) for e in self.item_flags: if e.isChecked(): cmd += '&flags.{}.value=1'.format(e.objectName()) if self.discoStartDate.text() is not '': try: stamp = datetime.strptime(self.discoStartDate.text(), '%Y-%m-%d').timestamp() cmd += '&_extended.discovered.timestamp=]{}'.format(stamp) except BaseException: QMessageBox().critical(self, 'Date error', 'Bad date input, check again.') self.item_find_btn.setEnabled(True) return if self.discoEndDate.text() is not '': try: stamp = datetime.strptime(self.discoEndDate.text(), '%Y-%m-%d').timestamp() cmd += '&_extended.discovered.timestamp=[{}'.format(stamp) except BaseException: QMessageBox().critical(self, 'Date error', 'Bad date input, check again.') self.item_find_btn.setEnabled(True) return cmd += '&c:limit=10000&c:show=type,displayname,leveltouse,iconid,tier,slot_list' self.qy = eq2s_quary.Queries(url + cmd, 'item') self.qy.rst_sent_items_to_main.connect(self.item_result_received) self.qy.start()