Update Asci and fix bug on quicksave

This commit is contained in:
Shadow15510 2022-02-28 17:05:16 +01:00
commit 8b59e7a727
14 changed files with 286 additions and 326 deletions

5
.gitignore vendored
View File

@ -1,5 +1,4 @@
__pycache__/
tiled_map/__pycache__/
src/__pycache__/
demo/__pycache__/
notes.txt
idk/__pycache__/
idk/dlc_idk.py

View File

@ -74,15 +74,6 @@ alfheim = (r"""
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~""",
[
("palais", '?', 34, 20, 'stand by'),
("charretier", '*', 23, 17, 'stand by'),
(0, '*', 11, 4, 'stand by'),
(1, '*', 46, 6, 'stand by'),
(2, '*', 27, 54, 'stand by'),
],
# Autres mondes (Alfheim = 2)
(14, 68, 1, 28, 13), # Vanaheim
@ -113,9 +104,6 @@ h_23 = (r"""
| | | | | | | |
| | | | | | | |
/ \______/ \_______|^|______/ \______/ \ """,
[
("Sagriel", '*', 23, 5, 'stand by'),
],
(25, 19, 2, 34, 16))
@ -140,8 +128,15 @@ h_24 = (r"""
| |
|====| |====|
|====|^|====| """,
[
("Diomwar", '*', 36, 12, 'stand by'),
(0, '*', 12, 3, 'stand by'),
],
(20, 19, 2, 52, 31))
(20, 19, 2, 52, 31))
alfheim_entities = (
[0, '?', 2, 34, 20, 'stand by'],
["alfeim_charretier", '*', 2, 23, 17, 'stand by'],
[0, '*', 2, 11, 4, 'stand by'],
[0, '*', 2, 46, 6, 'stand by'],
[0, '*', 2, 27, 54, 'stand by'],
["Sagriel", '*', 23, 23, 5, 'stand by'],
["Diomwar", '*', 24, 36, 12, 'stand by'],
[0, '*', 24, 12, 3, 'stand by'],
)

View File

@ -1,17 +1,26 @@
# Asci (1.7.2)
# Asci (1.8.1)
class Asci:
def __init__(self, maps, events_mapping, keys_mapping, behaviors=None, screen_width=21, screen_height=6):
# Load maps
def __init__(self, maps, entities, events_mapping, keys_mapping, behaviors=None, screen_width=21, screen_height=6):
# Load maps and entities
self.maps = [Map(*i) for i in maps]
self.entities = {}
entity_id = 0
for i in entities:
if not i[0]:
i[0] = entity_id
entity_id += 1
if i[0] in self.entities: raise KeyError("'{}' is already a registered entities".format(i[0]))
else: self.entities[i[0]] = Entity(*i)
# Custom functions
self._legend = list(events_mapping.keys())
self._game_events_mapping = [events_mapping[i] for i in self._legend]
self._game_keys_mapping = {key: keys_mapping[key] for key in keys_mapping if not key in (1, 2, 3, 5)}
# Custom entities behavior
self._behaviors = {"permanent": permanent, "stand by": stand_by, "follow": follow, "walk": walk}
self._behaviors = {"permanent": permanent, "stand by": stand_by, "follow": follow, "walk between": walk_between, "walk to": walk_to, "follow by player": follow_by_player}
if behaviors:
for i in behaviors: self._behaviors[i] = behaviors[i]
@ -89,18 +98,18 @@ class Asci:
return self.data[1], self.data[2], self.data[3]
def _change_map(self, new_map):
# Update entities
if self.current_map:
for i in self.current_map.entities.copy():
entity = self.current_map.entities[i]
if entity.behavior == "follow":
entity.pos_x = entity.pos_y = -1
self.maps[new_map].entities[entity.entity_id] = entity
self.maps[self.data[1]].entities.pop(i)
# Update current map
self.data[1] = new_map
# Update map id and data
old_map, self.data[1] = self.data[1], new_map
self.current_map = self.maps[self.data[1]]
self.current_map.entities = {}
# Update entities
for i in self.entities:
entity = self.entities[i]
if entity.map_id == old_map and entity.behavior == "follow":
entity.pos_x = entity.pos_y = -1
entity.map_id = new_map
if entity.map_id == new_map: self.current_map.entities[i] = entity
# Update screen configuration
self.screen.set_world(self.current_map.map_data)
@ -160,7 +169,7 @@ class Asci:
# Configuration
self._legend.append(door)
self._legend.append(walkable)
self._change_map(data[1])
self._change_map(self.data[1])
self.screen.load_data(self.data)
key = 0
@ -173,7 +182,7 @@ class Asci:
data_copy = self.data[:]
for entity in self.current_map.entities.values():
self._behaviors[entity.behavior](entity, data_copy, self.stat, self.screen, walkable)
if (0 <= entity.pos_x - self.data[2] + 10 < self.screen.screen_width) and (0 <= entity.pos_y - self.data[3] + 3 < self.screen.screen_height):
if entity.map_id == self.data[1] and (0 <= entity.pos_x - self.data[2] + 10 < self.screen.screen_width) and (0 <= entity.pos_y - self.data[3] + 3 < self.screen.screen_height):
self.screen.set_cell(entity.pos_x, entity.pos_y, entity.symbol)
self.screen.set_cell(self.data[2], self.data[3], player)
@ -274,16 +283,17 @@ class Event:
class Map:
def __init__(self, map_data, entities, *coords):
def __init__(self, map_data, *coords):
self.map_data = map_data
if entities: self.entities = {i[0]: Entity(*i) for i in entities}
else: self.entities = {}
self.coords = coords
self.entities = {}
class Entity:
def __init__(self, entity_id, symbol, x, y, behavior, *args):
def __init__(self, entity_id, symbol, map_id, x, y, behavior, *args):
self.entity_id = entity_id
self.symbol = symbol
self.map_id = map_id
self.pos_x = x
self.pos_y = y
self.behavior = behavior
@ -292,6 +302,9 @@ class Entity:
def change_behavior(self, new_behavior):
if self.behavior != "permanent": self.behavior = new_behavior
def teleport(self, map_id, x, y):
if self.behavio != "permanent": self.map_id, self.pos_x, self.pos_y = map_id, x, y
# Functions used by Asci
def convert(string, force_int=False):
@ -403,9 +416,46 @@ def follow(entity, data, stat, screen, walkable):
elif screen.get_cell(cases[0], cases[1]) in walkable: entity.pos_x, entity.pos_y = cases
def walk(entity, data, stat, screen, walkable):
def walk_between(entity, data, stat, screen, walkable):
frame = (entity.args[0] + 1) % len(entity.args[1])
new_x, new_y = entity.args[1][frame]
new_x, new_y = _walk_engine(entity, frame)
if screen.get_cell(new_x, new_y) in walkable:
entity.pos_x, entity.pos_y = new_x, new_y
entity.args[0] = frame
def walk_to(entity, data, stat, screen, walkable):
frame = entity.args[0]
if len(entity.args[1]) == frame:
entity.behavior = "stand by"
entity.args = []
return
new_x, new_y = _walk_engine(entity, frame)
if screen.get_cell(new_x, new_y) in walkable:
entity.pos_x, entity.pos_y = new_x, new_y
entity.args[0] += 1
def follow_by_player(entity, data, stat, screen, walkable):
frame = entity.args[0]
if len(entity.args[1]) == frame:
entity.behavior = "stand by"
entity.args = []
return
new_x, new_y = _walk_engine(entity, frame)
if abs(data[2] - new_x) < 5 and abs(data[3] - new_y) < 3 and screen.get_cell(new_x, new_y) in walkable:
entity.pos_x, entity.pos_y = new_x, new_y
if (new_x, new_y) == entity.args[1][frame]: entity.args[0] += 1
def _walk_engine(entity, frame):
delta_x, delta_y = list(map(lambda x,y: y - x, (entity.pos_x, entity.pos_y), entity.args[1][frame]))
new_x = entity.pos_x
new_y = entity.pos_y
if delta_x: new_x += abs(delta_x) // delta_x
if delta_y: new_y += abs(delta_y) // delta_y
return new_x, new_y

