Exemple #1
0
def _talk_to_kid_looking_for_dog_1(al: "All"):
    if get_event_status("talk_to_sushi") == 1:
        # Has the dog following
        al.active_npc.standard_dialog = al.active_npc.extra_dialog_2
        al.active_npc.active_dialog = al.active_npc.standard_dialog
        al.active_npc.taught = Word.get_by_split_form("หมา")
        # Remove follower dog
        al.learner.followers = [
            follower for follower in al.learner.followers
            if follower.name != "ซูชิ"
        ]

        dog = Npc(
            al=al,
            name="Sushi",
            ma=al.mas.get_map_from_name("chaiyaphum"),
            x=42,
            y=48,
            sprite="dog",
            direction=Direction.UP,
            standard_dialog=["โฮ่ง โฮ่ง"],
        )
        al.mas.current_map.add_npc(dog)
        set_event('sushi_is_following', 2)

    else:
        al.active_npc.standard_dialog = al.active_npc.extra_dialog_1
        al.active_npc.active_dialog = al.active_npc.standard_dialog
        set_event('talk_to_kid_looking_for_dog', 1)
Exemple #2
0
 def __init__(self, ma):
     self.ma = ma
     self.candidates = []
     self.rates = []
     file_path = f"{os.path.dirname(os.path.realpath(__file__))}/occurrences/{ma.filename}.occurrence"
     try:
         file = open(file_path, "r")
     except FileNotFoundError:
         # print(f"Could not find file {file_path}")
         return
     total_weight = 0
     for line in file:
         line = line.replace("\n", "")
         letter = " L " in line
         if letter:
             elements = line.split(" L ")
         else:
             elements = line.split(" ")
         weight = int(elements[0])
         # TODO do it so that it fetches word by id rather than by thai to avoid confusions
         if letter:
             letter = Letter.get_by_thai(elements[1])
             self.candidates.append(letter)
         else:
             word = Word.get_by_split_form(elements[1])
             self.candidates.append(word)
         total_weight += weight
         self.rates.append(weight)
     self.rates = [rate / total_weight for rate in self.rates]
Exemple #3
0
def _talk_to_gecko_kid_0(al: "All"):
    found_gecko_1 = int(bool(get_event_status('find_gecko_1')))
    found_gecko_2 = int(bool(get_event_status('find_gecko_2')))
    found_gecko_3 = int(bool(get_event_status('find_gecko_3')))
    number_of_collected_geckos = found_gecko_1 + found_gecko_2 + found_gecko_3
    if number_of_collected_geckos == 0:
        play_thai_word("ขอบคุณนะครับ")
        al.active_npc.standard_dialog = al.active_npc.extra_dialog_5
        al.active_npc.active_dialog = al.active_npc.standard_dialog
        _process_dialog(al.active_npc.active_dialog, al)
        set_event('talk_to_gecko_kid', 0)
    elif number_of_collected_geckos == 1:
        set_event('talk_to_gecko_kid', 0)
        al.active_npc.standard_dialog = al.active_npc.extra_dialog_1
        al.active_npc.active_dialog = al.active_npc.standard_dialog
    elif number_of_collected_geckos == 2:
        al.active_npc.standard_dialog = al.active_npc.extra_dialog_2
        al.active_npc.active_dialog = al.active_npc.standard_dialog
        set_event('talk_to_gecko_kid', 0)
    else:
        set_event('talk_to_gecko_kid', 1)
        al.active_npc.standard_dialog = al.active_npc.extra_dialog_3
        al.active_npc.active_dialog = al.active_npc.standard_dialog
        al.active_npc.taught = Word.get_by_split_form("ตุ๊ก-แก")
        al.active_npc.wanna_meet = False
        al.bag.reduce_item_quantity('gecko', 3)
Exemple #4
0
def add_word(words,
             thai="no_thai",
             english="no_english",
             tone=Tone.UNKNOWN,
             length=Length.UNKNOWN,
             audio=""):
    words.add_word(Word(thai=thai, english=english))
Exemple #5
0
def kasetsombun_spell(al):
    add_npc(
        Spell(
            al=al,
            ma=al.mas.get_map_from_name("kasetsombun_temple"),
            x=33,
            y=15,
            word=Word.get_by_split_form("ผัก"),
        ))
    add_npc(
        Spell(
            al=al,
            ma=al.mas.get_map_from_name("kasetsombun"),
            x=20,
            y=4,
            word=Word.get_by_split_form("ผัก"),
        ))
Exemple #6
0
def _talk_to_painter_0(al: "All"):
    """
    First time we speak, it's always asking for paint,
    and also teaching the word for blue if we don't know it
    """
    learner_knows_word = get_xp_for_word(split_form="สี-ฟ้า")
    al.active_npc.standard_dialog = al.active_npc.extra_dialog_3
    al.active_npc.active_dialog = al.active_npc.standard_dialog
    if not learner_knows_word:
        al.active_npc.taught = Word.get_by_split_form("สี-ฟ้า")
