|
|
|
@ -14,27 +14,46 @@ from redbot.core.bot import Red
|
|
|
|
|
from redbot.core.data_manager import bundled_data_path, cog_data_path
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# class StrList(commands.Converter):
|
|
|
|
|
# async def convert(self, ctx, argument):
|
|
|
|
|
# x = argument.split()
|
|
|
|
|
#
|
|
|
|
|
# out_ints = set()
|
|
|
|
|
# for a in x:
|
|
|
|
|
# if "-" in a:
|
|
|
|
|
# splitted = a.split("-", 1)
|
|
|
|
|
# first = int(splitted[0])
|
|
|
|
|
# last = int(splitted[1])
|
|
|
|
|
# add_range = {b for b in range(first, last+1)}
|
|
|
|
|
#
|
|
|
|
|
# else:
|
|
|
|
|
# out_ints.add(int(a))
|
|
|
|
|
class MapMaker(commands.Cog):
|
|
|
|
|
""""""
|
|
|
|
|
def __init__(self, bot: Red):
|
|
|
|
|
super().__init__()
|
|
|
|
|
self.bot = bot
|
|
|
|
|
|
|
|
|
|
self.config = Config.get_conf(
|
|
|
|
|
self, identifier=77971127797107101114, force_registration=True
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
default_guild = {}
|
|
|
|
|
default_global = {}
|
|
|
|
|
self.config.register_guild(**default_guild)
|
|
|
|
|
self.config.register_global(**default_global)
|
|
|
|
|
|
|
|
|
|
class Conquest(commands.Cog):
|
|
|
|
|
|
|
|
|
|
@commands.group()
|
|
|
|
|
async def mapmaker(self, ctx: commands.context):
|
|
|
|
|
"""
|
|
|
|
|
Cog Description
|
|
|
|
|
Base command for managing current maps or creating new ones
|
|
|
|
|
"""
|
|
|
|
|
if ctx.invoked_subcommand is None:
|
|
|
|
|
pass
|
|
|
|
|
|
|
|
|
|
Less important information about the cog
|
|
|
|
|
@mapmaker.command(name="upload")
|
|
|
|
|
async def _mapmaker_upload(self, ctx: commands.Context, map_path=""):
|
|
|
|
|
"""Load a map image to be modified. Upload one with this command or provide a path"""
|
|
|
|
|
message: discord.Message = ctx.message
|
|
|
|
|
if not message.attachments and not map_path:
|
|
|
|
|
await ctx.maybe_send_embed("Either upload an image with this command or provide a path to the image")
|
|
|
|
|
return
|
|
|
|
|
|
|
|
|
|
@mapmaker.command(name="load")
|
|
|
|
|
async def _mapmaker_load(self, ctx: commands.Context, map_name=""):
|
|
|
|
|
"""Load an existing map to be modified."""
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class Conquest(commands.Cog):
|
|
|
|
|
"""
|
|
|
|
|
Cog for
|
|
|
|
|
"""
|
|
|
|
|
|
|
|
|
|
default_zoom_json = {"enabled": False, "x": -1, "y": -1, "zoom": 1.0}
|
|
|
|
@ -79,22 +98,6 @@ class Conquest(commands.Cog):
|
|
|
|
|
self.ext = self.map_data["extension"]
|
|
|
|
|
self.ext_format = "JPEG" if self.ext.upper() == "JPG" else self.ext.upper()
|
|
|
|
|
|
|
|
|
|
@commands.group()
|
|
|
|
|
async def mapmaker(self, ctx: commands.context):
|
|
|
|
|
"""
|
|
|
|
|
Base command for managing current maps or creating new ones
|
|
|
|
|
"""
|
|
|
|
|
if ctx.invoked_subcommand is None:
|
|
|
|
|
pass
|
|
|
|
|
|
|
|
|
|
@mapmaker.command(name="load")
|
|
|
|
|
async def _mapmaker_load(self, ctx: commands.Context, map_path=""):
|
|
|
|
|
"""Load a map image to be modified. Upload one with this command or provide a path"""
|
|
|
|
|
message: discord.Message = ctx.message
|
|
|
|
|
if not message.attachments and not map_path:
|
|
|
|
|
await ctx.maybe_send_embed("Either upload an image with this command or provide a path to the image")
|
|
|
|
|
return
|
|
|
|
|
|
|
|
|
|
@commands.group()
|
|
|
|
|
async def conquest(self, ctx: commands.Context):
|
|
|
|
|
"""
|
|
|
|
|