View File

@ -74,30 +74,6 @@ asgard = (r"""
~~~~~ ~~~~~~~~~~~~~~~~~~~ ~~~~~~~~
~~~~~~~~~~~ ~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~""",
[
('valaskjalf', '?', 120, 26, 'stand by'),
('jardin sud', '?', 51, 55, 'stand by'),
(0, '*', 34, 7, 'stand by'),
(1, '*', 121, 21, 'stand by'),
(2, '*', 117, 32, 'stand by'),
(3, '*', 29, 13, 'stand by'),
(4, '*', 19, 20, 'stand by'),
(5, '*', 28, 26, 'stand by'),
(6, '*', 46, 35, 'stand by'),
(7, '*', 57, 38, 'stand by'),
(8, '*', 82, 38, 'stand by'),
(9, '*', 22, 39, 'stand by'),
(10, '*', 8, 44, 'stand by'),
(11, '*', 58, 50, 'stand by'),
(12, '*', 83, 51, 'stand by'),
(13, '*', 32, 59, 'stand by'),
(14, '*', 104, 63, 'stand by'),
(15, '*', 46, 65, 'stand by'),
(16, '*', 16, 71, 'stand by'),
(17, '*', 138, 71, 'stand by'),
],
# Autres mondes (Asgard = 0)
(126, 71, 3, 72, 6), # Midgard
@ -136,9 +112,6 @@ h_9 = (r"""
|============| |=============|
| |
||^|| """,
[
("Forseti", '*', 19, 4, 'stand by'),
],
(15, 13, 0, 30, 11))
@ -167,9 +140,6 @@ h_10 = (r"""
|__| |__| |__| |__| |__| |__|
|__| |__| |__| |__| |__| |__|
/__\ /__\ /__\__^^__/__\ /__\ /__\ """,
[
("Odin", '*', 25, 11, 'stand by'),
],
(29, 23, 0, 116, 14),
(30, 23, 0, 116, 14))
@ -195,9 +165,6 @@ h_11 = (r"""
|======================| |======================|
|=+<>+=+<>+=+<>+=+<>+==| |==+<>+=+<>+=+<>+=+<>+=|
|^| """,
[
(0, '*', 34, 7, 'stand by'),
],
(24, 19, 0, 70, 19))
@ -222,9 +189,6 @@ h_12 = (r"""
|=-=-=-=-=-=|- - | | - -|=-=-=-=-=-=|
| - -| |- - |
/- - \_____|^^|_____/ - -\ """,
[
(0, '*', 19, 4, 'stand by'),
],
(24, 19, 0, 25, 31),
(25, 19, 0, 26, 31))
@ -245,9 +209,6 @@ h_13 = (r"""
| |
|==================| |==================|
|^| """,
[
(0, '*', 21, 8, 'stand by'),
],
(20, 14, 0, 110, 34))
@ -267,9 +228,6 @@ h_14 = (r"""
||_| |_||
|=|\/|==|\/|=| |=|\/|==|\/|=|
|^^| """,
[
(0, '*', 26, 2, 'stand by'),
],
(14, 14, 0, 63, 36),
(15, 14, 0, 64, 36))
@ -290,9 +248,6 @@ h_15 = (r"""
#### ####
| |
|^| """,
[
("Vidar", '*', 10, 6, 'stand by'),
],
(14, 14, 0, 120, 41))
@ -327,9 +282,6 @@ h_16 = (r"""
|===================| _ | | _ |===================|
(_) | | (_)
|=| |/^\| |=| """,
[
(0, '*', 50, 14, 'stand by'),
],
(29, 29, 0, 13, 43))
@ -359,9 +311,6 @@ h_17 = (r"""
| |
|======================| |=======================|
|^| """,
[
(0, '*', 36, 14, 'stand by'),
],
(24, 24, 0, 75, 50))
@ -391,9 +340,6 @@ h_18 = (r"""
|=====================/| |\=====================|
\| |/
/|^^|\ """,
[
(0, '*', 30, 9, 'stand by'),
],
(24, 24, 0, 27, 56),
(25, 24, 0, 28, 56))
@ -414,9 +360,6 @@ h_19 = (r"""
| |
| |
|=======================|^|======================|""",
[
(0, '*', 28, 7, 'stand by'),
],
(25, 14, 0, 57, 67))
@ -446,8 +389,40 @@ h_20 = (r"""
| |_| |_| |
| |
|============|^^|============|""",
[
(0, '*', 39, 9, 'stand by'),
],
(34, 24, 0, 10, 69),
(35, 24, 0, 11, 69))
(35, 24, 0, 11, 69))
asgard_entities = (
[0, '?', 0, 120, 26, 'stand by'],
[0, '?', 0, 51, 55, 'stand by'],
[0, '*', 0, 34, 7, 'stand by'],
[0, '*', 0, 121, 21, 'stand by'],
[0, '*', 0, 117, 32, 'stand by'],
[0, '*', 0, 29, 13, 'stand by'],
[0, '*', 0, 19, 20, 'stand by'],
[0, '*', 0, 28, 26, 'stand by'],
[0, '*', 0, 46, 35, 'stand by'],
[0, '*', 0, 57, 38, 'stand by'],
[0, '*', 0, 82, 38, 'stand by'],
[0, '*', 0, 22, 39, 'stand by'],
[0, '*', 0, 8, 44, 'stand by'],
[0, '*', 0, 58, 50, 'stand by'],
[0, '*', 0, 83, 51, 'stand by'],
[0, '*', 0, 32, 59, 'stand by'],
[0, '*', 0, 104, 63, 'stand by'],
[0, '*', 0, 46, 65, 'stand by'],
[0, '*', 0, 16, 71, 'stand by'],
[0, '*', 0, 138, 71, 'stand by'],
["Forseti", '*', 9, 19, 4, 'stand by'],
["Odin", '*', 10, 25, 11, 'stand by'],
[0, '*', 11, 34, 7, 'stand by'],
[0, '*', 12, 19, 4, 'stand by'],
[0, '*', 13, 21, 8, 'stand by'],
[0, '*', 14, 26, 2, 'stand by'],
["Vidar", '*', 15, 10, 6, 'stand by'],
[0, '*', 16, 50, 14, 'stand by'],
[0, '*', 17, 36, 14, 'stand by'],
[0, '*', 18, 30, 9, 'stand by'],
[0, '*', 19, 28, 7, 'stand by'],
[0, '*', 20, 39, 9, 'stand by'],
)