Exemple #7
0
def get_random_word_id() -> "Word":
    from lexicon.items import Word

    random_word_db = random.choice(
        list(
            CURSOR.execute(f"""
        SELECT id, split_form, english, tones, pos, thai
        FROM words
    """)))
    return Word(
        id=random_word_db[0],
        split_form=random_word_db[1],
        english=random_word_db[2],
        tones=random_word_db[3],
        pos=random_word_db[4],
        thai=random_word_db[5],
    )
Exemple #8
0
 def __init__(self,
              al,
              presented: Word,
              from_learning=False,
              from_dex=False):
     super().__init__()
     self.al = al
     self.presented = presented
     # parameters
     self.from_learning = from_learning
     self.from_dex = from_dex
     # drawing
     self.selector_on_sound = False
     self.selector_on_map = False
     # obtained from DB
     self.sentences = presented.get_sentences()
     self.selected_sentence_index = 0
Exemple #9
0
    def select_words_from_db(self):
        if not self.actualized:
            words_db = list(get_db_cursor().execute(
                f" SELECT w.id, w.split_form, w.thai, w.english, w.tones, w.pos, uw.total_xp, w.location, w.location_x, w.location_y "
                f"FROM words w "
                f"LEFT JOIN user_word uw ON uw.word_id = w.id "
                f"LEFT JOIN users u ON u.id = uw.user_id "
                f"WHERE w.teaching_order > 0 "
                f"AND u.is_playing = 1 "
                f"ORDER BY w.teaching_order "
                f"LIMIT {self.max_items_to_show} OFFSET {self.offset};"))
            words_to_show = [
                Word(
                    id=id,
                    split_form=split_form,
                    thai=thai,
                    english=english,
                    tones=tones,
                    pos=pos,
                    location=location,
                    xp=xp,
                    x=location_x,
                    y=location_y,
                ) for (id, split_form, thai, english, tones, pos, xp, location,
                       location_x, location_y) in words_db
            ]

            self.word_boxes = []
            for line in range(self.number_of_lines):
                for column in range(self.words_per_line):
                    try:
                        word = words_to_show[line * self.words_per_line +
                                             column]
                    except IndexError:
                        word = None
                    self.word_boxes.append(
                        WordBox(x=self.al.ui.percent_width(0.15) +
                                column * self.square_width,
                                y=self.al.ui.percent_height(0.05) +
                                line * self.square_height,
                                width=self.square_width,
                                height=self.square_height,
                                word=word,
                                blinking=word
                                and word.location == self.location))
            self.actualized = True
Exemple #10
0
def get_word_by_id(word_id):
    from lexicon.items import Word

    word_db = list(
        CURSOR.execute(f"SELECT * FROM words WHERE id = '{word_id}'"))[0]
    id = word_db[0]
    split_form = word_db[1]
    english = word_db[2]
    tones = word_db[3]
    pos = word_db[4]
    # in_sentence = word_db[5]  # TODO
    thai = word_db[5]
    word = Word(id=id,
                split_form=split_form,
                thai=thai,
                english=english,
                tones=tones,
                pos=pos)
    return word
