Skip to content

Commit

Permalink
QoL fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
bobloy committed Jul 16, 2021
1 parent 4183607 commit 61fa006
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 4 deletions.
11 changes: 10 additions & 1 deletion conquest/conquest.py
@@ -1,5 +1,6 @@
import asyncio
import json
import logging
import os
import pathlib
from abc import ABC
Expand All @@ -13,6 +14,8 @@
from redbot.core.bot import Red
from redbot.core.data_manager import bundled_data_path, cog_data_path

log = logging.getLogger("red.fox_v3.conquest")


class Conquest(commands.Cog):
"""
Expand Down Expand Up @@ -53,14 +56,20 @@ async def load_data(self):
self.current_map = await self.config.current_map()

if self.current_map:
await self.current_map_load()
if not await self.current_map_load():
await self.config.current_map.clear()

async def current_map_load(self):
map_data_path = self.asset_path / self.current_map / "data.json"
if not map_data_path.exists():
log.warning(f"{map_data_path} does not exist. Clearing current map")
return False

with map_data_path.open() as mapdata:
self.map_data: dict = json.load(mapdata)
self.ext = self.map_data["extension"]
self.ext_format = "JPEG" if self.ext.upper() == "JPG" else self.ext.upper()
return True

@commands.group()
async def conquest(self, ctx: commands.Context):
Expand Down
6 changes: 3 additions & 3 deletions conquest/data/assets/maps.json
@@ -1,7 +1,7 @@
{
"maps": [
"simple_blank_map",
"test",
"test2"
"simple",
"ck2",
"HoI"
]
}

0 comments on commit 61fa006

Please sign in to comment.