Exemplo n.º 1
0
Arquivo: PNJ.py Projeto: WexyR/KNIL
def exe(pnj, q, d):
    txt = Event.generate("event_speak_{0}".format(pnj['name']), q)
    if txt:
        f = open("./PNJ_txt/{name}/{txt}.txt".format(name=pnj["name"], txt=txt))
    else:
        quest_name, num = Quest.auto_txt(q, pnj["name"])
        if quest_name and num:
            f = open("./PNJ_txt/{name}/{quest_name}_auto_{num}.txt".format(name=pnj["name"], quest_name=quest_name, num=num))
        else:
            f = open("./PNJ_txt/{name}/auto.txt".format(name=pnj["name"]))
    t = f.read()
    Dialog.run_dialog(d, t, speaker=pnj["name"])
Exemplo n.º 2
0
Arquivo: PNJ.py Projeto: WexyR/KNIL
def exe(pnj, q, d, k, b, g):
    """Interagit avec un pnj"""

    txt = Event.generate(
        "event_speak_{0}".format(pnj['name']), q, k, b, d,
        g)  # Genere un evenement associé à la discussion avec ce pnj
    # On recupère (ou non) des détails concernant la quêtes
    if txt:
        f = open("./PNJ_txt/{name}/{txt}.txt".format(
            name=pnj["name"],
            txt=txt))  # On selectionne le texte à dire selon la quete associée
    else:  # Sinon on balance un texte automatique
        quest_name, num = Quest.auto_txt(q, pnj["name"])
        if quest_name and num:
            f = open("./PNJ_txt/{name}/{quest_name}_auto_{num}.txt".format(
                name=pnj["name"], quest_name=quest_name, num=num))
        else:
            f = open("./PNJ_txt/{name}/auto.txt".format(name=pnj["name"]))
    t = f.read()
    Dialog.run_dialog(d, t, speaker=pnj["name"])
    f.close()