Exemple #11
0
def kasetsombun_town(al):
    add_npc(
        Npc(
            al=al,
            name="old woman in woman house teach เธอ",
            ma=al.mas.get_map_from_name("kasetsombun_house2"),
            taught=Word.get_by_split_form("เธอ"),
            x=7,
            y=8,
            sprite="old_woman",
            direction=Direction.DOWN,
            standard_dialog=[
                "I don't have much longer to live, and I'm not much now -",
                "But at least I have raised three strong women.",
                "I believe women have the power to change Thailand.",
                'As a parting gift, let me teach you how to say "she".',
            ],
            defeat_dialog=[
                'You can also use เขา, as it means "he, she, they",',
                "but เธอ is only for women.",
                "To remember it, remember that each woman was once a daughter - a daughเธอ.",
                'Note that it can be used to mean "you" as well.',
            ],
        ))
    add_npc(
        Npc(
            al=al,
            name="woman in woman house",
            ma=al.mas.get_map_from_name("kasetsombun_house2"),
            x=5,
            y=10,
            sprite="woman",
            direction=Direction.UP,
            standard_dialog=[
                "Mom was the healer in Kasetsombun.",
                "She used to communicate with spirits, knew plants, could cure most ailments.",
                "Who's gonna save us now that she's dying?",
            ],
        ))
    add_npc(
        Npc(
            al=al,
            name="woman in woman house",
            ma=al.mas.get_map_from_name("kasetsombun_house2"),
            x=7,
            y=10,
            sprite="mom",
            direction=Direction.UP,
            standard_dialog=[
                "Mom taught us so much.",
                "She's very ill now, it will be our turn to teach her ancient knowledge.",
            ],
        ))
    add_npc(
        Npc(
            al=al,
            name="farmer",
            ma=al.mas.get_map_from_name("kasetsombun"),
            x=21,
            y=8,
            sprite="dad",
            direction=Direction.RIGHT,
            standard_dialog=[
                "I'm seeding out the grass to make this a vegetable field.",
                "Do you know a Spell to help me out?",
            ],
        ))
    add_npc(
        Npc(
            al=al,
            name="woman in woman house",
            ma=al.mas.get_map_from_name("kasetsombun_house2"),
            x=9,
            y=10,
            sprite="rich_woman",
            direction=Direction.UP,
            standard_dialog=[
                "I came back from Bangkok as soon as I heard the news.",
                "Yeah, I left Kasetsombun when I was 18 because I couldn't stand the rural life.",
            ],
        ))
    add_npc(
        Npc(
            al=al,
            name="old_woman",
            ma=al.mas.get_map_from_name("kasetsombun_house1"),
            x=7,
            y=7,
            sprite="old_woman",
            direction=Direction.DOWN,
            standard_dialog=["ผักของฉันอร่อย"],
        ))
    add_npc(
        Npc(
            al=al,
            name="lass",
            ma=al.mas.get_map_from_name("kasetsombun_house1"),
            x=5,
            y=9,
            sprite="lass",
            direction=Direction.RIGHT,
            standard_dialog=["อร่อย!"],
        ))
    add_npc(
        Npc(
            al=al,
            name="mom",
            taught=Word.get_by_split_form("อ-ร่อย"),
            ma=al.mas.get_map_from_name("kasetsombun_house1"),
            x=7,
            y=10,
            sprite="mom",
            direction=Direction.UP,
            standard_dialog=[
                "My mom's vegetables are delicious - she grows the best in Kasetsombun.",
                "Me? I have a restaurant down in Lomsak where I cook traditional food.",
                "I often come here so that my mom can see her grandchildren a bit.",
            ],
        ))
    add_npc(
        Npc(
            al=al,
            name="kid",
            ma=al.mas.get_map_from_name("kasetsombun_house1"),
            x=9,
            y=8,
            sprite="kid",
            direction=Direction.LEFT,
            standard_dialog=[
                "Mom made us some bittermelon with garlic for breakfast,",
                "with granny's vegetables."
            ],
        ))
    add_npc(
        Npc(
            al=al,
            name="kid",
            ma=al.mas.get_map_from_name("kasetsombun_temple"),
            x=16,
            y=22,
            sprite="kid",
            direction=Direction.RIGHT,
            standard_dialog=["We found a gecko!"],
        ))
    add_npc(
        Npc(
            al=al,
            name="gecko",
            ma=al.mas.get_map_from_name("kasetsombun_temple"),
            x=17,
            y=22,
            sprite="gecko",
            direction=Direction.UP,
            standard_dialog=["..."],
        ))
    add_npc(
        Npc(
            al=al,
            name="kid",
            ma=al.mas.get_map_from_name("kasetsombun_temple"),
            x=17,
            y=21,
            sprite="lass",
            direction=Direction.DOWN,
            standard_dialog=["มันเป็นตุ๊กแก!!"],
        ))
    add_npc(
        Npc(
            al=al,
            name="Nobody",
            ma=al.mas.get_map_from_name("kasetsombun"),
            x=3,
            y=11,
            sprite="kid",
            direction=Direction.RIGHT,
            standard_dialog=["no dialog"],
        ))
    add_npc(
        Npc(
            al=al,
            name="Nobody",
            ma=al.mas.get_map_from_name("kasetsombun"),
            x=4,
            y=11,
            sprite="gecko",
            direction=Direction.UP,
            standard_dialog=["no dialog"],
        ))
    add_npc(
        Npc(
            al=al,
            name="Nobody",
            ma=al.mas.get_map_from_name("kasetsombun"),
            x=4,
            y=10,
            sprite="lass",
            direction=Direction.DOWN,
            standard_dialog=["no dialog"],
        ))
    add_npc(
        Npc(
            al=al,
            name="student 1",
            ma=al.mas.get_map_from_name("kasetsombun_school"),
            x=11,
            y=24,
            sprite="lass",
            direction=Direction.UP,
            standard_dialog=[
                "We're learning นี้ and นั่น in their subject form,",
                "but both also have an alternative form.",
                "Pronounced the same with a different tone:",
                "นี้ can become นี่, and นั้น can become นั่น.",
                "In that form, they can be used as objects.",
                'For example, "This eats that." is "นี้ กิน นั่น"',
                "They're pronounced the same but with a different tone.",
            ],
        ))
    add_npc(
        Npc(
            al=al,
            name="student 2",
            ma=al.mas.get_map_from_name("kasetsombun_school"),
            x=15,
            y=24,
            sprite="kid",
            direction=Direction.UP,
            standard_dialog=[
                "Do you know classifiers yet?",
                "Usually, you use นี้ and นั่น after a classifier.",
            ],
        ))
    add_npc(
        Npc(
            al=al,
            name="student 3",
            ma=al.mas.get_map_from_name("kasetsombun_school"),
            x=11,
            y=22,
            sprite="kid",
            direction=Direction.UP,
            standard_dialog=[
                "นี้ and นั่น are super useful!",
                "They appear in so many words, and can also be used on their own!",
                "For example: I like this: ผม ชอบ นี่.",
            ],
        ))
    add_npc(
        Npc(
            al=al,
            name="student 4",
            ma=al.mas.get_map_from_name("kasetsombun_school"),
            x=14,
            y=22,
            sprite="lass",
            direction=Direction.UP,
            standard_dialog=[
                "These are my grandparents!",
                "People take turns here to teach us.",
                "And today it's my grandparents!",
            ],
        ))
    add_npc(
        Npc(
            al=al,
            name="teacher",
            ma=al.mas.get_map_from_name("kasetsombun_school"),
            taught=Word.get_by_split_form("นั่น"),
            x=12,
            y=18,
            sprite="old_woman",
            direction=Direction.DOWN,
            standard_dialog=[
                "This is นี้ (nee), that is นั่น (nan).",
                "นี้ is for what is close, นั่น for what is far away.",
            ],
            defeat_dialog=[
                "It's easy to remember, because นี้ has a 'i' sound like 'this'.",
                "And นั่น has a 'a' sound like 'that'.",
            ],
        ))
    add_npc(
        Npc(
            al=al,
            name="teacher",
            ma=al.mas.get_map_from_name("kasetsombun_school"),
            taught=Word.get_by_split_form("นี้"),
            x=14,
            y=18,
            sprite="old_man",
            direction=Direction.DOWN,
            standard_dialog=[
                "This is นี้ (nee), that is นั่น (nan).",
                "นี้ is for what is close, นั่น for what is far away.",
            ],
            defeat_dialog=[
                "Imagine that you have a knee (นี้), and you see a nun (นั่น) far away.",
                "Naturally, your knee is closer to you than the nun.",
            ],
        ))
    add_npc(
        Npc(
            al=al,
            name="the young hermit",
            fight_words=[
                Word.get_by_split_form(battle_word)
                for battle_word in ["มัน-ฝ-รั่ง", "ผัก", "ฝรั่ง", "อ-ร่อย"]
            ],
            ma=al.mas.get_map_from_name("kasetsombun_cave"),
            x=10,
            y=12,
            sprite="kid",
            direction=Direction.UP,
            money=3,
            standard_dialog=["This is my secret place!"],
            defeat_dialog=["Maybe I should brush up on my vegetables."],
        ))
    add_npc(
        Npc(
            al=al,
            name="old_man",
            ma=al.mas.get_map_from_name("kasetsombun"),
            x=29,
            y=16,
            sprite="old_man",
            direction=Direction.RIGHT,
            standard_dialog=[
                "You're from Phetchabun?",
                "Then you crossed that cave to come here?",
                "Thank you! Welcome to Kasetsombun!",
            ],
        ))
    add_npc(
        Npc(
            al=al,
            name="monk1",
            taught=Word.get_by_split_form("พระ"),
            ma=al.mas.get_map_from_name("kasetsombun_temple_temple"),
            x=13,
            y=18,
            sprite="monk",
            direction=Direction.UP,
            standard_dialog=["You want to learn a word?", "How about พระ?"],
            defeat_dialog=[
                'พระ is also a prefix to put before words like "king" or "god", showing respect.',
                '"King" is พระราชา, and "god" is พระเจ้า.',
                "To remember it, think that Buddha, monks, kings and gods are praised, พระised.",
            ],
        ))
    add_npc(
        Npc(
            al=al,
            name="dad",
            ma=al.mas.get_map_from_name("kasetsombun_house3"),
            taught=Word.get_by_split_form("ฝรั่ง"),
            x=4,
            y=10,
            sprite="dad",
            direction=Direction.RIGHT,
            standard_dialog=[
                "What is a farang like you doing in Kasetsombun?",
                "What, you don't know what farang means?",
                "It means foreigner, but also guava!",
            ],
            defeat_dialog=[
                "ฝรั่ง is easy to remember because it has the same origin as French:",
                "ฝรั่งเศส (farangset).",
                "Guavas are called farangs because they were brought to Thailand",
                "by Portuguese people, a long time ago.",
            ],
        ))
    add_npc(
        Npc(
            al=al,
            name="mom",
            ma=al.mas.get_map_from_name("kasetsombun_house3"),
            taught=Word.get_by_split_form("มัน"),
            x=5,
            y=10,
            sprite="mom",
            direction=Direction.LEFT,
            standard_dialog=[
                'You want a useful word? How about the pronoun "it"?'
            ],
            defeat_dialog=[
                "I've got an idea for you to remember it!",
                'Imagine a wife that despises her man and refers to him as "it".',
                "No, I'm not doing that, hahaha. haha.",
                "มัน also means yam or tuber.",
                "Not that I'm calling my husband that either.",
            ],
        ))
    add_npc(
        Npc(
            al=al,
            name="woman talking about the spirit house",
            ma=al.mas.get_map_from_name("kasetsombun"),
            x=9,
            y=17,
            sprite="old_woman",
            direction=Direction.UP,
            standard_dialog=[
                "This, there, is a spirit house.",
                "I'm making an offering right now.",
                "I often give things like bananas, coconuts, rice, and desserts.",
                "Also, we give lots of red strawberry-flavored fanta!",
                "Naturally, sweet spirits are sweet tooths.",
                "They will flock here and repel the evil spirits.",
            ],
        ))
    add_npc(
        Npc(
            al=al,
            name="man teaching potato",
            ma=al.mas.get_map_from_name("kasetsombun"),
            taught=Word.get_by_split_form("มัน-ฝ-รั่ง"),
            x=25,
            y=12,
            sprite="dad",
            direction=Direction.UP,
            standard_dialog=[
                "I'm planting potatoes.",
                'Ah, actually that\'s a funny word to learn if you already know "it" and "foreigner"!',
            ],
            defeat_dialog=[
                'Yes, potatoes mean "western yams", but it sounds like "it foreigner"!'
            ],
        ))
    add_npc(
        Npc(
            al=al,
            name="woman teach vegetable",
            ma=al.mas.get_map_from_name("kasetsombun"),
            taught=Word.get_by_split_form("ผัก"),
            x=30,
            y=11,
            sprite="woman",
            direction=Direction.UP,
            standard_dialog=[
                "Yes, it's mostly farmland around Kasetsombun.",
                "Actually, 'เกษตร' (kaset) means farmland, and 'สมบูรณ์' (sombum) means perfect.",
                "I wonder if that refers to how perfect my farmland is?",
                "Those words are a bit advanced, but I can teach you the word for vegetable!",
            ],
            defeat_dialog=[
                "To remember it, you can imagine pacman eating vegetables!"
            ],
        ))
