quests quefaire (explicit level)
This commit is contained in:
parent
0ccf8ad720
commit
f9e9300365
@ -288,7 +288,9 @@ class WynncraftCog(commands.Cog):
|
||||
self.config.register_global(**default_global)
|
||||
|
||||
@commands.command()
|
||||
async def quefaire(self, ctx):
|
||||
async def quefaire(self, ctx, explicit_level: int = 0):
|
||||
if explicit_level == 0:
|
||||
# check for class then quests
|
||||
player_name = ctx.author.display_name
|
||||
req = requests.get("https://api.wynncraft.com/v2/player/%s/stats" % player_name).json()
|
||||
if not req["data"]:
|
||||
@ -303,6 +305,8 @@ class WynncraftCog(commands.Cog):
|
||||
await ctx.send(":x: impossible de t'aider, je ne te trouve pas ta classe sur Wynncraft :(")
|
||||
return
|
||||
|
||||
level = max_class["professions"]["combat"]["level"]
|
||||
|
||||
# check for available quests
|
||||
quests = await self.config.quests()
|
||||
quests.reverse()
|
||||
@ -310,10 +314,12 @@ class WynncraftCog(commands.Cog):
|
||||
if quest["name"] in max_class["quests"]["list"]:
|
||||
continue # player has already done this quest
|
||||
|
||||
if quest["level"] <= max_class["professions"]["combat"]["level"] and max_class["professions"]["combat"]["level"] - quest["level"] < 10:
|
||||
if quest["level"] <= level and level - quest["level"] < 10:
|
||||
# quest is doable
|
||||
await ctx.send(":dizzy: Woosh! Tu peux faire la quête **%s** (%s)" % (quest["name"], quest["url"]))
|
||||
return
|
||||
else:
|
||||
level = explicit_level
|
||||
|
||||
# check for dungeons and grind spots
|
||||
dungeons = await self.config.dungeons()
|
||||
@ -324,12 +330,12 @@ class WynncraftCog(commands.Cog):
|
||||
|
||||
hints = []
|
||||
for dungeon in dungeons:
|
||||
if max_class["professions"]["combat"]["level"] >= dungeon["minlevel"] and max_class["professions"]["combat"]["level"] - dungeon["minlevel"] < 10:
|
||||
if level >= dungeon["minlevel"] and level - dungeon["minlevel"] < 10:
|
||||
hints.append(":cyclone: Tu peux faire le donjon **%s** aux coordonnées %s (%s)" % (dungeon["name"], dungeon["location"], dungeon["url"]))
|
||||
break
|
||||
|
||||
for grind_spot in grind_spots:
|
||||
if grind_spot["minlevel"] <= max_class["professions"]["combat"]["level"] <= grind_spot["maxlevel"]:
|
||||
if grind_spot["minlevel"] <= level <= grind_spot["maxlevel"]:
|
||||
hints.append(":star: Tu peux grinder aux coordonnées %s jusqu'au niveau %s" % (grind_spot["location"], grind_spot["maxlevel"]))
|
||||
break
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user