Add some icons, create QuestMap model
11
attribution.txt
Normal 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
5
questhelper/map/map_generator.py
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
from map.quest_map import QuestMap
|
||||
|
||||
|
||||
def generate_map() -> QuestMap:
|
||||
return QuestMap()
|
||||
13
questhelper/map/map_renderer.py
Normal 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]}'
|
||||
16
questhelper/map/quest_map.py
Normal 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
|
||||
BIN
questhelper/map/static/map/noun_Battle_3647629.png
Normal file
|
After Width: | Height: | Size: 20 KiB |
BIN
questhelper/map/static/map/noun_Beer_2076695.png
Normal file
|
After Width: | Height: | Size: 18 KiB |
BIN
questhelper/map/static/map/noun_Caravel_2421659.png
Normal file
|
After Width: | Height: | Size: 18 KiB |
BIN
questhelper/map/static/map/noun_Library_3820590.png
Normal file
|
After Width: | Height: | Size: 14 KiB |
BIN
questhelper/map/static/map/noun_Shield_3806325.png
Normal file
|
After Width: | Height: | Size: 21 KiB |
BIN
questhelper/map/static/map/noun_Store_786819.png
Normal file
|
After Width: | Height: | Size: 13 KiB |
BIN
questhelper/map/static/map/noun_Tent_3814999.png
Normal file
|
After Width: | Height: | Size: 27 KiB |
BIN
questhelper/map/static/map/noun_brussels town hall_3284349.png
Normal file
|
After Width: | Height: | Size: 16 KiB |
BIN
questhelper/map/static/map/noun_cogs_442166.png
Normal file
|
After Width: | Height: | Size: 35 KiB |
BIN
questhelper/map/static/map/noun_dragon_3820621.png
Normal file
|
After Width: | Height: | Size: 28 KiB |
BIN
questhelper/map/static/map/noun_temple_2382601.png
Normal file
|
After Width: | Height: | Size: 12 KiB |
|
|
@ -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>
|
||||
|
|
|
|||
|
|
@ -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))
|
||||
|
|
|
|||