Exemple #12
0
def _talk_to_kid_looking_for_dog_2(al: "All"):
    al.active_npc.standard_dialog = al.active_npc.extra_dialog_3
    al.active_npc.active_dialog = al.active_npc.standard_dialog
    al.active_npc.taught = Word.get_by_split_form("หมา")
    set_event('talk_to_kid_looking_for_dog', 2)
Exemple #13
0
def chaiyaphum_learner_house(al):
    add_npc(
        Npc(
            al=al,
            name="Mom",
            taught=Word.get_by_split_form("ฉัน"),
            ma=al.mas.get_map_from_name("house_learner_f1"),
            x=5,
            y=10,
            sprite="mom",
            direction=Direction.RIGHT,
            standard_dialog=[
                "Mom: [Name]!",
                "Mom: So, you decided to begin your Thai Adventure?",
                "Mom: Let me teach you the first word:",
            ],
            defeat_dialog=[
                'That\'s how women say "I" in Thai, but actually, there\'s many ways to say "I".',
                "Mom: I thought it woulb be a useful word for your adventure.",
            ],
        ))
    add_npc(
        Npc(
            al=al,
            name="Dad",
            taught=Word.get_by_split_form("ผม"),
            ma=al.mas.get_map_from_name("house_learner_f1"),
            x=7,
            y=9,
            sprite="dad",
            direction=Direction.DOWN,
            standard_dialog=[
                "Dad: What's up [Name]!",
                "Dad: I'll teach you a useful word before you go:",
            ],
            defeat_dialog=[
                "Dad: Well done, [Name]!",
                "Dad: Now, go on your adventure!",
                "Dad: Come again when you'll have learned more than 100 words,",
                "Dad: and I'll give you something!",
            ],
        ))
    add_npc(
        Npc(
            al=al,
            name="Grandpa",
            taught=Word.get_by_split_form("ไทย"),
            ma=al.mas.get_map_from_name("chaiyaphum"),
            x=33,
            y=104,
            wanna_meet=True,
            eyesight=3,
            sprite="old_man",
            direction=Direction.LEFT,
            standard_dialog=[
                "Grandpa: Oh, [Name].",
                "Grandpa: So, you're leaving... How can I help you, I don't know much words...",
                "Grandpa: Oh, I know a word that would be useful for you!",
                "Grandpa: How to say Thai in Thai!",
            ],
            defeat_dialog=[
                'Grandpa: And to say "Thai people", we simply say "People-Thai": คนไทย'
            ],
        ))
    add_npc(
        Npc(
            al=al,
            name="seed",
            ma=al.mas.get_map_from_name("chaiyaphum"),
            x=32,
            y=101,
            sprite="seed",
            direction=Direction.LEFT,
            standard_dialog=[
                "Seed: I'm growing!",
            ],
        ))
    add_npc(
        Npc(
            al=al,
            name="Granny",
            taught=Word.get_by_split_form("คน"),
            ma=al.mas.get_map_from_name("chaiyaphum_house_1"),
            x=8,
            y=11,
            sprite="old_woman",
            direction=Direction.LEFT,
            standard_dialog=[
                "Granny: Is that you, [Name]? Your mother told me your going on an adventure to learn Thai?",
                "Granny: My advice is: talk to everybody!",
                "Granny: People will teach you new words and help you greatly.",
                "Granny: So you can remember this advice, I will teach you this very word: people.",
            ],
            defeat_dialog=[
                'Granny: And to say "Thai people", we simply say "People-Thai": คนไทย',
                "Granny: If you're looking for grandpa, he's working in the field.",
            ],
        ))
    add_npc(
        Npc(
            al=al,
            name="television",
            ma=al.mas.get_map_from_name("house_learner_f2"),
            x=5,
            y=8,
            sprite="_television_on",
            standard_dialog=["It's a video game involving geckos."],
        ))
    add_npc(
        Npc(
            al=al,
            name="bed of Nim",
            ma=al.mas.get_map_from_name("house_learner_f2"),
            x=2,
            y=12,
            sprite="bed",
            standard_dialog=["That's the bed of Nim."],
        ))
    add_npc(
        Npc(
            al=al,
            name="Nim",
            ma=al.mas.get_map_from_name("house_learner_f2"),
            x=5,
            y=10,
            sprite="nim",
            direction=Direction.UP,
            standard_dialog=["Nim: Yo, [Name]!"],
        ))
    add_npc(
        Npc(
            al=al,
            name="bed",
            ma=al.mas.get_map_from_name("house_learner_f2"),
            x=8,
            y=12,
            sprite="bed",
            standard_dialog=["Let's take a nap and restore my health!"],
        ))
    add_npc(
        Npc(
            al=al,
            name="สมชาย",
            ma=al.mas.get_map_from_name("house_rival_f1"),
            x=5,
            y=9,
            sprite="dad",
            direction=Direction.LEFT,
            standard_dialog=[
                "Oh, [Name]. You came to see Somchai?",
                "He's upstairs in his room learning Thai!",
            ],
        ))