View File

@ -2,13 +2,15 @@ from idk_lib import *
try:
import dlc_idk as dlc
spells = dlc.spells
spells_level = dlc.spells_level
spells_effect = dlc.spells_effect
weapons = dlc.weapons
armors = dlc.armors
spells = dlc.dlc_spells
spells_level = dlc.dlc_spells_level
spells_effect = dlc.dlc_spells_effect
weapons = dlc.dlc_weapons
armors = dlc.dlc_armors
dlc_entities = dlc.dlc_entities
except:
dlc = None
dlc_entities = []
@ -36,8 +38,8 @@ def npc(data, stat, entities, identifiant):
if dlc:
event = dlc.npc(data, stat, entities, identifiant)
if event: return event
event = dlc.dlc_npc(data, stat, entities, identifiant)
if event: return "dlc", event
return npc_core(npc_data[data[1]], data, stat, entities, identifiant)
@ -62,10 +64,12 @@ def point_of_interest(data, stat, entities, identifiant):
else: return event
entities = asgard_entities + vanaheim_entities + alfheim_entities + midgard_entities + niflheim_entities + jotunheim_entities + nidavellir_entities + muspellheim_entities + svartalfheim_entities + dlc_entities
print(center("Island of the Dead", 21, " "))
print(center("* Kings *", 21, " "))
print("---------------------")
if dlc: print(center("DLC : {}".format(dlc.title), 21, " "))
if dlc: print(center("DLC : {}".format(dlc.dlc_title), 21, " "))
else: print()
print("Entrez 'idk()' pour\nune nouvelle partie.")
events = {"*": npc, "?": point_of_interest}
@ -84,7 +88,7 @@ def idk(save_code=None):
else:
stat, data = decode_save(save_code)
idk_game = Asci(maps, events, keys)
idk_game = Asci(maps, entities, events, keys)
stat, data = idk_game.mainloop(102, stat, data, routine=routine, door="^_", walkable=".,`' ", exit_key="q")
if stat[9] != -1: data[0]["main"] -= stat[9]
@ -106,8 +110,8 @@ def shop_interaction(data, stat, nb_choice, *events):
# - - - Asgard - - - #
def asgard_po(coords, identifiant):
if identifiant == "valaskjalf": return [0, "De hautes montagnes vous entourent de toutes part. Taillees dans la roche enneigee, les marches de l'escalier qui mene a Valaskjalf se decoupent nettement. La grande demeure d'Odin et son toit d'argent domine les environs."]
elif identifiant == "jardin sud": return [0, "Tout autour de vous s'etend un riche jardin soigneusement entretenu. Dans l'alignement de l'allee nord, une fontaine complete l'ensemble. Une douce odeur de verdure emplit vos narines, l'ambiance est calme."]
if coords == (120, 26): return [0, "De hautes montagnes vous entourent de toutes part. Taillees dans la roche enneigee, les marches de l'escalier qui mene a Valaskjalf se decoupent nettement. La grande demeure d'Odin et son toit d'argent domine les environs."]
elif coords == (51, 55): return [0, "Tout autour de vous s'etend un riche jardin soigneusement entretenu. Dans l'alignement de l'allee nord, une fontaine complete l'ensemble. Une douce odeur de verdure emplit vos narines, l'ambiance est calme."]
def asgard_npc(data, stat, entites, identifiant):
@ -345,7 +349,7 @@ def vanaheim_npc(data, stat, entites, identifiant):
4: [2, "Bien sur, voila. [+50 PO]", 0, (1, 50)],
}
if identifiant == "charretier":
if identifiant == "vanaheim_charretier":
if stat[9] == -1 or data[0]["main"] == stat[9]:
stat[9] = data[0]["main"]
return [0, "[LE CONDUCTEUR DE LA CHARRETTE SE TOURNA VERS VOUS] Ou voulez-vous aller ? Je vous emmene pour 5 pieces.\n1. Midgard\n2. Jotunheim\n3. Alfheim", 3]
@ -365,7 +369,7 @@ def vanaheim_npc(data, stat, entites, identifiant):
def h_21_npc(data, stat, entites, identifiant):
coords = data[2], data[3]
if identifiant == "aubergiste":
if identifiant == "vanaheim_aubergiste":
if stat[9] == -1 or data[0]["main"] == stat[9]:
stat[9] = data[0]["main"]
return [0, "Cher client bonjour ! Que puis-je faire pour vous ?\n1. Manger [5 PO]\n2. Boire [2 PO]\n3. Dormir [10 PO]", 3]
@ -486,7 +490,7 @@ def alfheim_npc(data, stat, entites, identifiant):
# * : (46; 6)
# * : (23; 17)
# * : (27; 54)
if identifiant == "charretier":
if identifiant == "alfheim_charretier":
if stat[9] == -1 or data[0]["main"] == stat[9]:
stat[9] = data[0]["main"]
return [0, "[LE CONDUCTEUR DE LA CHARRETTE SE TOURNA VERS VOUS] Ou voulez-vous aller ? Je vous emmene pour 5 pieces.\n1. Midgard\n2. Asgard\n3. Vanaheim\n4. Svartalfheim", 4]
@ -666,7 +670,7 @@ def midgard_npc(data, stat, entites, identifiant):
55: [-4, "C'est bien, passez. [ALORS QUE VOUS PASSIEZ A COTE DE IROB, UNE VIVE DOULEUR VOUS PRIT L'ABDOMEN, LE SANG ET LES CHAIRS SE REPANDIRENT SUR VOS MAINS ET VOTRE INCOMPREHENSION.]"],
}
elif identifiant == "charretier":
elif identifiant == "midgard_charretier":
if stat[9] == -1 or data[0]["main"] == stat[9]:
stat[9] = data[0]["main"]
return [0, "[LE CONDUCTEUR DE LA CHARRETTE SE TOURNA VERS VOUS] Ou voulez-vous aller ? Je vous emmene pour 5 pieces.\n1. Vanaheim\n2. Asgard\n3. Nidavellir\n4. Niflheim", 4]
@ -885,7 +889,7 @@ def h_35_npc(data, stat, entites, identifiant):
def h_36_npc(data, stat, entites, identifiant):
coords = data[2], data[3]
if identifiant == "aubergiste":
if identifiant == "jotunheim_aubergiste":
if not (300 <= stat[4] <= 1380): return [0, "Je suis desole, nous somme ferme la nuit."]
if stat[9] == -1 or data[0]["main"] == stat[9]:
@ -1022,7 +1026,7 @@ def muspellheim_npc(data, stat, entites, identifiant):
def h_42_npc(data, stat, entites, identifiant):
coords = data[2], data[3]
if identifiant == "aubergiste":
if identifiant == "muspellheim_aubergiste":
if not (300 <= stat[4] <= 1380): return [0, "Nous sommes ouverts de 5 a 23 heures."]
if stat[9] == -1 or data[0]["main"] == stat[9]:

