diff --git a/generateur_scenario.py b/gen_sce old mode 100644 new mode 100755 similarity index 80% rename from generateur_scenario.py rename to gen_sce index 052c4e7..82b3d66 --- a/generateur_scenario.py +++ b/gen_sce @@ -1,4 +1,8 @@ -def generateur_scenario(nom): +#! /usr/bin/env python3 + +from sys import argv + +def nouveau_scenario(nom): functions = ( "asgard_po", "asgard_npc", @@ -58,9 +62,10 @@ def generateur_scenario(nom): "h_47_npc", "h_48_npc") - default_content = f""" + default_content = """from idk_lib import * + try: - import dlc_{nom} as dlc + import dlc_{0} as dlc spells = dlc.dlc_spells spells_level = dlc.dlc_spells_level spells_effect = dlc.dlc_spells_effect @@ -125,31 +130,31 @@ def point_of_interest(data, stat, entities, identifiant): entities = asgard_entities + vanaheim_entities + alfheim_entities + midgard_entities + niflheim_entities + jotunheim_entities + nidavellir_entities + muspellheim_entities + svartalfheim_entities + dlc_entities -print(center("{nom}", 21, " ")) -print("Entrez '' pour\nune nouvelle partie.") -events = {"*": npc, "?": point_of_interest} -keys = {4: display_stat, 7: spell, 8: misc_stat, 6: inventory, 9: sleep, "s": quick_save} +print(center("{0}", 21, " ")) +print("Entrez '{0}()' pour\\nune nouvelle partie.") +events = {{"*": npc, "?": point_of_interest}} +keys = {{4: display_stat, 7: spell, 8: misc_stat, 6: inventory, 9: sleep, "s": quick_save}} -def {nom}(save_code=None): +def {0}(save_code=None): # stat = [0 - PV, 1 - pièces d'or, 2 - [vitesse, agilité, attaque, defense, magie], 3 - [arme, armure], 4 - ticks, 5 - nom, 6 - classe, 7 - sorts connus : (id, level), 8 - sous-quêtes terminées] if not save_code: stat = init_stat() name = stat[5] - data = [{"main": 0}, 3, 44, 66] + data = [{{"main": 0}}, 3, 44, 66] print_text("introduction") else: stat, data = decode_save(save_code) idk_game = Asci(maps, entities, events, keys) - stat, data = idk_game.mainloop(1, stat, data, routine=routine, door="^_", walkable=".,`' ", exit_key="q") + stat, data = idk_game.mainloop(1, stat, data, routine=routine, low_bar=low_bar, door="^_", walkable=".,`' ", exit_key="q") if stat[9] != -1: data[0]["main"] -= stat[9] if data[0]["main"] == 1: print_text("conclusion") else: - print("{nom}(\"\{\}\")".format(encode_save(data, stat[:-1]))) + print("{0}(\\"{{}}\\")".format(encode_save(data, stat[:-1]))) # Scenario @@ -159,5 +164,16 @@ def shop_interaction(data, stat, nb_choice, *events): stat[9] = -1 if stat[1] < events[choice][0]: return events[choice][2], choice + 1 else: return events[choice][1], choice + 1 - """ +""".format(nom) + for fn in functions: + if fn.endswith("_po"): + default_content += f"\n\n\n# - - - {fn[:-3].title()} - - - #\ndef {fn}(coords, identifiant):\n pass" + else: + default_content += f"\n\n\ndef {fn}(data, stat, entites, identifiant):\n pass" + + with open(f"{nom}.py", "w") as file: + file.write(default_content) + + +nouveau_scenario(argv[1]) \ No newline at end of file diff --git a/scenario_vierge.py b/scenario_vierge.py deleted file mode 100644 index c94869b..0000000 --- a/scenario_vierge.py +++ /dev/null @@ -1,635 +0,0 @@ -from idk_lib import * - -try: - import dlc_scenario as dlc - 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 = () - - - -# Game -def npc(data, stat, entities, identifiant): - npc_data = ( - asgard_npc, - vanaheim_npc, - alfheim_npc, - midgard_npc, - niflheim_npc, - jotunheim_npc, - nidavellir_npc, - muspellheim_npc, - svartalfheim_npc, - h_9_npc, h_10_npc, h_11_npc, h_12_npc, h_13_npc, h_14_npc, h_15_npc, h_16_npc, h_17_npc, h_18_npc, h_19_npc, h_20_npc, - h_21_npc, h_22_npc, - h_23_npc, h_24_npc, - h_25_npc, h_26_npc, h_27_npc, h_28_npc, - h_29_npc, h_30_npc, - h_31_npc, h_32_npc, h_33_npc, h_34_npc, h_35_npc, h_36_npc, - h_37_npc, h_38_npc, h_39_npc, h_40_npc, h_41_npc, - h_42_npc, h_43_npc, h_44_npc, - h_45_npc, h_46_npc, h_47_npc, h_48_npc) - - - if dlc: - event = dlc.dlc_npc(data, stat, entities, identifiant) - if event: return "dlc", event - - return npc_core(npc_data[data[1]], data, stat, entities, identifiant) - - -def point_of_interest(data, stat, entities, identifiant): - po_data = ( - asgard_po, - vanaheim_po, - alfheim_po, - midgard_po, - niflheim_po, - jotunheim_po, - nidavellir_po, - muspellheim_po, - svartalfheim_po - ) - - coords = data[2], data[3] - event = po_data[data[1]](coords, identifiant) - - if not event: return [0, "Il n'y a rien à voir ici."] - 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("") -print("Entrez '' pour\nune nouvelle partie.") -events = {"*": npc, "?": point_of_interest} -keys = {4: display_stat, 7: spell, 8: misc_stat, 6: inventory, 9: sleep, "s": quick_save} - - -def scenario(save_code=None): - # stat = [0 - PV, 1 - pièces d'or, 2 - [vitesse, agilité, attaque, defense, magie], 3 - [arme, armure], 4 - ticks, 5 - nom, 6 - classe, 7 - sorts connus : (id, level), 8 - sous-quêtes terminées] - if not save_code: - stat = init_stat() - name = stat[5] - data = [{"main": 0}, 3, 44, 66] - - print_text("introduction") - else: - stat, data = decode_save(save_code) - - idk_game = Asci(maps, entities, events, keys) - stat, data = idk_game.mainloop(1, stat, data, routine=routine, door="^_", walkable=".,`' ", exit_key="q") - if stat[9] != -1: data[0]["main"] -= stat[9] - - if data[0]["main"] == 1: - print_text("conclusion") - else: - print("idk(\"{}\")".format(encode_save(data, stat[:-1]))) - - -# Scenario -def shop_interaction(data, stat, nb_choice, *events): - for choice in range(nb_choice): - if data[0]["main"] == stat[9] + choice + 1: - stat[9] = -1 - if stat[1] < events[choice][0]: return events[choice][2], choice + 1 - else: return events[choice][1], choice + 1 - - -# - - - Asgard - - - # -def asgard_po(coords, identifiant): - pass - - -def asgard_npc(data, stat, entites, identifiant): - coords = data[2], data[3] - # * : ( 34, 7) - # * : ( 29, 13) - # * : ( 19, 20) - # * : (121, 21) - # * : ( 28, 26) - # * : (117, 32) - # * : ( 46, 35) - # * : ( 57, 38) - # * : ( 82, 38) - # * : ( 22, 39) - # * : ( 8, 44) - # * : ( 58, 50) - # * : ( 83, 51) - # * : ( 32, 59) - # * : (104, 63) - # * : ( 46, 65) - # * : ( 16, 71) - # * : (138, 71) - pass - - -# Forseti -def h_9_npc(data, stat, entites, identifiant): - pass - - -# Odin -def h_10_npc(data, stat, entites, identifiant): - pass - -def h_11_npc(data, stat, entites, identifiant): - pass - - -def h_12_npc(data, stat, entites, identifiant): - pass - - -# Folkvangr -def h_13_npc(data, stat, entites, identifiant): - pass - - -def h_14_npc(data, stat, entites, identifiant): - pass - - -# Vidar -def h_15_npc(data, stat, entites, identifiant): - pass - - -def h_16_npc(data, stat, entites, identifiant): - pass - - -def h_17_npc(data, stat, entites, identifiant): - pass - - -def h_18_npc(data, stat, entites, identifiant): - pass - - -def h_19_npc(data, stat, entites, identifiant): - pass - - -def h_20_npc(data, stat, entites, identifiant): - pass - - -# - - - Vanaheim - - - # -def vanaheim_po(coords, identifiant): - pass - -def vanaheim_npc(data, stat, entites, identifiant): - pass - - -def h_22_npc(data, stat, entites, identifiant): - pass - - -# - - - Alfheim - - - # -def alfheim_po(coords, identifiant): - pass - -def alfheim_npc(data, stat, entites, identifiant): - # * : (11; 4) - # * : (46; 6) - # * : (23; 17) - # * : (27; 54) - pass - - -def h_23_npc(data, stat, entites, identifiant): - pass - -def h_24_npc(data, stat, entites, identifiant): - coords = data[2], data[3] - - if not (480 <= stat[4] <= 1140): return [0, "Excusez-moi, nous sommes fermes."] - - if coords == (12, 3): - if not stat[7]: return [0, "Je ne peux pas vous faire oublier ce que vous ne connaissez pas."] - - if stat[9] == -1 or data[0]["main"] == stat[9]: - stat[9] = data[0]["main"] - return [0, "Quel sort souhaitez-vous oublier ?\n" + "\n".join(["{0}. {1} {2}".format(nb + 1, spells[stat[7][nb][0]], spells_level[stat[7][nb][1] - 1]) for nb in range(len(stat[7]))]), len(stat[7])] - - else: - for i in range(1, len(stat[7]) + 1): - if data[0]["main"] == stat[9] + i: - stat[9] = -1 - stat[7].pop(i - 1) - pts = (20 * stat[0]) // 100 - return [-i, "Asseyez-vous, je vais vous faire oublier ce sort. [UN PUISSANT MAL DE TETE VOUS PRIT, LES MURS SEMBLERENT TANGUER TANDIS QUE VOTRE VUE DEVINT FLOUE. LE VERTIGE S'ESTOMPA PROGRESSIVEMENT.] Et voila ! [-{} PV]".format(pts), 0, (0, -pts)] - - if coords == (36, 12): - if len(stat[7]) >= 3: return [0, "Je suis desole, vous ne pouvez pas apprendre plus de trois sorts."] - - spells_sale = [] - formated_spells = "" - while len(spells_sale) < 3: - sp_id = randint(0, len(spells) - 1) - sp_lvl = randint(1, len(spells_level)) - - check = True - for sp in spells_sale: - if sp[0] == sp_id and sp[1] == sp_lvl: - check = False - break - - if check: - spells_sale.append((sp_id, sp_lvl)) - formated_spells += "{0}. {1} {2}\n".format(len(spells_sale), spells[sp_id], spells_level[sp_lvl - 1]) - - spell_choice = print_text("Diomwar, pour vous servir. Quel sort voulez-vous acheter ?\n{}".format(formated_spells), 1, 3, 0) - - if not spell_choice: return [0, "Hmm ?"] - - spell_sel = spells_sale[spell_choice - 1] - if stat[1] < 10 * spell_sel[1]: return [0, "Vous n'avez pas les moyens, desole."] - - spell_id = -1 - for sp_id in range(len(stat[7])): - sp = stat[7][sp_id] - if spell_sel[0] == sp[0]: - if spells_sel[1] <= sp[1]: return [0, "Vous connaissez deja ce sort."] - else: - spell_id = sp_id - break - - if spell_id == -1: - stat[7].append(spells_sale[i]) - else: - stat[7][spell_id] = spells_sale[i] - - return [0, "[DIOMWAR OUVRIT UN LIVRE RELIE DE CUIR NOIR, ET TRACA DU DOIGT DES SIGNES CABALISTIQUES SUR LE SOL. LES RUNES BRILLERENT PUISSAMMENT AVANT DE S'ETEINDRE.]", 0, (1, -10 * spells_sel[1])] - - -# - - - Midgard - - - # -def midgard_po(coords, identifiant): - pass - - -def midgard_npc(data, stat, entites, identifiant): - # (67, 46) - # (39, 49) - # (66, 56) - # (68, 71) - pass - - -def h_25_npc(data, stat, entites, identifiant): - pass - - -def h_26_npc(data, stat, entites, identifiant): - # * : (17, 7) - # * : (22, 7) - # * : (17, 8) - # * : (27, 8) - coords = data[2], data[3] - - if identifiant == "Rosahil Green": - if stat[4] >= 1320 or stat[4] <= 340: return [0, "Je suis desolee, nous sommes fermes. Revenez plus tard !"] - - if stat[9] == -1 or data[0]["main"] == stat[9]: - stat[9] = data[0]["main"] - return [0, "Rosahil Green, tenanciere de cette auberge. Vous desirez quelque chose ?\n1.De quoi manger s'il vous plait. [-5 PO]\n2.Je voudrais une chambre pour la nuit. [-10 PO]", 2] - else: - event, choice = shop_interaction(data, stat, 2, - (5, [-1, "Et voila pour vous ! [ROSAHIL POSA UNE ASSIETTE DE RAGOUT CHAUD DEVANT VOUS.]", 0, (0, 5), (1, -5)], [-1, "Reviens quand tu auras assez de pieces d'or."]), - (10, [-2, "Suivez-moi, je vais vous montrer votre chambre. [VOUS SUIVEZ ROSAHIL DANS L'AUBERGE, LA NUIT PASSA.]", 0, (0, 10), (1, -10), (4, 480)], [-2, "Je suis desolee, tu n'as pas assez !"])) - - if choice == 2 and 360 < stat[4] < 1140: return [-2, "Il est trop tot, revenez vers 19h."] - else: return event - - else: return [0, "Ui hips ?"] - - -def h_27_npc(data, stat, entites, identifiant): - pass - - -def h_28_npc(data, stat, entites, identifiant): - pass - - -# - - - Niflheim - - - # -def niflheim_po(coords, identifiant): - pass - - -def niflheim_npc(data, stat, entites, identifiant): - # * : (95, 30) - # * : (57, 31) - # * : (39, 60) - # * : (108, 67) - pass - - -def h_29_npc(data, stat, entites, identifiant): - coords = data[2], data[3] - - n = len(spells) - spells_sale = [(i, len(spells_level)) for i in range(n)] - formated_spells = "" - for sp in range(n): - formated_spells += "{0}. {1} {2}\n".format(sp + 1, spells[spells_sale[sp][0]], spells_level[spells_sale[sp][1] - 1]) - - if not (480 <= stat[4] <= 1140): return [0, "Je suis desolee, nous sommes fermes."] - - if coords == (5, 5): - if len(stat[7]) >= 3: return [0, "Vous ne pouvez pas apprendre plus de sort, et je ne pratique pas les sorts d'oubli. Je crois qu'une librairie vers Alfheim le fait gratuitement."] - - if stat[9] == -1 or data[0]["main"] == stat[9]: - stat[9] = data[0]["main"] - return [0, "Merath, je vend les sorts les plus puissants de tout l'Yggdrasil ! Quel sort voulez-vous ?\n{}".format(formated_spells), n] - - else: - for i in range(1, n + 1): - if data[0]["main"] == stat[9] + i: - stat[9] = -1 - if stat[1] < 50: return [-i, "Vous n'avez pas les moyens, desolee."] - - spell_id = -1 - for sp_id in range(len(stat[7])): - sp = stat[7][sp_id] - if spells_sale[i - 1][0] == sp[0]: - if spells_sale[i - 1][1] <= sp[1]: return [-i, "Vous connaissez deja ce sort."] - else: - spell_id = sp_id - break - - if spell_id == -1: - stat[7].append(spells_sale[i - 1]) - else: - stat[7][spell_id] = spells_sale[i - 1] - - return [-i, "[MERATH SE RETOURNA ET S'EMPARA D'UN GRIMOIRE. ELLE L'OUVRIT ET LUT A HAUTE VOIX. UNE LOURDE TORPEUR S'ABBATIT SUR VOUS. QUAND VOUS REPRENEZ PLEINEMENT CONSCIENCE, LE SORT EST GRAVE DANS VOTRE MEMOIRE.]", 0, (1, -50)] - - -def h_30_npc(data, stat, entites, identifiant): - pass - - -# - - - Jotunheim - - - # -def jotunheim_po(coords, identifiant): - pass - -def jotunheim_npc(data, stat, entites, identifiant): - # * : (25; 10) - # * : (39; 20) - # * : (3; 28) - # * : (34; 45) - # * : (53; 49) - # * : (19; 51) - # * : (34; 56) - # * : (64; 64) - # * : (54; 70) - # * : (8; 72) - # * : (40; 75) - # * : (72; 87) - # * : (6; 98) - pass - - -def h_31_npc(data, stat, entites, identifiant): - pass - - -def h_32_npc(data, stat, entites, identifiant): - pass - - -def h_33_npc(data, stat, entites, identifiant): - pass - - -def h_34_npc(data, stat, entites, identifiant): - pass - - -def h_35_npc(data, stat, entites, identifiant): - pass - - -def h_36_npc(data, stat, entites, identifiant): - coords = data[2], data[3] - - 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]: - stat[9] = data[0]["main"] - return [0, "Vous voulez quelque-chose ?\n1. Je mangerai bien un truc [-4 PO]\n2. Il vous reste une chambre ? [-12 PO]", 2] - - else: - event, choice = shop_interaction(data, stat, 2, - (4, [-1, "Et voila ! [LE TAVERNIER POSA UNE ASSIETTE FUMANTE DEVANT VOUS ET UN VERRE DE VIN]", 0, (0, 5), (1, -4)], [-1, "Reviens quand tu auras de quoi me payer."]), - (12, [-2, "Oui, au premier etage, au bout du couloir sur votre droite. [VOUS SUIVEZ LES INDICATIONS DU TAVERNIER ET TROUVEZ VOTRE CHAMBRE. VOUS SOMBREZ DANS LES BRAS DE NOTT.]", 0, (0, 15), (1, -12), (4, 480)], [-2, "Tu n'as pas assez."])) - - if choice == 2 and 360 < stat[4] < 1140: return [-2, "Il est trop tot, reviens vers 19h."] - else: return event - - -# - - - Nidavellir - - - # -def nidavellir_po(coords, identifiant): - pass - -def nidavellir_npc(data, stat, entites, identifiant): - # * : (49, 21) - # * : (25, 31) - # * : (74, 46) - # * : (16, 55) - # * : (77, 61) - pass - - -def h_37_npc(data, stat, entites, identifiant): - coords = data[2], data[3] - - if identifiant == "Muin": - if not (340 <= stat[4] <= 1380): return [0, "Nous sommes ouverts de 5 heures a 23."] - - if stat[9] == -1 or data[0]["main"] == stat[9]: - stat[9] = data[0]["main"] - return [0, "Bonjour, Muin pour vous servir.\n1. Bonjour je voudrais manger. [-5 PO]\n2. Vous reste-t-il des chambres ? [-15 PO]\n3. A boire ! [-3 PO]", 3] - - else: - event, choice = shop_interaction(data, stat, 3, - (5, [-1, "Pas de probleme ! [MUIN REVINT QUELQUES MINUTES PLUS TARD, ET POSA UNE ASSIETTE FUMANTE DEVANT VOUS.]", 0, (0, 5), (1, -5)], [-1, "Hey la ! Reviens quand tu pourras me payer."]), - (15, [-2, "Bien sur ! Suivez-moi. [VOUS SUIVEZ MUIN DANS UNE PIECE TROGLODYTE MUNIE D'UN LIT ET D'UN COFFRE. VOUS VOUS ENDORMEZ RAPIDEMENT.]", 0, (0, 15), (1, -15), (4, 480)], [-2, "Desole, je n'ai plus une seule chambre de libre."]), - (3, [-3, "[MUIN POSA UNE CHOPPE DE BIERE MOUSSEUSE DEVANT VOUS.]", 0, (0, 3), (1, -3)], [-3, "Allez donc voir un autre etablissement, nous ne servons pas gratuitement."])) - - if choice == 2 and 360 < stat[4] < 1140: return [-2, "Une chambre !? Il n'est que {} heures. Reviens dans la soiree.".format(stat[4] // 60)] - else: return event - - return [0, "Hmm ?"] - - -def h_38_npc(data, stat, entites, identifiant): - pass - - -def h_39_npc(data, stat, entites, identifiant): - coords = data[2], data[3] - - if not (480 <= stat[4] <= 1140): return [0, "La forge de Nidavellir est ouverte de 8 heures a 18 heures."] - - if coords == (9, 2): - if stat[3][0]: return [0, "Vous avez deja une arme. Allez voir mon confrere si vous voulez la vendre et revenez me voir."] - - weapons_sale = [] - formated_wpn = "" - while len(weapons_sale) < 4: - wpn = randint(1, len(weapons) - 1) - if not wpn in weapons_sale: - weapons_sale.append(wpn) - formated_wpn += "{0}. {1} [-{2} PO]\n".format(len(weapons_sale), weapons[wpn], 10 * wpn) - - wpn_choice = print_text("Bienvenue a la forge de Nidavellir ! Vous desirez une piece particulière ?\n{}".format(formated_wpn), 1, 4, 0) - if not wpn_choice: return [0, "Hmm ?"] - - wpn = weapons_sale[wpn_choice - 1] - if stat[1] < 10 * wpn: return [0, "Vous n'avez pas assez."] - stat[3][0] = wpn - return [0, "Tres bon choix ! [LE NAIN DECROCHA L'ARME DU RATELIER ET VOUS LA TENDIT.]", 0, (1, -10 * wpn)] - - if coords == (9, 4): - if stat[3][0] == 0: return [0, "Vous n'avez pas d'arme a me vendre. Allez voir mon collegue pour en acheter une."] - - if stat[9] == -1 or data[0]["main"] == stat[9]: - stat[9] = data[0]["main"] - return [0, "Bienvenue dans notre forge. Vous souhaitez me vendre votre arme ?\n1. Oui\n2. Non", 2] - - elif data[0]["main"] == stat[9] + 1: - stat[9] = -1 - cost = stat[3][0] * 8 - stat[3][0] = 0 - return [-1, "Marche conclu ! [+{} PO]".format(cost), 0, (1, cost)] - - elif data[0]["main"] == stat[9] + 2: - stat[9] = -1 - return [-2, "A votre guise, revenez quand vous voulez !"] - - -def h_40_npc(data, stat, entites, identifiant): - pass - - -def h_41_npc(data, stat, entites, identifiant): - pass - - -# - - - Muspellheim - - - # -def muspellheim_po(coords, identifiant): - pass - -def muspellheim_npc(data, stat, entites, identifiant): - # * : (20, 12) - # * : (78, 14) - # * : (54, 80) - # * : (59, 91) - # * : (39, 94) - # * : (29, 113) - - coords = data[2], data[3] - - if coords == (39, 94): - if data[0]["main"] == 71: return [15, 20, 20, 15, 100], "Soldat Vane", 20, 2 - - -def h_42_npc(data, stat, entites, identifiant): - coords = data[2], data[3] - - 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]: - stat[9] = data[0]["main"] - return [0, "Besoin de quelque chose messire ?\n1. Hum, oui, j'aimerais manger. [-5 PO]\n2. Je voudrais dormir [-10 PO]", 2] - - else: - event, _ = shop_interaction(data, stat, 2, - (5, [-1, "Et voila pour vous !", 0, (0, 5), (1, -5)], [-1, "Je regrette, vous n'avez pas assez."]), - (10, [-2, "Bien sur, si vous voulez bien me suivre. [VOUS VOUS ALLONGEZ SUR LE LIT ET VOUS ENDORMEZ RAPIDEMENT.]", 0, (0, 10), (1, -10), (4, 480)], [-2, "Nous ne pouvons pas nous permettre de faire credit."])) - - return event - -def h_43_npc(data, stat, entites, identifiant): - coords = data[2], data[3] - - if not (480 <= stat[4] <= 1140): return [0, "L'armurerie est ouverte de 8 heures a 18 heures."] - - if identifiant == "Bertfrid": - if stat[3][1]: return [0, "Vous portez deja une armure, allez voir mon confrere."] - - if stat[9] == -1 or data[0]["main"] == stat[9]: - stat[9] = data[0]["main"] - return [0, "Bienvenue, dans mon armurerie ! Je suis Bertfrid, besoin d'une armure ?\n1. Oui, d'une rondache. [-10 PO]\n2. d'un pavois [-20 PO]\n3. d'une cotte de mailles [-30 PO]\n4. d'une broigne [-40 PO]\n5. d'un harnois [-50 PO]", 5] - - else: - shields = ("UNE RONDACHE", "UN PAVOIS", "UNE COTTE DE MAILLES", "UNE BROIGNE", "UN HARNOIS") - for i in range(1, 6): - if data[0]["main"] == stat[9] + i: - stat[9] = -1 - if stat[1] < i * 10: return [-i, "Vous n'avez pas assez."] - stat[3][1] = i - return [-i, "C'est un bon achat. [BERTFRID DECROCHA {}]".format(shields[i - 1]), 0, (1, -i * 10)] - - elif coords == (13, 9): - if stat[3][1] == 0: return [0, "J'achete, je ne vend pas ! Allez voir Bertfrid du cote du four a metaux, elle vous renseignera"] - - if stat[9] == -1 or data[0]["main"] == stat[9]: - stat[9] = data[0]["main"] - return [0, "Vous voulez vendre votre piece d'armure ?\n1. Oui\n2. Non", 2] - - elif data[0]["main"] == stat[9] + 1: - stat[9] = -1 - cost = stat[3][1] * 8 - return [-1, "C'est une affaire ! [+{} PO]".format(cost), 0, (1, cost)] - - elif data[0]["main"] == stat[9] + 2: - stat[9] = -1 - return [-2, "Revenez quand vous voulez !"] - - elif coords == (6, 5): - return [0, "Je ne suis qu'apprenti monseigneur. Adressez-vous plutot a Bertfrid. Vous la trouverez pres du four."] - - -def h_44_npc(data, stat, entites, identifiant): - pass - - -# - - - Svartalfheim - - - # -def svartalfheim_po(coords, identifiant): - pass - -def svartalfheim_npc(data, stat, entites, identifiant): - # * : (10; 24) - # * : (105; 46) - # * : (22; 50) - # * : (15; 54) - # * : (25; 61) - # * : (121; 68) - pass - -def h_45_npc(data, stat, entites, identifiant): - pass - - -def h_46_npc(data, stat, entites, identifiant): - pass - -def h_47_npc(data, stat, entites, identifiant): - pass - - -def h_48_npc(data, stat, entites, identifiant): - pass