Exemple #14
0
def chaiyaphum_chumphae_houses(al):
    add_npc(
        Npc(
            al=al,
            name="Nobody",
            ma=al.mas.get_map_from_name("chaiyaphum"),
            x=45,
            y=10,
            sprite="old_woman",
            direction=Direction.UP,
            standard_dialog=[
                "This is the inn.",
                "You can rest here for free and restore your health.",
            ],
        ))
    add_npc(
        Npc(
            al=al,
            name="Nobody",
            taught=Word.get_by_split_form("บ้าน"),
            ma=al.mas.get_map_from_name("chaiyaphum"),
            x=54,
            y=47,
            sprite="old_man",
            direction=Direction.DOWN,
            standard_dialog=[
                "That's my house!",
                "Pretty nice, eh?",
                "Wanna learn how to say house?",
            ],
        ))
    add_npc(
        Npc(
            al=al,
            name="Nobody",
            taught=Word.get_by_split_form("อยาก"),
            ma=al.mas.get_map_from_name("house5"),
            x=12,
            y=7,
            sprite="mom",
            direction=Direction.DOWN,
            standard_dialog=[
                "What do you want?",
                "You came all the way here, you must want something.",
                "Want to learn how to say want?",
            ],
        ))
    add_npc(
        Npc(
            al=al,
            name="Nobody",
            taught=Word.get_by_split_form("อยู่"),
            ma=al.mas.get_map_from_name("house4"),
            x=6,
            y=11,
            sprite="mom",
            direction=Direction.DOWN,
            standard_dialog=[
                "I'm at home. You're at my place.",
                "Do you know how to say where you are?",
            ],
        ))
