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)
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)
def execute_event(event: str, al: 'All'): status = get_event_status(event) function_name = f"_{event}_{status}" increment_event(event) try: method = getattr(events, function_name) method(al) except AttributeError: print(f'Could not find method {function_name} in events.py!')
def sushi_is_following(al): if get_event_status("sushi_is_following") == 1: al.learner.followers.append( Follower( al, direction=Direction.DOWN, sprite='dog', name='ซูชิ', x=-1, y=-1, ))
def letter_islands(al): if get_event_status("nim_is_following") == 1: al.learner.followers.append( Follower( al, direction=al.learner.direction, sprite='nim', name='Nim', x=al.learner.x, y=al.learner.y, )) if al.mas.current_map.filename == "ko_kut": if get_event_status("spirit_bird_is_beaten") == 1: from npc.import_npcs.ko_kut import spirit_bird_victory_callback spirit_bird_victory_callback(al) else: al.weather = Weather( al=al, rain=True, wind=30, overlay=Overlay(color=(30, 30, 30), transparency=92), lightning=True, ) if al.mas.current_map.filename == "ko_mak": if get_event_status("spirit_gecko_is_beaten") == 1: from npc.import_npcs.ko_kut import spirit_bird_victory_callback spirit_bird_victory_callback(al) else: al.weather = Weather( al=al, # rain=True, # wind=30, # overlay=Overlay(color=(30, 30, 30), transparency=92), # lightning=True, quake=True, )
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)
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!", ], ))
def garbage(al): add_npc( Npc( al=al, name="garbage_0", ma=al.mas.get_map_from_name("ko_mak"), x=34, y=16, sprite="garbage_0", standard_dialog=["[Name] picks up the garbage."], beginning_dialog_trigger_event=['picks_up_garbage_0'], ), condition=get_event_status("picks_up_garbage_0") == 0, ) add_npc( Npc( al=al, name="garbage_1", ma=al.mas.get_map_from_name("ko_mak"), x=30, y=10, sprite="garbage_1", standard_dialog=["[Name] picks up the garbage."], beginning_dialog_trigger_event=['picks_up_garbage_1'], ), condition=get_event_status("picks_up_garbage_0") == 0, ) add_npc( Npc( al=al, name="garbage_2", ma=al.mas.get_map_from_name("ko_mak"), x=37, y=12, sprite="garbage_2", standard_dialog=["[Name] picks up the garbage."], beginning_dialog_trigger_event=['picks_up_garbage_2'], ), condition=get_event_status("picks_up_garbage_0") == 0, ) add_npc( Npc( al=al, name="garbage_3", ma=al.mas.get_map_from_name("ko_mak"), x=22, y=12, sprite="garbage_3", standard_dialog=["[Name] picks up the garbage."], beginning_dialog_trigger_event=['picks_up_garbage_3'], ), condition=get_event_status("picks_up_garbage_3") == 0, ) add_npc( Npc( al=al, name="garbage_4", ma=al.mas.get_map_from_name("ko_mak"), x=26, y=12, sprite="garbage_0", standard_dialog=["[Name] picks up the garbage."], beginning_dialog_trigger_event=['picks_up_garbage_4'], ), condition=get_event_status("picks_up_garbage_4") == 0, ) add_npc( Npc( al=al, name="garbage_5", ma=al.mas.get_map_from_name("ko_mak"), x=25, y=12, sprite="garbage_1", standard_dialog=["[Name] picks up the garbage."], beginning_dialog_trigger_event=['picks_up_garbage_5'], ), condition=get_event_status("picks_up_garbage_5") == 0, ) add_npc( Npc( al=al, name="garbage_6", ma=al.mas.get_map_from_name("ko_mak"), x=19, y=15, sprite="garbage_2", standard_dialog=["[Name] picks up the garbage."], beginning_dialog_trigger_event=['picks_up_garbage_6'], ), condition=get_event_status("picks_up_garbage_6") == 0, ) add_npc( Npc( al=al, name="garbage_7", ma=al.mas.get_map_from_name("ko_mak"), x=18, y=21, sprite="garbage_3", standard_dialog=["[Name] picks up the garbage."], beginning_dialog_trigger_event=['picks_up_garbage_7'], ), condition=get_event_status("picks_up_garbage_7") == 0, ) add_npc( Npc( al=al, name="garbage_8", ma=al.mas.get_map_from_name("ko_mak"), x=26, y=21, sprite="garbage_0", standard_dialog=["[Name] picks up the garbage."], beginning_dialog_trigger_event=['picks_up_garbage_8'], ), condition=get_event_status("picks_up_garbage_8") == 0, ) add_npc( Npc( al=al, name="garbage_9", ma=al.mas.get_map_from_name("ko_mak"), x=12, y=14, sprite="garbage_1", standard_dialog=["[Name] picks up the garbage."], beginning_dialog_trigger_event=['picks_up_garbage_9'], ), condition=get_event_status("picks_up_garbage_9") == 0, ) add_npc( Npc( al=al, name="garbage_10", ma=al.mas.get_map_from_name("ko_mak"), x=10, y=22, sprite="garbage_2", standard_dialog=["[Name] picks up the garbage."], beginning_dialog_trigger_event=['picks_up_garbage_10'], ), condition=get_event_status("picks_up_garbage_10") == 0, ) add_npc( Npc( al=al, name="garbage_11", ma=al.mas.get_map_from_name("ko_mak"), x=11, y=21, sprite="garbage_3", standard_dialog=["[Name] picks up the garbage."], beginning_dialog_trigger_event=['picks_up_garbage_11'], ), condition=get_event_status("picks_up_garbage_11") == 0, ) add_npc( Npc( al=al, name="garbage_12", ma=al.mas.get_map_from_name("ko_mak"), x=8, y=14, sprite="garbage_0", standard_dialog=["[Name] picks up the garbage."], beginning_dialog_trigger_event=['picks_up_garbage_12'], ), condition=get_event_status("picks_up_garbage_12") == 0, )