예제 #1
0
async def recipe(*,request : str):
    """Gives listed combinations to make single crew OR gives listed combinations including component crew member to make result crew member"""
    if request.lower()=='help' or request.lower()=='names':
        await bot.say("Names for prestige results are: "+lined_string(all_prestige_results)+"** = confirmed since December update\n# = rumored\nunmarked = NOT confirmed since December update")
        return
    if ',' in request:
        names = request.lower().split(',')
        if names[1][0] == ' ':
            names[1] = names[1][1:]
    else: #This will handle single name requests
        result=[]
        for combo in prestiges: #Find all prestige combinations that generate the request
            if fuzz.partial_ratio(request.lower(), prestiges[combo]) > search_threshold:
                result.append("%s = %s"%(([combo.title().split('_')][0]),prestiges[combo].title()))
        if result==[]:
            unique_check = process.extractOne(request, uniques, scorer = fuzz.partial_ratio)
            if unique_check[1] > search_threshold:
                await bot.say("%s was parsed as %s which is a unique. Since uniques are obtainable through mineral draws, prestige recipes including elite crew are not recorded."%(request,unique_check[0]))
                return
            await bot.say("There are no recorded recipes for %s"%(request.title())+source_check)
            return
        else:
            phrase = "These combinations are listed as potentially making %s:"%request.title()+lined_string(result)+"\nConsider double checking your chosen recipe with ?prestige or the spreadsheet"+"\n** = confirmed since December update\n# = rumored\nunmarked = NOT confirmed since December update"
            while len(phrase) > 1950:
                await bot.say(phrase[:phrase.find('[',1800)]+"```")
                phrase = "```"+phrase[phrase.find('[',1800):]
            await bot.say(phrase)
            return
    result=[]
    for combo in prestiges:#This tree will handle prospective parent/child combinations
        if prestiges[combo] and fuzz.partial_ratio(names[0], prestiges[combo]) > search_threshold: #names[0] is the child/product here. This yields a list of all recipes making the child/product
            result.append("%s = %s"%(([combo.split('_')][0]),prestiges[combo])) #entries in result will be the full combination
    result = [x.title() for x in result if fuzz.partial_ratio(names[1],x) > search_threshold]#Take only entries which contain the parent/reagent, names[1]    
    if not result:#If no entries contained the prevoius parent/reagent, names[1]...
        for combo in prestiges:#try it the other way around with names[1] as the child/product
            if prestiges[combo] and fuzz.partial_ratio(names[1], prestiges[combo]) > search_threshold: #names[1] is the child here
                result.append("%s = %s"%(([combo.split('_')][0]), prestiges[combo]))
        result = [x.title() for x in result if fuzz.partial_ratio(names[0],x) > search_threshold]#Take only entries which contain the parent/reagent, names[0]
        if not result:
            await bot.say("I see no relation between %s and %s"%(names[0].title(),names[1].title())+source_check)
            return
        else:
            phrase = "According to records, pertinent combinations between %s and %s are as follows:"%(names[0].title(),names[1].title())+lined_string(sorted(set([x.title() for x in result])))+"Remember, only Legendary combinations are guaranteed by Savy"+"\n** = confirmed since December update\n# = rumored\nunmarked = NOT confirmed since December update"
            while len(phrase) > 1950:
                await bot.say(phrase[:phrase.find('[',1800)]+"```")
                phrase = "```"+phrase[phrase.find('[',1800):]
            await bot.say(phrase)
            return
    else:
        phrase = "According to records, pertinent combinations between %s and %s are as follows:"%(names[0].title(),names[1].title())+lined_string(sorted(set([x.title() for x in result])))+"Remember, only Legendary combinations are guaranteed by Savy"+"\n** = confirmed since December update\n# = rumored\nunmarked = NOT confirmed since December update"
        while len(phrase) > 1950:
                await bot.say(phrase[:phrase.find('[',1800)]+"```")
                phrase = "```"+phrase[phrase.find('[',1800):]
        await bot.say(phrase)
        return