Exemple #15
0
def chaiyaphum_chumphae_path(al):
    add_npc(
        Npc(
            name="old man consonant challenge",
            al=al,
            ma=al.mas.get_map_from_name("chaiyaphum_hidden_cave"),
            x=8,
            y=6,
            sprite="old_man",
            standard_dialog=[
                # "Yeh",
                # "I challenge you to a consonant race.",
                # "I give you 22 consonants, and you tell me their class.",
                # "You have 40 seconds. If you win I give you 3 Bahts, if you lose you give me 1 Baht.",
                Question(
                    precursor_text="Wanna try?",
                    choice_1="Yes",
                    choice_2="No",
                    choice_1_callback=set_consonant_challenge_old_dude,
                    choice_2_callback=set_no_consonant_challenge_old_dude,
                ),
            ],
            defeat_dialog=[
                "Well played!",
                "I gave you 3 Bahts, as promised",
            ],
            victory_dialog=[
                "Haha, I got you, youngster!",
                "Come on, show me a shiny Baht!",
                "You should check your letters with L more often.",
            ],
            direction=Direction.DOWN,
            hp=40,
            money=3,
            lost_money_on_defeat=1,
        ))
    add_npc(
        Npc(
            al=al,
            name="Nobody",
            ma=al.mas.get_map_from_name("chaiyaphum"),
            x=28,
            y=36,
            sprite="kid",
            direction=Direction.UP,
            standard_dialog=[
                "Have you been in the cave over there?",
                "There's an old man in there that will challenge you to a consonant race.",
                "If you give me 5 Bahts I'll give you a trick to beat him.",
                Question(
                    precursor_text="Wanna hear it?",
                    choice_1="Yes, pay 5 Bahts",
                    choice_2="No, I'm strong enough on my own",
                    choice_1_callback=kid_sell_advice_to_beat_old_dude,
                    choice_2_callback=kid_sell_no_advice_to_beat_old_dude,
                ),
                "[PLACEHOLDER]",
            ],
        ))
    add_npc(
        Npc(
            al=al,
            name="Nobody",
            ma=al.mas.get_map_from_name("chaiyaphum"),
            x=30,
            y=88,
            sprite="mom",
            direction=Direction.UP,
            standard_dialog=[
                "Be careful out there, words can attack you when you're in tall grass.",
                "I'll let you go if you know at least 5 words!",
                "You can see the words you know by pressing 'w'.",
            ],
        ))
    add_npc(
        Npc(
            al=al,
            name="Nobody",
            ma=al.mas.get_map_from_name("chaiyaphum"),
            x=36,
            y=80,
            sprite="mom",
            direction=Direction.RIGHT,
            standard_dialog=[
                "If you are hurt, you can rest a bit on your bed,",
                "you'll feel better after waking up!",
            ],
        ))
    add_npc(
        Npc(
            al=al,
            name="Nobody",
            ma=al.mas.get_map_from_name("chaiyaphum"),
            x=39,
            y=57,
            sprite="mom",
            direction=Direction.RIGHT,
            standard_dialog=[
                "It's quite frustrating to meet words I never learnt,",
                "but I guess that's how it is.",
                "I heard you can learn these words in the houses along this path though.",
            ],
        ))
    add_npc(
        Npc(
            al=al,
            name="Nobody",
            ma=al.mas.get_map_from_name("chaiyaphum"),
            x=42,
            y=63,
            sprite="kid",
            direction=Direction.RIGHT,
            standard_dialog=[
                "You see how the grass is darker and taller over there?",
                "It means that more Spells will jump at you than usual.",
                "It's good if you want to meet a lot!",
                "But I find it a bit scary so I'll try to stay out.",
            ],
        ))
    add_npc(
        Npc(
            al=al,
            ma=al.mas.get_map_from_name("chaiyaphum"),
            x=51,
            y=8,
            sprite="cat",
            direction=Direction.DOWN,
        ))
    add_npc(
        Npc(
            al=al,
            ma=al.mas.get_map_from_name("chaiyaphum"),
            x=56,
            y=38,
            sprite="old_woman",
            direction=Direction.DOWN,
            standard_dialog=[
                "This, here, is a Spell.",
                "Do you know how to catch it?",
                "First, you need to know the word it is linked to.",
                "Then, you need to put it in a receptacle.",
            ],
        ))
    add_npc(
        Spell(
            al=al,
            ma=al.mas.get_map_from_name("chaiyaphum"),
            word=Word.get_by_split_form("ลม"),
            x=56,
            y=39,
        ))
    add_npc(
        Spell(
            al=al,
            ma=al.mas.get_map_from_name("chumphae"),
            word=Word.get_by_split_form("อา-ทิตย์"),
            x=114,
            y=82,
        ))
    add_npc(
        Spell(
            al=al,
            ma=al.mas.get_map_from_name("chaiyaphum"),
            word=Word.get_by_split_form("อา-ทิตย์"),
            x=33,
            y=16,
        ))
    add_npc(
        Npc(
            al=al,
            ma=al.mas.get_map_from_name("chaiyaphum"),
            x=58,
            y=43,
            sprite="kid",
            direction=Direction.UP,
            standard_dialog=[
                "You see up there?",
                "It looks like it's a Spell!",
            ],
        ))
    add_npc(
        Npc(
            al=al,
            name="kid informing stone path is also dangerous",
            ma=al.mas.get_map_from_name("chaiyaphum"),
            x=30,
            y=59,
            sprite="kid",
            direction=Direction.DOWN,
            standard_dialog=[
                "That path leads to มอหินขาว, the Thai Stonehenge.",
                "Be careful, you can also get attacked by words,",
                "on mountain paths like these!",
            ],
        ))
    add_npc(
        Npc(
            al=al,
            name="kid looking for his dog",
            ma=al.mas.get_map_from_name("chaiyaphum"),
            x=42,
            y=47,
            sprite="kid",
            direction=Direction.RIGHT,
            standard_dialog=[
                "You!",
                "I'm looking for ซูชิ, my dog!",
                "He went chasing after a Spell, and I lost him.",
                "Can you help me find him?",
                "If you do, I'll teach you the word for dog!",
                "If you find him, give him his favorite bone, and he'll follow you!",
                "[Name] receives a disgusting-looking bone.",
                "I think he went north, up that hill...",
            ],
            extra_dialog_1=[
                "I think he went north, up that hill...",
            ],
            extra_dialog_2=[
                "ซูชิ, oh I'm so happy to see you!",
                "Thank you for bringing ซูชิ back!",
                "As promised, I'll teach you the word for dog!",
            ],
            extra_dialog_3=[
                "Thank you again!",
            ],
            beginning_dialog_trigger_event=['talk_to_kid_looking_for_dog'],
        ))
    add_npc(
        Npc(
            al=al,
            name="sushi",
            ma=al.mas.get_map_from_name("chaiyaphum"),
            x=51,
            y=10,
            sprite="dog",
            direction=Direction.UP,
            standard_dialog=[
                "This is ซูชิ, the lost dog!",
                "[Name] gives the bone to ซูชิ.",
                "ซูชิ seems to recognise the bone, and follows you.",
            ],
            beginning_dialog_trigger_event=['talk_to_sushi'],
        ),
        get_event_status("talk_to_sushi") == 0)
    add_npc(
        Npc(
            al=al,
            name="Sushi",
            ma=al.mas.get_map_from_name("chaiyaphum"),
            x=42,
            y=48,
            sprite="dog",
            direction=Direction.UP,
            standard_dialog=["โฮ่ง โฮ่ง"],
        ),
        get_event_status("sushi_is_following") == 2)
