More WIP conquest
This commit is contained in:
parent
4cd033bf12
commit
4457d51f07
@ -8,4 +8,4 @@ async def setup(bot):
|
|||||||
data_manager.bundled_data_path(cog)
|
data_manager.bundled_data_path(cog)
|
||||||
await cog.load_data()
|
await cog.load_data()
|
||||||
|
|
||||||
bot.add_cog(cog)
|
bot.add_cog(cog)
|
||||||
|
@ -60,7 +60,7 @@ class Conquest(commands.Cog):
|
|||||||
self.ext = "PNG"
|
self.ext = "PNG"
|
||||||
self.ext_format = "PNG"
|
self.ext_format = "PNG"
|
||||||
|
|
||||||
self.mm: Union[MapMaker, None] = None
|
self.mm: Optional[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"""
|
||||||
@ -92,7 +92,9 @@ class Conquest(commands.Cog):
|
|||||||
map_name = map_data["map_name"]
|
map_name = map_data["map_name"]
|
||||||
map_path = self._path_if_custom(map_data["is_custom"]) / map_name
|
map_path = self._path_if_custom(map_data["is_custom"]) / map_name
|
||||||
|
|
||||||
self.current_maps[guild.id] = ConquestGame(map_path, map_name, self.current_map_folder / map_name)
|
self.current_maps[guild.id] = ConquestGame(
|
||||||
|
map_path, map_name, self.current_map_folder / map_name
|
||||||
|
)
|
||||||
|
|
||||||
async def current_map_load(self):
|
async def current_map_load(self):
|
||||||
map_path = self._path_if_custom()
|
map_path = self._path_if_custom()
|
||||||
|
19
conquest/conquestgame.py
Normal file
19
conquest/conquestgame.py
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
import pathlib
|
||||||
|
|
||||||
|
from conquest.regioner import ConquestMap
|
||||||
|
|
||||||
|
|
||||||
|
class ConquestGame:
|
||||||
|
def __init__(self, map_path: pathlib.Path, game_name: str, custom_map_path: pathlib.Path):
|
||||||
|
super().__init__(custom_map_path / game_name)
|
||||||
|
self.blank_map = ConquestMap(map_path)
|
||||||
|
self.game_name = game_name
|
||||||
|
self.custom_map_path = custom_map_path
|
||||||
|
|
||||||
|
async def save_region(self, region):
|
||||||
|
if not self.custom:
|
||||||
|
return False
|
||||||
|
pass # TODO: region data saving
|
||||||
|
|
||||||
|
async def start_game(self):
|
||||||
|
pass
|
@ -260,31 +260,6 @@ class ConquestMap:
|
|||||||
return current_numbered_img
|
return current_numbered_img
|
||||||
|
|
||||||
|
|
||||||
class ConquestGame(ConquestMap):
|
|
||||||
def __init__(self, map_path: pathlib.Path, game_name: str, custom_map_path: pathlib.Path):
|
|
||||||
super().__init__(map_path)
|
|
||||||
self.game_name = game_name
|
|
||||||
self.custom_map_path = custom_map_path
|
|
||||||
self.game_path = custom_map_path / game_name
|
|
||||||
|
|
||||||
def game_data_path(self):
|
|
||||||
return self.game_path / "data.json"
|
|
||||||
|
|
||||||
def game_current_path(self):
|
|
||||||
return self.game_path / "current.png"
|
|
||||||
|
|
||||||
def game_current_numbered_path(self):
|
|
||||||
return self.game_path / "current_numbered.png"
|
|
||||||
|
|
||||||
async def save_region(self, region):
|
|
||||||
if not self.custom:
|
|
||||||
return False
|
|
||||||
pass # TODO: region data saving
|
|
||||||
|
|
||||||
async def start_game(self):
|
|
||||||
pass
|
|
||||||
|
|
||||||
|
|
||||||
class MapMaker(ConquestMap):
|
class MapMaker(ConquestMap):
|
||||||
async def change_name(self, new_name: str, new_path: pathlib.Path):
|
async def change_name(self, new_name: str, new_path: pathlib.Path):
|
||||||
if new_path.exists() and new_path.is_dir():
|
if new_path.exists() and new_path.is_dir():
|
||||||
|
Loading…
x
Reference in New Issue
Block a user