View File

@ -359,9 +359,6 @@ def spell(data, stat):
def quick_save(data, stat):
data_copy = data[:]
data_copy[2] += 10
data_copy[3] += 3
stat_copy = stat[:-1]
print_text("\"{}\"".format(encode_save(data_copy, stat_copy)))

View File

@ -124,26 +124,6 @@ jotunheim = (r"""
~~~~~~~~ |____| ~~~~~~~~~~~~~~ |_| ##### ### |_| ##### |_| ##### |--| #### ~~~~~~~~~~
~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~ ### |_| ### ~~~~ ### |--| ~~~~~~~~~~~~~
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|_| ~~~~~~~~~~~~~~~~|_| ~~~~~~~~~|_|~~~~~~~~~~~~|--|~~~~~~~~~~~~~~""",
[
(0, '?', 60, 57, 'stand by'),
(1, '?', 23, 70, 'stand by'),
(2, '?', 60, 86, 'stand by'),
("Utarg", '*', 34, 56, 'stand by'),
(3, '*', 25, 10, 'stand by'),
(4, '*', 39, 20, 'stand by'),
(5, '*', 3, 28, 'stand by'),
(6, '*', 34, 45, 'stand by'),
(7, '*', 53, 49, 'stand by'),
(8, '*', 19, 51, 'stand by'),
(9, '*', 64, 64, 'stand by'),
(10, '*', 54, 70, 'stand by'),
(11, '*', 8, 72, 'stand by'),
(12, '*', 40, 75, 'stand by'),
(13, '*', 72, 87, 'stand by'),
(14, '*', 6, 98, 'stand by'),
],
# Autres mondes (Jotunheim = 5)
(11, 120, 1, 56, 42), # Vanaheim
@ -174,9 +154,6 @@ h_31 = (r"""
| | |
| | | |
|============|====|^|====|=============|""",
[
(0, '*', 28, 4, 'stand by'),
],
(19, 14, 5, 29, 11))
@ -206,9 +183,6 @@ h_32 = (r"""
| |
|============| |==============|
|============|^|==============| """,
[
(0, '*', 28, 6, 'stand by'),
],
(14, 24, 5, 88, 25))
@ -238,10 +212,6 @@ h_33 = (r"""
| |
|============================| |===========================|
|=[]=[]=[]=[]=[]=[]=[]=[]=[]=|^|=[]=[]=[]=[]=[]=[]=[]=[]=[]|""",
[
(0, '*', 14, 7, 'stand by'),
(1, '*', 48, 5, 'stand by'),
],
(30, 24, 5, 89, 45))
@ -276,9 +246,6 @@ h_34 = (r"""
|==|II|================|II| |II|================|II|==|
|II| |II| |II| |II|
|II| |II|/|^=|\|II| |II| """,
[
("Thrym", '*', 26, 6, 'stand by'),
],
(34, 29, 5, 60, 50))
@ -303,9 +270,6 @@ h_35 = (r"""
| |
|======================\ /======================|
|==|/\|=|/\|=|/\|=|/\|=/^^\=|/\|=|/\|=|/\|=|/\|==|""",
[
("Gullveig", '*', 17, 5, 'stand by'),
],
(24, 19, 5, 64, 85),
(25, 19, 5, 65, 85))
@ -326,10 +290,33 @@ h_36 = (r"""
| +---+ +---+ | | [====] [====] |
| | | [====] [====] |
|=================|^^|=================|""",
[
("aubergiste", '*', 27, 10, 'stand by'),
(0, '*', 0, 0, 'stand by'),
(1, '*', 0, 0, 'stand by'),
],
(19, 14, 5, 23, 88),
(20, 14, 5, 23, 88))
(20, 14, 5, 23, 88))
jotunheim_entities = (
[0, '?', 5, 60, 57, 'stand by'],
[0, '?', 5, 23, 70, 'stand by'],
[0, '?', 5, 60, 86, 'stand by'],
["Utarg", '*', 5, 34, 56, 'stand by'],
[0, '*', 5, 25, 10, 'stand by'],
[0, '*', 5, 39, 20, 'stand by'],
[0, '*', 5, 3, 28, 'stand by'],
[0, '*', 5, 34, 45, 'stand by'],
[0, '*', 5, 53, 49, 'stand by'],
[0, '*', 5, 19, 51, 'stand by'],
[0, '*', 5, 64, 64, 'stand by'],
[0, '*', 5, 54, 70, 'stand by'],
[0, '*', 5, 8, 72, 'stand by'],
[0, '*', 5, 40, 75, 'stand by'],
[0, '*', 5, 72, 87, 'stand by'],
[0, '*', 5, 6, 98, 'stand by'],
[0, '*', 31, 28, 4, 'stand by'],
[0, '*', 32, 28, 6, 'stand by'],
[0, '*', 33, 14, 7, 'stand by'],
[0, '*', 33, 48, 5, 'stand by'],
["Thrym", '*', 34, 26, 6, 'stand by'],
["Gullveig", '*', 35, 17, 5, 'stand by'],
["jotunheim_aubergiste", '*', 36, 27, 10, 'stand by'],
[0, '*', 36, 0, 0, 'stand by'],
[0, '*', 36, 0, 0, 'stand by'],
)

