Add some icons, create QuestMap model

This commit is contained in:
henriquenakashima 2021-03-27 22:48:42 -04:00
parent 6c88218391
commit 54fe65cf28
18 changed files with 61 additions and 2 deletions

0
questhelper/__init__.py Normal file
View file

View file

@ -0,0 +1,5 @@
from map.quest_map import QuestMap
def generate_map() -> QuestMap:
return QuestMap()

View file

@ -0,0 +1,13 @@
from map.quest_map import MapEncounter, QuestMap, EncounterType
_ICONS = {
EncounterType.BATTLE_REGULAR: 'noun_Battle_3647629.png'
}
def render_map(quest_map: QuestMap):
return [__render_encounter(MapEncounter(EncounterType.BATTLE_REGULAR))] * 3
def __render_encounter(encounter: MapEncounter):
return f'map/{_ICONS[encounter.type]}'

View file

@ -0,0 +1,16 @@
import dataclasses
import enum
class EncounterType(enum.Enum):
BATTLE_REGULAR = 'battle_regular'
class QuestMap:
def __init__(self):
pass
@dataclasses.dataclass
class MapEncounter:
type: EncounterType

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 21 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 27 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 35 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 28 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

View file

@ -1,4 +1,11 @@
{% load static %}
<head></head>
<body>
<h1>Map</h1>
</body>
<ul>
<img src="{% static 'map/noun_dragon_3820621.png' %}" alt="My image">
{% for room in rooms %}
<li>{{ room }}</li>
{% endfor %}
</ul>
</body>

View file

@ -1,8 +1,15 @@
from django.http import HttpResponse
from django.template import loader
from map import map_generator
from map import map_renderer
from map.quest_map import QuestMap
def index(request):
quest_map: QuestMap = map_generator.generate_map()
rendered_map = map_renderer.render_map(quest_map)
template = loader.get_template('map/index.html')
context = {}
context = {'rooms': rendered_map}
return HttpResponse(template.render(context, request))