예제 #2
0
async def recipe(*,request : str):
    if request.lower()=='help' or request.lower()=='names':
        await bot.say("Names for prestige results are: ```%s```"%(set([prestiges[combo] for combo in prestiges])))
        return
    if ',' in request:
        names = request.lower().split(',')
        if names[1][0] == ' ':
            names[1] = names[1][1:]
    else:
        try:
            result=[]
            for combo in prestiges:
                if request.lower() in prestiges[combo]:
                    result.append([combo.lower().split('_')][0])
            if result==[]:
                await bot.say("There are no recorded recipes for %s"%(request.title()))
                return
            else:
                await bot.say("These combinations are listed as potentially making %s: ```%s```"%(request.title(), result))
                return
        except:
            await bot.say("There are no recorded recipes for %s"%(request.title()))
            return
    try:
        result=[]
        for combo in prestiges:
            if names[0].lower() in prestiges[combo]: #names[0] is the child here
                result.append([combo.lower().split('_')][0])
        if not [x for x in result if names[1].lower() in x]: #check if the proposed parent is in the combinations
            result=[]
            for combo in prestiges:
                if names[1].lower() in prestiges[combo]: #names[1] is the child here
                    result.append([combo.lower().split('_')][0])
            result=[combo for combo in result if names[0].lower() in combo]#looking for another parent
            if result==[]:
                await bot.say("I see no relation between %s and %s"%(names[0].title(),names[1].title()))
                return
            else:
                for combo in result:
                    combo.remove(names[0].lower())
                await bot.say("According to records, combining %s with the following: \n```%s``` \nmay yield %s. Remember, only Legendary combinations are guaranteed by Savy"%(names[0].title(),set([x[0].title() for x in result]),names[1].title()))
                return
        else:
            result=[combo for combo in result if names[1].lower() in combo]#looking for another parent
            if result==[]:
                await bot.say("I see no relation between %s and %s"%(names[0].title(),names[1].title()))
                return
            else:
                for combo in result:
                    combo.remove(names[1].lower())
                await bot.say("According to records, combining %s with the following: \n```%s``` \nmay yield %s. Remember, only Legendary combinations are guaranteed by Savy"%(names[1].title(),set([x[0].title() for x in result]),names[0].title()))
                return
    except:
        await bot.say("Not sure. Check spelling. I will also only calculate for 2 crew (1 generation). I will also probably have trouble with Visiri Capt'n")
예제 #3
0
async def prestige(*,request : str):
    """Returns data on prestige results for the two crew members entered as input"""
    if request.lower()=="visiri capt'n": #Visiri Captain is weird, okay?
        result=(set([x for x in unique if x[0]=="Visiri Capt'n"][0][1:]))
        await bot.say("%s is recorded as being used in ```%s```"%("Visiri Capt'n", result))
        return
    if ',' in request:
        names = request.lower().split(',')
    else: #If there's only one name, this tree will handle it. It will try to give all receipes for the one crew member
        if request.lower() in heroes:
            result=(set([x for x in hero if x[0]==request.title()][0][1:]))            
        elif request.lower() in epics:
            if request.lower()=='trumpsta':
                request='King Trumpsta'
            result=(set([x for x in epic if x[0]==request.title()][0][1:]))            
        elif request.lower() in uniques:
            result=(set([x for x in unique if x[0]==request.title()][0][1:]))            
        else:
            await bot.say("Unrecognized or the crew is not hero, epic, or unique. Please check spelling with ?namelist")
            return
        if result==set():
            await bot.say("No known recipes including %s"%(request.title()))
            return
        else:
            await bot.say("%s is recorded as being used in ```%s```"%(request.title(), result))
            return
    if names[1][0] == ' ':
        names[1] = names[1][1:]
    try: #Returns plain prestige results
        if prestiges[r"%s_%s"%(names[0],names[1])]=='':
            if prestiges[r"%s_%s"%(names[1],names[0])]=='':
                await bot.say("I don't appear to have any results for this combination.")
                return
            else:
                await bot.say("%s + %s = %s"%(names[0].title(),names[1].title(),prestiges[r"%s_%s"%(names[1],names[0])]))
                return
        else:
            await bot.say("%s + %s = %s"%(names[0].title(),names[1].title(),prestiges[r"%s_%s"%(names[1],names[0])]))
            return
    except:
        await bot.say("Please separate names by a comma (,) and reference ?namelist for spelling. Don't mix rarities.")