View File

@ -99,23 +99,6 @@ midgard = (r"""
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~""",
[
("falaises nord", '?', 29, 9, 'stand by'),
("clairiere", '?', 53, 24, 'stand by'),
("palais", '?', 66, 45, 'stand by'),
("manoir sud", '?', 52, 79, 'stand by'),
("charretier", '*', 39, 49, 'stand by'),
(0, '*', 8, 59, 'stand by'),
(1, "*", 66, 56, "stand by"),
(2, '*', 67, 46, 'stand by'),
(3, '*', 66, 56, 'stand by'),
(4, '*', 51, 60, 'stand by'),
(5, '*', 68, 71, 'stand by'),
(6, '*', 94, 85, 'stand by')
],
# Autres mondes (Migard = 3)
(72, 6, 0, 126, 71), # Asgard
(77, 62, 6, 93, 8), # Nidavellir
@ -149,7 +132,6 @@ h_25 = (r"""
| |==============================|
| |=|\/|=|\/|=|\/|=|\/|=|\/|=|\/||
|\/|^|\/| """,
[],
(4, 16, 3, 42, 49))
@ -167,13 +149,6 @@ h_26 = (r"""
| |------------------|
| |
|---|^|---| """,
[
("Rosahil Green", '*', 27, 6, 'stand by'),
(0, '*', 17, 7, 'stand by'),
(1, '*', 22, 7, 'stand by'),
(2, '*', 17, 8, 'stand by'),
(3, '*', 27, 8, 'stand by'),
],
(5, 12, 3, 76, 51))
@ -195,7 +170,6 @@ h_27 = (r"""
| + | |_| |
| | | |_| |
|=======|^|=======| """,
[],
(9, 16, 3, 44, 65))
@ -215,8 +189,25 @@ h_28 = (r"""
|\/|=|\/|=|\/| | | |\/|=|\/|=|\/|
|__+ +__|
|\/|^^|\/| """,
[
(0, '*', 27, 6, 'stand by'),
],
(24, 14, 3, 60, 69),
(25, 14, 3, 61, 69))
(25, 14, 3, 61, 69))
midgard_entities = (
[0, '?', 3, 29, 9, 'stand by'],
[0, '?', 3, 53, 24, 'stand by'],
[0, '?', 3, 66, 45, 'stand by'],
[0, '?', 3, 52, 79, 'stand by'],
["midgard_charretier", '*', 3, 39, 49, 'stand by'],
[0, '*', 3, 8, 59, 'stand by'],
[0, '*', 3, 66, 56, "stand by"],
[0, '*', 3, 67, 46, 'stand by'],
[0, '*', 3, 66, 56, 'stand by'],
[0, '*', 3, 68, 71, 'stand by'],
[0, '*', 3, 94, 85, 'stand by'],
["Rosahil Green", '*', 26, 27, 6, 'stand by'],
[0, '*', 26, 17, 7, 'stand by'],
[0, '*', 26, 22, 7, 'stand by'],
[0, '*', 26, 17, 8, 'stand by'],
[0, '*', 26, 27, 8, 'stand by'],
[0, '*', 28, 27, 6, 'stand by'],
)

