conquest_develop
bobloy 3 years ago
parent 6762d3cbde
commit cd49b07448

@ -8,7 +8,7 @@ from shutil import copyfile
from typing import Optional, Union, Dict from typing import Optional, Union, Dict
import discord import discord
from PIL import Image, ImageColor, ImageOps from PIL import Image, ImageColor, ImageOps, ImageFont
from discord.ext.commands import Greedy from discord.ext.commands import Greedy
from redbot.core import Config, commands from redbot.core import Config, commands
from redbot.core.commands import Context from redbot.core.commands import Context
@ -16,8 +16,8 @@ from redbot.core.bot import Red
from redbot.core.data_manager import bundled_data_path, cog_data_path from redbot.core.data_manager import bundled_data_path, cog_data_path
from redbot.core.utils.predicates import MessagePredicate from redbot.core.utils.predicates import MessagePredicate
from conquest import regioner
from conquest.conquestgame import ConquestGame from conquest.conquestgame import ConquestGame
from conquest.regioner import ConquestMap, MapMaker, composite_regions
ERROR_CONQUEST_SET_MAP = "No map is currently set. See `[p]conquest set map`" ERROR_CONQUEST_SET_MAP = "No map is currently set. See `[p]conquest set map`"
@ -68,7 +68,7 @@ class Conquest(commands.Cog):
) # key: guild_id ) # key: guild_id
self.map_data = {} # key, value = guild.id, ConquestGame self.map_data = {} # key, value = guild.id, ConquestGame
self.mm: Optional[MapMaker] = None self.mm: Optional[regioner.MapMaker] = None
async def red_delete_data_for_user(self, **kwargs): async def red_delete_data_for_user(self, **kwargs):
"""Nothing to delete""" """Nothing to delete"""
@ -90,6 +90,18 @@ class Conquest(commands.Cog):
if game_data is not None: if game_data is not None:
await self.load_guild_data(guild, **game_data) await self.load_guild_data(guild, **game_data)
# regioner.MAP_FONT = ImageFont.truetype(
# str(bundled_data_path(self) / "fonts" / "smallest_pixel_7" / "smallest_pixel-7.ttf"), size=10
# )
# regioner.MAP_FONT = ImageFont.truetype(
# str(bundled_data_path(self) / "fonts" / "bit01" / "bit01.ttf"), size=4
# )
regioner.MAP_FONT = ImageFont.truetype(
str(bundled_data_path(self) / "fonts" / "pixels" / "Pixels.ttf"), size=16
)
# for guild_id, game_name in self.current_maps.items(): # for guild_id, game_name in self.current_maps.items():
# await self.current_map_load(guild_id, game_name) # await self.current_map_load(guild_id, game_name)
@ -125,8 +137,8 @@ class Conquest(commands.Cog):
# # await self.config.current_map.set(None) # # await self.config.current_map.set(None)
# # return # # return
async def _get_current_map_folder(self, guild): # async def _get_current_map_folder(self, guild):
return self.current_map_folder / guild.id / self.current_map # return self.current_map_folder / guild.id / self.current_map
async def _mm_save_map(self, map_name, target_save): async def _mm_save_map(self, map_name, target_save):
return await self.mm.change_name(map_name, target_save) return await self.mm.change_name(map_name, target_save)
@ -209,7 +221,7 @@ class Conquest(commands.Cog):
return return
async with ctx.typing(): async with ctx.typing():
self.mm = MapMaker(target_save) self.mm = regioner.MapMaker(target_save)
self.mm.custom = True self.mm.custom = True
if path_to_image: if path_to_image:
@ -286,7 +298,7 @@ class Conquest(commands.Cog):
await ctx.maybe_send_embed(f"Map {map_name} not found in {self.custom_map_folder}") await ctx.maybe_send_embed(f"Map {map_name} not found in {self.custom_map_folder}")
return return
self.mm = MapMaker(map_path) self.mm = regioner.MapMaker(map_path)
self.mm.load_data() self.mm.load_data()
await ctx.tick() await ctx.tick()

Loading…
Cancel
Save