예제 #4
0
async def stats(*,request : str):
    """Provides stat readouts for requested crew"""
    initial_request = request
    if request.lower()=='help':
        await bot.say("Give a crew name or a crew name and a stat separated by a comma. All stats will be given if no specific stat is provided. Valid names can be found with ?stat names. Valid stats are ```gender, race, hp, pilot, attack, fire_resistance, repair, weapon, shield, engine, research, walking_speed, running_speed, rarity, progression, xp, special_type, special, training, and equipment.```")
        return
    if request.lower()=='equip' or request.lower()=='equipment':
        await bot.say("```%s```"%(equipment_loadouts))
        return
    if request.lower()=='names':
        await bot.say("Valid names are: ```%s```"%(crew.keys()))
        return
    if ',' in request:
        request = request.lower().split(',')
    else:
        request = process.extractOne(request,crew.keys(),scorer=fuzz.partial_ratio)[0]
        phrase = "%s was parsed as %s\n"%(initial_request,request.title())+"```Name: %s \nGender: %s\nRace: %s \nHP: %s \nPilot: %s \nAttack: %s \nFire Resistance: %s \nRepair: %s \nWeapon: %s \nShield: %s \nEngine: %s \nResearch: %s \nWalking Speed: %s \nRunning Speed: %s\nRarity: %s \nProgression: %s \nXP: %s \nSpecial Type: %s \nSpecial: %s \nTraining: %s \nEquipment: %s - %s```"%(getattr(crew[request],metrics[0]).title(),getattr(crew[request],metrics[1]),getattr(crew[request],metrics[2]),getattr(crew[request],metrics[3]),getattr(crew[request],metrics[4]),getattr(crew[request],metrics[5]),getattr(crew[request],metrics[6]),getattr(crew[request],metrics[7]),getattr(crew[request],metrics[8]),getattr(crew[request],metrics[9]),getattr(crew[request],metrics[10]),getattr(crew[request],metrics[11]),getattr(crew[request],metrics[12]),getattr(crew[request],metrics[13]),getattr(crew[request],metrics[14]),getattr(crew[request],metrics[15]),getattr(crew[request],metrics[16]),getattr(crew[request],metrics[17]),getattr(crew[request],metrics[18]),getattr(crew[request],metrics[19]),getattr(crew[request],metrics[20]),equipment_loadouts[int(getattr(crew[request],metrics[20]))])
        await bot.say(phrase)
        return
    if request[1][0] == ' ':
        request[1] = request[1][1:]
    if request[0].lower()=='equip' or request[0].lower()=='equipment':
        try:
            await bot.say("Loadout %s is for ```%s```"%(request[1],equipment_loadouts[int(request[1])]))
            return
        except:
            await bot.say("I don't know how you got here")
            return
    try:
        await bot.say("%s's %s is: %s"%(request[0].title(), request[1], getattr(crew[request[0]],request[1])))
        if request[1].lower=='equip' or request[1].lower()=='equipment':
            await bot.say("```%s```"%(equipment_loadouts[int(getattr(crew[request[0]],request[1]))]))
            return
    except:
        pass
    crew0 = process.extractOne(request[0], crew.keys(), scorer = fuzz.partial_ratio)
    crew1 = process.extractOne(request[1], crew.keys(), scorer = fuzz.partial_ratio)
    if crew0[1] > search_threshold and crew1[1] > search_threshold:
        crew0 = crew0[0]
        crew1 = crew1[0]
        phrase = "%s and %s were parsed as %s and %s\nAs compared to %s, %s has\n"%(request[0],request[1],crew0,crew1,crew1,crew0)+"```%s - %s\nHP: %s \nPilot: %s \nAttack: %s \nFire Resistance: %s \nRepair: %s \nWeapon: %s \nShield: %s \nEngine: %s \nResearch: %s \nWalking Speed: %s \nRunning Speed: %s\nSpecial Type: %s \nSpecial: %s \nTraining : %s \nEquipment: %s```"%(crew0.title(),crew1.title(),crew[crew0].hp-crew[crew1].hp, crew[crew0].pilot-crew[crew1].pilot, round(crew[crew0].attack-crew[crew1].attack,4), round(crew[crew0].fire_resistance-crew[crew1].fire_resistance,5), round(crew[crew0].repair-crew[crew1].repair,4), crew[crew0].weapon-crew[crew1].weapon, crew[crew0].shield-crew[crew1].shield, crew[crew0].engine-crew[crew1].engine, crew[crew0].research-crew[crew1].research, crew[crew0].walking_speed-crew[crew1].walking_speed, crew[crew0].running_speed-crew[crew1].running_speed, str(crew[crew0].special_type)+" vs. "+str(crew[crew1].special_type), str(crew[crew0].special)+" vs. "+str(crew[crew1].special), crew[crew0].training-crew[crew1].training, equipment_loadouts[int(crew[crew0].equipment)]+" vs. "+equipment_loadouts[int(crew[crew1].equipment)])
        await bot.say(phrase)
        return