Exemple #16
0
def chaiyaphum_rest_of_the_city(al):
    add_npc(
        Npc(
            al=al,
            name="Lover",
            taught=Word.get_by_split_form("ชอบ"),
            ma=al.mas.get_map_from_name("chaiyaphum"),
            x=18,
            y=82,
            sprite="mali",
            direction=Direction.LEFT,
            standard_dialog=[
                "มะลิ> Hey [Name]! I heard you're about to go on an adventure?",
                "มะลิ> Before you go... I wanted to tell you that...",
                "มะลิ> I like you.",
                "มะลิ> Let me teach you the word 'to like' so you can remember me <3",
            ],
            defeat_dialog=[
                "มะลิ> Don't forget the word, [Name]...",
                "มะลิ> We'll meet again!",
            ],
            end_dialog_trigger_event=["talk_to_lover"],
        ),
        get_event_status("talk_to_lover") == 0)
    add_npc(
        Npc(
            al=al,
            name="Policeman guarding road to Bua Yai",
            ma=al.mas.get_map_from_name("chaiyaphum"),
            x=34,
            y=98,
            sprite="policeman",
            direction=Direction.DOWN,
            standard_dialog=[
                "Sorry, the road to Bua Yai is closed at the moment.",
                "We've had many reports of people who've been under attack",
                "from Thai words gone wild.",
                "Only those knowing more than 50 Thai words are allowed to pass through.",
            ],
        ), )
    add_npc(
        Npc(
            al=al,
            name="father_of_lover",
            ma=al.mas.get_map_from_name("lover_house"),
            x=4,
            y=9,
            sprite="old_man",
            direction=Direction.RIGHT,
            standard_dialog=[
                "Hey [Name], มะลิ wanted to talk to you, she's waiting in the garden."
            ] if get_event_status("talk_to_lover") == 0 else
            ["You're looking for มะลิ? She went north, to Chumphae."],
        ))
    add_npc(
        Npc(
            al=al,
            name="สมชาย",
            taught=Word.get_by_split_form("คุณ"),
            ma=al.mas.get_map_from_name("house_rival_f2"),
            x=6,
            y=10,
            sprite="somchai",
            direction=Direction.UP,
            standard_dialog=[
                "สมชาย> [Name]! I have decided to go on an adventure to learn all the Thai words!",
                "สมชาย> What??? You too?",
                "สมชาย> Ha! I'll be your rival then!",
                "สมชาย> I learnt one already. Let me teach it to you!",
            ],
        ))
    add_npc(
        Npc(
            al=al,
            name="Nobody",
            ma=al.mas.get_map_from_name("chaiyaphum"),
            x=27,
            y=91,
            sprite="mom",
            direction=Direction.LEFT,
            standard_dialog=[
                "Did you know? You can save the game just by pressing the s key."
            ],
        ))
    add_npc(
        Npc(
            al=al,
            name="Nobody",
            ma=al.mas.get_map_from_name("chaiyaphum"),
            x=18,
            y=92,
            sprite="lass",
            direction=Direction.LEFT,
            standard_dialog=[
                "The road east is quite dangerous if you don't know Thai.",
                "I wouldn't go there myself,",
                "although I have been learning thai for three months already!",
            ],
        ))