View File

@ -119,18 +119,6 @@ muspellheim = (r"""
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~""",
[
("cote nord", '?', 66, 8, 'stand by'),
("manoir", '?', 65, 97, 'stand by'),
(0, '*', 20, 12, 'stand by'),
(1, '*', 78, 14, 'stand by'),
(2, '*', 54, 80, 'stand by'),
(3, '*', 59, 91, 'stand by'),
(4, '*', 39, 94, 'stand by'),
(5, '*', 29, 113, 'stand by'),
],
# Autres mondes (Muspellheim = 7)
(92, 9, 6, 9, 57), # Nidavellir
@ -158,13 +146,6 @@ h_42 = (r"""
| |
| |
|==============|^|================|""",
[
("aubergiste", '*', 6, 7, 'stand by'),
(0, '*', 14, 1, 'stand by'),
(1, '*', 11, 5, 'stand by'),
(2, '*', 2, 11, 'stand by'),
(3, '*', 31, 9, 'stand by'),
],
(16, 14, 7, 87, 14))
@ -184,11 +165,6 @@ h_43 = (r"""
| |
| |
|[^]|""",
[
("Berfrid", '*', 24, 4, 'stand by'),
(0, '*', 13, 9, 'stand by'),
(1, '*', 6, 5, 'stand by'),
],
(32, 14, 7, 47, 53))
@ -218,9 +194,26 @@ h_44 = (r"""
| [========] [========] |
|=|/\|==|/\|=|/\|=|/\|=| |=|/\|=|/\|=|/\|==|/\|=|
|=|\/|==|\/|=|\/|=|\/|=|^^|=|\/|=|\/|=|\/|==|\/|=|""",
[
(0, '*', 13, 20, 'stand by'),
(1, '*', 13, 2, 'stand by'),
],
(24, 24, 7, 67, 89),
(25, 24, 7, 68, 89))
(25, 24, 7, 68, 89))
muspellheim_entities = (
[0, '?', 7, 66, 8, 'stand by'],
[0, '?', 7, 65, 97, 'stand by'],
[0, '*', 7, 20, 12, 'stand by'],
[0, '*', 7, 78, 14, 'stand by'],
[0, '*', 7, 54, 80, 'stand by'],
[0, '*', 7, 59, 91, 'stand by'],
[0, '*', 7, 39, 94, 'stand by'],
[0, '*', 7, 29, 113, 'stand by'],
["muspellheim_aubergiste", '*', 42, 6, 7, 'stand by'],
[0, '*', 42, 14, 1, 'stand by'],
[0, '*', 42, 11, 5, 'stand by'],
[0, '*', 42, 2, 11, 'stand by'],
[0, '*', 42, 31, 9, 'stand by'],
["Berfrid", '*', 43, 24, 4, 'stand by'],
[0, '*', 43, 13, 9, 'stand by'],
[0, '*', 43, 6, 5, 'stand by'],
[0, '*', 44, 13, 20, 'stand by'],
[0, '*', 44, 13, 2, 'stand by'],
)

View File

