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

11
attribution.txt Normal file
View file

@ -0,0 +1,11 @@
Battle by Heztasia from the Noun Project
Shield by Kmg Design from the Noun Project
dragon by Frey Wazza from the Noun Project
Library by Frey Wazza from the Noun Project
Store by ProSymbols from the Noun Project
brussels town hall by myiconfinder from the Noun Project
Tent by agus raharjo from the Noun Project
cogs by Chameleon Design from the Noun Project
temple by rivercon from the Noun Project
Beer by lastspark from the Noun Project
Caravel by Rahmat Hidayat from the Noun Project

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> <head></head>
<body> <body>
<h1>Map</h1> <h1>Map</h1>
<ul>
<img src="{% static 'map/noun_dragon_3820621.png' %}" alt="My image">
{% for room in rooms %}
<li>{{ room }}</li>
{% endfor %}
</ul>
</body> </body>

View file

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