@ -74,17 +74,6 @@ nidavellir = (r"""
/ \ / \ / \ /\ /\ / / \ / / \ / \
/ / \ / \ / \ /\ / \ /\ / \/ / /
/ / \ / / \ / \/ \ / \ /\ / / """,
[
("plage", '?', 65, 7, 'stand by'),
("montanges", '?', 66, 58, 'stand by'),
(0, '*', 49, 21, 'stand by'),
(1, '*', 25, 31, 'stand by'),
(2, '*', 74, 46, 'stand by'),
(3, '*', 16, 55, 'stand by'),
(4, '*', 77, 61, 'stand by'),
],
# Autres mondes (Nidavellir = 6)
(93, 8, 3, 77, 62), # Midgard
(9, 57, 7, 92, 9), # Muspellheim
@ -126,13 +115,6 @@ h_37 = (r"""
| |__| | | |
| | | |
|=============|^|============|""",
[
("Muin", '*', 2, 1, 'stand by'),
(0, '*', 26, 1, 'stand by'),
(1, '*', 10, 5, 'stand by'),
(2, '*', 4, 10, 'stand by'),
(3, '*', 27, 8, 'stand by'),
],
(15, 14, 6, 69, 26))
@ -152,10 +134,6 @@ h_38 = (r"""
| |
| |
|===|^|===| """,
[
(0, '*', 12, 3, 'stand by'),
(1, '*', 19, 7, 'stand by'),
],
(15, 14, 6, 7, 31))
@ -175,10 +153,6 @@ h_39 = (r"""
| |_| |_| |
| |
|=|/\|=|/\|==|^|===|/\|=|/\|=|""",
[
(0, '*', 9, 2, 'stand by'),
(1, '*', 9, 4, "stand by"),
],
(14, 14, 6, 35, 38))
@ -198,9 +172,6 @@ h_40 = (r"""
| |
|=========| |==============|
|==========|^|===============|""",
[
(0, '*', 14, 5, 'stand by'),
],
(12, 14, 6, 22, 22))
@ -225,8 +196,26 @@ h_41 = (r"""
| |_| /|\ |
| |
|========|^|=======|""",
[
(0, '*', 10, 8, 'stand by'),
(1, '*', 12, 2, 'stand by'),
],
(10, 19, 6, 23, 51))
(10, 19, 6, 23, 51))
nidavellir_entities = (
[0, '?', 6, 65, 7, 'stand by'],
[0, '?', 6, 66, 58, 'stand by'],
[0, '*', 6, 49, 21, 'stand by'],
[0, '*', 6, 25, 31, 'stand by'],
[0, '*', 6, 74, 46, 'stand by'],
[0, '*', 6, 16, 55, 'stand by'],
[0, '*', 6, 77, 61, 'stand by'],
["Muin", '*', 37, 2, 1, 'stand by'],
[0, '*', 37, 26, 1, 'stand by'],
[0, '*', 37, 10, 5, 'stand by'],
[0, '*', 37, 4, 10, 'stand by'],
[0, '*', 37, 27, 8, 'stand by'],
[0, '*', 38, 12, 3, 'stand by'],
[0, '*', 38, 19, 7, 'stand by'],
[0, '*', 39, 9, 2, 'stand by'],
[0, '*', 39, 9, 4, "stand by"],
[0, '*', 40, 14, 5, 'stand by'],
[0, '*', 41, 10, 8, 'stand by'],
[0, '*', 41, 12, 2, 'stand by'],
)

View File

@ -74,15 +74,6 @@ _\ /_\ ### ', |+| ___ ' '. ``,..' '.`.`
### /_\ ##### ##### /_\ ##### ##### ### ### ### ##### /_\ ##### ##### ### ### ###
##### ##### ### ### ### /_\ /_\##### ### ### ##### /_\ /_\ /_\
##### ### /_\ /_\ /_\ ##### /_\ /_\ ### """,
[
("niflheim", '?', 88, 32, 'stand by'),
(0, '*', 95, 30, 'stand by'),
(1, '*', 57, 31, 'stand by'),
(3, '*', 39, 60, 'stand by'),
(4, '*', 108, 67, 'stand by'),
],
# Autres monde (Niflheim = 4)
(78, 19, 3, 24, 90), # Midgard
@ -109,9 +100,6 @@ h_29 = (r"""
| [===] [=-=] [==] [-==] |
| |
|=============|^|============|""",
[
("Merath", '*', 5, 5, 'stand by'),
],
(15, 14, 4, 38, 21))
@ -136,9 +124,16 @@ h_30 = (r"""
| |__| |__| |
| |========| |========| |
|=============| |^^| |=============|""",
[
("Hel", '*', 37, 4, 'stand by'),
(0, '*', 17, 6, 'stand by'),
],
(24, 19, 4, 70, 31),
(25, 19, 4, 71, 31))
(25, 19, 4, 71, 31))
niflheim_entities = (
[0, '?', 4, 88, 32, 'stand by'],
[0, '*', 4, 95, 30, 'stand by'],
[0, '*', 4, 57, 31, 'stand by'],
[0, '*', 4, 39, 60, 'stand by'],
[0, '*', 4, 108, 67, 'stand by'],
["Merath", '*', 29, 5, 5, 'stand by'],
["Hel", '*', 30, 37, 4, 'stand by'],
[0, '*', 30, 17, 6, 'stand by'],
)

View File

@ -74,17 +74,6 @@ svartalfheim = (r"""
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~ ~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~ /-\ ~~~
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~""",
[
("svartalfheim", '?', 113, 37, 'stand by'),
(0, '*', 104, 30, 'stand by'), (1, '*', 120, 49, 'stand by'),
(2, '*', 105, 46, 'stand by'),
(3, '*', 22, 50, 'stand by'),
(4, '*', 15, 54, 'stand by'),
(5, '*', 25, 61, 'stand by'),
(6, '*', 121, 68, 'stand by'),
],
# Autres mondes (Svartalfheim = 8)
(109, 66, 6, 39, 19), # Nidavellir
@ -117,9 +106,6 @@ h_45 = (r"""
| |====| |====| |
|=================| | | |==================|
|^| """,
[
(0, '*', 15, 4, 'stand by'),
],
(24, 19, 8, 90, 15))
@ -134,10 +120,6 @@ h_46 = (r"""
| |
| |
|=======|^|========|""",
[
(0, '*', 13, 2, 'stand by'),
(1, '*', 13, 4, 'stand by'),
],
(9, 9, 8, 6, 24))
@ -157,10 +139,6 @@ h_47 = (r"""
| |__| |__| |
| |
|^|==========================|""",
[
(0, '*', 3, 4, 'stand by'),
(1, '*', 15, 8, 'stand by'),
],
(1, 14, 8, 91, 33))
@ -180,8 +158,21 @@ h_48 = (r"""
| \__/ \__/ \__/ \__/ |
|==| |======| |=| |=| |======| |==|
| | | | |^=| | | | | """,
[
(0, '*', 34, 5, 'stand by'),
(1, '*', 29, 8, 'stand by'),
],
(19, 14, 8, 57, 59))
svartalfheim_entities = (
[0, '?', 8, 113, 37, 'stand by'],
[0, '*', 8, 104, 30, 'stand by'], [0, '*', 8, 120, 49, 'stand by'],
[0, '*', 8, 105, 46, 'stand by'],
[0, '*', 8, 22, 50, 'stand by'],
[0, '*', 8, 15, 54, 'stand by'],
[0, '*', 8, 25, 61, 'stand by'],
[0, '*', 8, 121, 68, 'stand by'],
[0, '*', 45, 15, 4, 'stand by'],
[0, '*', 46, 13, 2, 'stand by'],
[0, '*', 46, 13, 4, 'stand by'],
[0, '*', 47, 3, 4, 'stand by'],
[0, '*', 47, 15, 8, 'stand by'],
[0, '*', 48, 34, 5, 'stand by'],
[0, '*', 48, 29, 8, 'stand by'],
)

View File

@ -49,17 +49,6 @@ vanaheim = (r"""
/ \ / \ /\ / / \ / \ / \ / \ / \
/ \ / / \ / / \
/ \ / \ / \ """,
[
("vanaheim", '?', 42, 20, 'stand by'),
(0, '?', 26, 29, 'stand by'),
("charretier", '*', 45, 39, 'stand by'),
(1, '*', 31, 12, 'stand by'),
(2, '*', 41, 45, 'stand by'),
(3, '*', 52, 22, 'stand by'),
(4, '*', 52, 30, 'stand by'),
],
# Autres mondes (Vanaheim = 1)
(28, 13, 2, 14, 68), # Alfheim
(54, 29, 3, 10, 58), # Midgard
@ -83,10 +72,6 @@ h_21 = (r"""
| |
| |
|===|^|=================|""",
[
("aubergiste", '*', 8, 1, 'stand by'),
(0, '*', 21, 6, 'stand by'),
],
(5, 9, 1, 44, 11))
@ -111,8 +96,18 @@ h_22 = (r"""
| | | |
|/\=/\=/\=/\=/\=/\=| |=/\=/\=/\=/\=/\==|
|\/=\/=\/=\/=\/=\/=]^[=\/=\/=\/=\/=\/==|""",
[
("Freyja", '*', 2, 8, 'stand by'),
("Freyr", '*', 36, 3, 'stand by'),
],
(20, 19, 1, 52, 35))
vanaheim_entities = (
[0, '?', 1, 42, 20, 'stand by'],
[0, '?', 1, 26, 29, 'stand by'],
["vanaheim_charretier", '*', 1, 45, 39, 'stand by'],
[0, '*', 1, 31, 12, 'stand by'],
[0, '*', 1, 41, 45, 'stand by'],
[0, '*', 1, 52, 22, 'stand by'],
[0, '*', 1, 52, 30, 'stand by'],
["vanaheim_aubergiste", '*', 21, 8, 1, 'stand by'],
[0, '*', 21, 21, 6, 'stand by'],
["Freyja", '*', 22, 2, 8, 'stand by'],
["Freyr", '*', 22, 36, 3, 'stand by'],
)

View File

@ -19,7 +19,6 @@ def convert_to_string(filename, doors, entities):
doors_coords = []
entities_data = []
entities_count = 0
output = r""
for line_index, line in enumerate(data):
for char_index, char_id in enumerate(line):
@ -28,8 +27,8 @@ def convert_to_string(filename, doors, entities):
output += char_list[char_id]
else:
output += " "
entities_data.append(f"({entities_count}, '{char_list[char_id]}', {char_index}, {line_index}, 'stand_by'),")
entities_count += 1
entities_data.append(f"[None, '{char_list[char_id]}', , {char_index}, {line_index}, 'stand_by'],")
if char_list[char_id] in doors:
doors_coords.append(f"\t({char_index}, {line_index}, , 0, 0),")
@ -37,10 +36,10 @@ def convert_to_string(filename, doors, entities):
output += "\n"
doors_coords = "\n".join(doors_coords)
entities_data = "[\n\t" + "\n\t".join(entities_data) + "\n]"
entities_data = "(\n\t" + "\n\t".join(entities_data) + "\n)"
with open(f"{output_filename}.py", "w") as file:
file.write(f"{output_filename} = (r\"\"\"\n{output[:-1]}\"\"\",\n{entities_data},\n\n{doors_coords}\n)")
file.write(f"{output_filename} = (r\"\"\"\n{output[:-1]}\"\"\",\n{doors_coords}\n)\n\n{output_filename}_entities = {entities_data}")
filename, doors, misc = argv[1], "", ""