Esempio n. 1
0
def get_item_display_name(item_id):
    print(f'get item display name: item id {item_id}')
    master_dungeon = World.fetch('master_dungeon')
    item_name_comp = World.get_entity_component(item_id, NameComponent).name

    if item_name_comp in master_dungeon.identified_items:
        item_consumable = World.get_entity_component(item_id,
                                                     ConsumableComponent)
        if item_consumable:
            if item_consumable.charges > 1:
                # may crash if return to function that act on string.
                return f'{item_name_comp} - {item_consumable.charges} {Texts.get_text("CHARGES")}'
            return item_name_comp
    else:
        obfuscate_comp = World.get_entity_component(item_id,
                                                    ObfuscatedNameComponent)
        if obfuscate_comp:
            return obfuscate_comp.name
        else:
            # not an item identified, not an item with obfuscate.
            # still an item
            if World.get_entity_component(item_id, ItemComponent):
                return Texts.get_text('UNIDENTIFIED_ITEM')
            #a spell known
            known_spell = World.get_entity_component(item_id, KnownSpell)
            if known_spell:
                return Texts.get_text(known_spell.display_name)
            else:
                return Texts.get_text("UNKNOWN_SPELL_BOOK")
    return Texts.get_text("UNKNOWN")
Esempio n. 2
0
    def create_menu_content(self):
        render_order = 1
        menu_contents = list()

        # HEADER
        color = config.COLOR_MAIN_MENU_TITLE
        text = f'[color={color}] {self.header} [/color]'
        box = BoxMenu(render_order, linebreak=2, margin=1)
        render_order += 1
        box.add(text, MenuAlignement.CENTER)
        menu_contents.append(box)

        available_options = list()
        available_options.append(Texts.get_text("NO"))
        available_options.append(Texts.get_text("YES"))

        color = config.COLOR_MAIN_MENU_OPTIONS
        box = BoxMenu(render_order, linebreak=2, margin=1)
        render_order += 1
        for option in available_options:
            text = f'[color={color}]({chr(self.letter_index)}) {option}'
            box.add(text, MenuAlignement.CENTER)
            self.letter_index += 1
        menu_contents.append(box)

        # HOW TO QUIT?
        box = BoxMenu(render_order, margin=1)
        render_order += 1
        text = f' {Texts.get_text("ESCAPE_TO_CANCEL")} '
        text = f'[color=darker yellow]{text}[/color]'
        box.add(text, MenuAlignement.CENTER)
        menu_contents.append(box)

        self.menu_contents = menu_contents
Esempio n. 3
0
def option_menu_input():
    if terminal.has_input():
        key = terminal.read()
        index = terminal.state(terminal.TK_CHAR) - ord('a')
        if key == terminal.TK_ESCAPE or index == 2:
            return OptionMenuSelection.BACK_TO_MAIN_MENU
        elif key == terminal.TK_CLOSE:
            save_game(World)
            terminal.close()
            sys.exit()
        elif index == 0:
            # change language
            if Texts.get_current_language() == 'fr':
                Texts.set_language('en')
            else:
                Texts.set_language('fr')
            show_main_options_menu()
        elif index == 1:
            # graphical mode
            if Interface.mode == GraphicalModes.ASCII:
                terminal.clear()
                Interface.change_graphical_mode(GraphicalModes.TILES)
            elif Interface.mode == GraphicalModes.TILES:
                terminal.clear()
                Interface.change_graphical_mode(GraphicalModes.ASCII)
            show_main_options_menu()
    return MainMenuSelection.NO_RESPONSE
Esempio n. 4
0
    def create_menu_content(self):
        render_order = 1
        menu_contents = list()

        # HEADER
        box = BoxMenu(render_order=1, linebreak=3)
        render_order += 1
        color = config.COLOR_MAIN_MENU_TITLE
        text = f'[color={color}] {self.header} [/color]'
        box.add(text, MenuAlignement.CENTER)
        menu_contents.append(box)

        available_options = list()
        available_options.append(Texts.get_text("CHANGE_LANGUAGE"))
        available_options.append(Texts.get_text("CHANGE_GRAPHICS"))
        available_options.append(Texts.get_text("BACK_TO_MAIN_MENU"))

        box = BoxMenu(render_order, linebreak=3)
        render_order += 1
        color = config.COLOR_MAIN_MENU_OPTIONS
        for option in available_options:
            text = f'[color={color}]({chr(self.letter_index)}) {option}'
            box.add(text, MenuAlignement.CENTER)
            self.letter_index += 1
        menu_contents.append(box)

        # HOW TO QUIT?
        box = BoxMenu(render_order)
        render_order += 1
        text = f' {Texts.get_text("PRESS_ESCAPE_TO_MAIN_MENU")} '
        text = f'[color=darker yellow]{text}[/color]'
        box.add(text, MenuAlignement.CENTER)
        menu_contents.append(box)

        self.menu_contents = menu_contents
 def draw_on_image_version_1(self, database, x_image, y_image):
     list_of_arguments = ["name", "number_of_projects", "avg_color"]
     list_from_sql_1 = database.run_sql_command("""SELECT company_name, COUNT(*), NULL
                                                   FROM project WHERE main_color is NOT NULL
                                                   GROUP BY company_name""")
     list_from_sql_2 = database.run_sql_command("""SELECT company_name, main_color FROM project
                                                   WHERE main_color is NOT NULL""")
     list_from_sql = []
     for i in range(len(list_from_sql_1)):
         list_from_sql.append(list(list_from_sql_1[i]))
         list_from_sql[i][2] = []
     for i in range(len(list_from_sql_2)):
         for j in range(len(list_from_sql)):
             if list_from_sql_2[i][0] == list_from_sql[j][0]:
                 list_from_sql[j][2].append(list_from_sql_2[i][1])
     companies_object_list = Companies.get_companies_object_list(list_of_arguments, list_from_sql)
     list_text_objects = []
     list_doge = ["so", "much", "very", "many", "wow", "such", "good", "how"]
     for element in companies_object_list:
         list_text_objects.append(
             Texts(list_doge[randint(0, 7)] + ' ' + element.name, self.current_file_path + "/fonts/Prototype.ttf",
                   int(element.number_of_projects * 6),
                   element.avg_color[0],
                   element.avg_color[1], element.avg_color[2]))
     file_title = open("doge_head.txt", "r")
     doge_head = file_title.read()
     text = Texts(doge_head, self.current_file_path + "/fonts/Cousine-Regular.ttf", 14, 0, 0, 0)
     self.occupied_x.append(set(range(0, 220)))
     self.occupied_y.append(set(range(200, 500)))
     text.draw_text(0, 200, self)
     self.draw_list_text_objects(list_text_objects, x_image, y_image)
Esempio n. 6
0
def make_potion_name(used_potion_names):
    while True:
        adjectives = config.POTION_ADJECTIVES
        colors = config.POTION_COLORS
        adjective = adjectives[randint(0, len(adjectives) - 1)]
        color = colors[randint(0, len(colors) - 1)]
        name = Texts.get_text('OBFUSCATE_POTION_NAME').format(
            Texts.get_text(adjective), Texts.get_text(color))
        if name not in used_potion_names:
            return name
Esempio n. 7
0
 def display_name(self, item):
     # not generic
     if self.type == ItemMenuType.SPELL_MENU:
         item_name = Texts.get_text(item)
     else:
         item_name = Texts.get_text(get_item_display_name(item))
     item_equipped = World.get_entity_component(item, EquippedComponent)
     if item_equipped:
         equipped_info = f'({Texts.get_text("EQUIPPED")})'
     else:
         equipped_info = ''
     return item_name, equipped_info
Esempio n. 8
0
    def draw_ui_tiles(self, info_to_display):
        terminal.layer(Layers.INTERFACE.value)
        # map name
        map_name = World.fetch('current_map').name
        map_name = f'{Texts.get_text(map_name)  + " - " + str(info_to_display["depth"])}'
        center_x = (Interface.screen_width - len(map_name)) // 2
        map_name = f'[color=yellow]{map_name}[/color]'
        terminal.printf(center_x, Interface.ui_model.ui_map_name.start_y,
                        f'[color=yellow]{map_name}[/color]')

        # HP
        render_bar(Interface.ui_model.ui_player_bars.start_x,
                   Interface.ui_model.ui_player_bars.start_y,
                   config.UI_HP_BAR_WIDTH + min(info_to_display.get("player_max_hp", 0) // 2,
                                                config.UI_HP_BAR_WIDTH * 3),
                   Texts.get_text("HP"),
                   info_to_display.get("player_hp", 0),
                   info_to_display.get("player_max_hp", 0),
                   config.COLOR_HP_BAR_VALUE,
                   config.COLOR_HP_BAR_BACKGROUND,
                   config.COLOR_TEXT_HP_BAR)

        # MANA
        render_bar(Interface.ui_model.ui_player_bars.start_x,
                   Interface.ui_model.ui_player_bars.start_y + 1,
                   config.UI_MANA_BAR_WIDTH + min(info_to_display.get("player_max_mana", 0) // 2,
                                                config.UI_MANA_BAR_WIDTH * 3),
                   Texts.get_text("MANA"),
                   info_to_display.get("player_mana", 0),
                   info_to_display.get("player_max_mana", 0),
                   config.COLOR_MANA_BAR_VALUE,
                   config.COLOR_MANA_BAR_BACKGROUND,
                   config.COLOR_TEXT_MANA_BAR)

        # XP
        render_bar(Interface.ui_model.ui_player_bars.start_x,
                   Interface.ui_model.ui_player_bars.start_y + 2,
                   config.UI_XP_BAR_WIDTH + min(info_to_display.get("player_next_level_xp", 0) // 10,
                                                config.UI_XP_BAR_WIDTH * 3),
                   Texts.get_text("XP"),
                   info_to_display.get("player_current_xp", 0),
                   info_to_display.get("player_next_level_xp", 0),
                   config.COLOR_XP_BAR_VALUE,
                   config.COLOR_XP_BAR_BACKGROUND,
                   config.COLOR_TEXT_XP_BAR)

        log = World.fetch('logs')
        y = Interface.ui_model.ui_logs.start_y
        for line in log:
            if y < config.SCREEN_HEIGHT:
                print_shadow(2, y, line)
                y += 1
def newtextcontrol():
    if request.method == "POST":
        title = request.form['title']
        text = request.form['text']
        user = session['username']
        _id = uuid.uuid4().hex

        new_post = Texts(user, title, text, _id)
        new_post.save_to_db()

        return redirect(url_for("dashboardmon"))
    else:
        return render_template("controlbasiceditor.html")
Esempio n. 10
0
    def get_item_available_options(self, item):
        item_weapon = World.get_entity_component(item, MeleeWeaponComponent)
        item_equipped = World.get_entity_component(item, EquippedComponent)

        available_options = list()
        if item_weapon:
            if item_equipped:
                available_options.append(Texts.get_text('UNEQUIP_ITEM'))
            else:
                available_options.append(Texts.get_text('EQUIP_ITEM'))
        else:
            available_options.append(Texts.get_text('USE_ITEM'))
        available_options.append(Texts.get_text('DROP_ITEM'))

        return available_options
Esempio n. 11
0
        def get_texts(cls, path, fargs, languages=None):
            path = path / 'texts'
            if path.is_dir():
                texts, errors = Texts.load(
                    path,
                    languages=languages,
                    default_content=cls.get_txt_args(fargs))

                if not errors.is_empty():
                    print(errors)

            else:
                texts = Texts(languages=languages,
                              default_content=cls.get_txt_args(fargs))

            return texts
Esempio n. 12
0
    def create_menu_content(self):
        render_order = 1
        menu_contents = list()

        # HEADER
        box = BoxMenu(render_order, linebreak=3)
        render_order += 1
        color = config.COLOR_MAIN_MENU_TITLE
        text = f'[color={color}] {self.header} [/color]'
        box.add(text, MenuAlignement.CENTER)
        menu_contents.append(box)

        box = BoxMenu(render_order, linebreak=2)
        render_order += 1
        color = config.COLOR_MENU_BASE
        text = Texts.get_text("YOU_ESCAPE_DUNGEON")
        box.add(f'[color={color}]{text}[/color]', MenuAlignement.CENTER)
        menu_contents.append(box)

        # HOW TO QUIT?
        box = BoxMenu(render_order, linebreak=0)
        render_order += 1
        text = f' {Texts.get_text("PRESS_ESCAPE_TO_MAIN_MENU")} '
        text = f'[color=darker yellow]{text}[/color]'
        box.add(text, MenuAlignement.CENTER)
        menu_contents.append(box)

        self.menu_contents = menu_contents
        print('victory menu content is : ')
        for content in self.menu_contents:
            print(f'{content.content}')
def newtext():
    if request.method == "POST":
        title = request.form['title']
        text = request.form['content']
        user = session['username']
        _id = uuid.uuid4().hex

        new_post = Texts(user, title, text, _id)
        new_post.save_to_db()

        text_summary = Grammar.summary(text)
        DB.text_version(user_id=session['username'], date=datetime.datetime.utcnow(), text=text, status="new")

        return render_template("summary.html", text_summary=text_summary, text_id=_id)
    else:
        return render_template("basiceditor.html")
Esempio n. 14
0
def add_attribute_effect(effect_spawner, target):
    turns = effect_spawner.effect.turns
    World.create_entity(
        StatusEffectComponent(target),
        effect_spawner.effect.attr_bonus,
        DurationComponent(nb_turns=turns),
        NameComponent(Texts.get_text("ATTRIBUTE_MODIFIER"))
    )
    World.add_component(EquipmentChangedComponent(), target)
Esempio n. 15
0
def add_damage_over_time_effect(effect_spawner, target):
    turns = effect_spawner.effect.turns
    World.create_entity(
        StatusEffectComponent(target),
        DamageOverTimeEffect(effect_spawner.effect.damage),
        DurationComponent(nb_turns=turns),
        NameComponent(Texts.get_text("DAMAGE_OVER_TIME"))
    )
    World.add_component(EquipmentChangedComponent(), target)
Esempio n. 16
0
    def get_item_description(self, item, obfuscate=False):
        item_description = list()

        item_consumable = World.get_entity_component(item, ConsumableComponent)
        item_provide_healing = World.get_entity_component(
            item, ProvidesHealingComponent)
        item_melee_weapon = World.get_entity_component(item,
                                                       MeleeWeaponComponent)
        item_area_effect = World.get_entity_component(item,
                                                      AreaOfEffectComponent)
        item_confusion = World.get_entity_component(item, ConfusionComponent)
        item_equippable = World.get_entity_component(item, EquippableComponent)
        item_inflict_dmg = World.get_entity_component(item,
                                                      InflictsDamageComponent)
        item_magic = World.get_entity_component(item, MagicItemComponent)
        item_ranged = World.get_entity_component(item, RangedComponent)

        if item_magic:
            item_description.append(Texts.get_text("ITEM_INFO_MAGIC"))

        if item_inflict_dmg and not obfuscate:
            item_description.append(Texts.get_text("ITEM_INFO_INFLICT_DMG"))

        if item_provide_healing and not obfuscate:
            item_description.append(Texts.get_text("ITEM_INFO_HEALING"))

        if item_equippable:
            # has equipment slot
            item_description.append(Texts.get_text("ITEM_INFO_EQUIPPABLE"))

        if item_ranged and not obfuscate:
            item_description.append(
                Texts.get_text("ITEM_INFO_RANGED").format(item_ranged.range))

        if item_area_effect and not obfuscate:
            item_description.append(
                Texts.get_text("ITEM_INFO_AREA_EFFECT").format(
                    item_area_effect.radius))

        if item_confusion and not obfuscate:
            item_description.append(Texts.get_text("ITEM_INFO_CONFUSION"))

        if item_consumable:
            item_description.append(Texts.get_text("ITEM_INFO_CONSUMABLE"))

        if item_melee_weapon:
            item_description.append(Texts.get_text("ITEM_INFO_MELEE_WEAPON"))

        return item_description
Esempio n. 17
0
    def __init__(self):
        super().__init__()
        gettext = Texts()
        self.text1 = gettext.text1()
        self.text1_2 = gettext.text1_2()
        self.text1_3 = gettext.text1_3()
        self.text1_4 = gettext.text1_4()
        self.text2 = gettext.text2()
        self.text3 = gettext.text3()

        FrontEnd.main(self)
Esempio n. 18
0
def add_slow_effect(effect_spawner, target):
    turns = effect_spawner.effect.turns
    slow_effect_name = get_slow_effect_name(effect_spawner.effect.initiative_penality)
    World.create_entity(
        StatusEffectComponent(target),
        SlowSpellEffect(effect_spawner.effect.initiative_penality),
        DurationComponent(nb_turns=turns),
        NameComponent(Texts.get_text(slow_effect_name))
    )
    World.add_component(EquipmentChangedComponent(), target)
Esempio n. 19
0
    def create_menu_content(self, decorated_names_list):
        print(f'ItemMenu: create menu content for {self.type}')
        # content = (x, y, text)
        menu_contents = list()
        render_order = 1

        # header
        box = BoxMenu(render_order, linebreak=3, margin=1)
        render_order += 1
        header = f'[color={config.COLOR_SYS_MSG}] {self.header} [/color]'  # On ajoute la couleur après le len()
        box.add(header, MenuAlignement.CENTER)
        menu_contents.append(box)

        # usage explanation
        box = BoxMenu(render_order)
        render_order += 1
        selected_content = Texts.get_text(self.explanation_text)
        selected_content = f'[color={config.COLOR_INFO_INVENTORY_SELECTED_ITEM}] {selected_content} [/color]'
        box.add(selected_content, MenuAlignement.CENTER)
        menu_contents.append(box)

        # item list.
        box = BoxMenu(render_order)
        render_order += 1
        if not decorated_names_list:
            box.add(Texts.get_text(self.no_item_text), MenuAlignement.CENTER)

        for decorated_name in decorated_names_list:
            box.add(decorated_name, MenuAlignement.CENTER)
        menu_contents.append(box)

        # end : how to quit.
        box = BoxMenu(render_order)
        render_order += 1

        exit_text = f' {Texts.get_text("ESCAPE_TO_CANCEL")} '
        exit_text = f'[color=darker yellow]{exit_text}[/color]'
        box.add(exit_text, MenuAlignement.CENTER)
        menu_contents.append(box)

        self.menu_contents = menu_contents
Esempio n. 20
0
def add_confusion_effect(effect_spawner, target):
    turns = effect_spawner.effect.turns
    World.create_entity(StatusEffectComponent(target),
                        ConfusionComponent(),
                        DurationComponent(nb_turns=turns),
                        NameComponent(Texts.get_text("CONFUSION")))
    logs = World.fetch('logs')
    target_named = World.get_entity_component(target, NameComponent).name
    creator_named = World.get_entity_component(effect_spawner.creator, NameComponent).name
    if target_named and creator_named:
        if target_named != creator_named:
            logs.appendleft(f"{creator_named}{Texts.get_text('_INFLICT_CONFUSION_AT_')}{target_named}")
        else:
            logs.appendleft(f"{creator_named}{Texts.get_text('_INFLICT_CONFUSION_ON_THEMSELF')}")
    elif target_named:
        logs.appendleft(f'{target_named}{Texts.get_text("_BECOMES_CONFUSED")}')
Esempio n. 21
0
def make_scroll_name():
    name = Texts.get_text('SCROLL_OF_')
    print(f'MAKE SCROLL : Name is {name}')

    length = 4 + randint(1, 4)

    for i in range(0, length):
        if i % 2 == 0:
            voyelle = ['a', 'e', 'i', 'o', 'u', 'y']
            name += voyelle[randint(0, len(voyelle) - 1)]
        else:
            consonne = [
                'b', 'c', 'd', 'f', 'g', 'h', 'j', 'k', 'l', 'm', 'n', 'p',
                'q', 'r', 's', 't', 'v', 'w', 'x', 'z'
            ]
            name += consonne[randint(0, len(consonne) - 1)]
    return name
Esempio n. 22
0
def get_obfuscate_name(item_id):
    name_c = World.get_entity_component(item_id, NameComponent)
    magic_c = World.get_entity_component(item_id, MagicItemComponent)

    if name_c:
        if magic_c:
            identified_items = World.fetch('master_dungeon').identified_items
            obfuscate_c = World.get_entity_component(item_id,
                                                     ObfuscatedNameComponent)
            if name_c.name in identified_items:
                return name_c.name
            elif obfuscate_c:
                return obfuscate_c.name
            else:
                return Texts.get_text('UNIDENTIFIED_ITEM')
        else:
            return name_c.name
    else:
        print(f'get_obfuscate_name : nameless object send : entity {item_id}.')
        raise NotImplementedError
Esempio n. 23
0
    def update(self, *args, **kwargs):
        subjects = World.get_components(EntityMovedComponent, PositionComponent)
        current_map = World.fetch('current_map')
        remove_entities = []

        for entity, (has_moved, position, *args) in subjects:
            idx = current_map.xy_idx(position.x, position.y)
            for entity_id in current_map.tile_content[idx]:
                if entity is not entity_id:
                    maybe_trigger = World.get_entity_component(entity_id, EntryTriggerComponent)
                    if not maybe_trigger:
                        continue
                    else:
                        # Triggering!
                        logs = World.fetch('logs')
                        entity_id_name = get_obfuscate_name(entity_id)
                        if entity_id_name:
                            final_log_trigger = Texts.get_text("_TRIGGERS").format(Texts.get_text(entity_id_name))
                        else:
                            final_log_trigger = Texts.get_text("SOMETHING_TRIGGERS")

                        # Dodge effect!
                        if skill_roll_against_difficulty(entity, Skills.FOUND_TRAPS, config.DEFAULT_TRAP_DODGE):
                            final_log_consequence = Texts.get_text('YOU_DODGE_IT')

                        else:
                            # effects werent dodge
                            final_log_consequence = Texts.get_text('IT_HITS_YOU')
                            aoe_component = World.get_entity_component(entity_id, AreaOfEffectComponent)
                            if aoe_component:
                                target = Targets(TargetType.TILES,
                                                 tiles=get_aoe_tiles(current_map.xy_idx(position.x, position.y),
                                                                     aoe_component.radius))
                            else:
                                target = Targets(TargetType.TILE, tile=entity_position(entity))
                            add_effect(entity_id, Effect(EffectType.TRIGGER_FIRE, trigger=entity_id), target)

                            """

                            inflict_dmg = World.get_entity_component(entity_id, InflictsDamageComponent)
                            if inflict_dmg:
                                ParticuleBuilder.request(position.x, position.y,
                                                         config.COLOR_PARTICULE_HIT, '!!', 'particules/attack.png')
                                suffer_dmg = SufferDamageComponent(inflict_dmg.damage, from_player=False)
                                World.add_component(suffer_dmg, entity)
                            
                            """
                        logs.appendleft(f"[color={config.COLOR_MAJOR_INFO}]"
                                        f"{final_log_trigger} {final_log_consequence}"
                                        f"[/color]")

                        """
                        activation = World.get_entity_component(entity_id, ActivationComponent)
                        if activation:
                            activation.nb_activations -= 1
                            if not activation.nb_activations:
                                remove_entities.append(entity_id)

                        hidden = World.get_entity_component(entity_id, HiddenComponent)
                        if hidden:
                            World.remove_component(hidden, entity_id)
                        """

        World.remove_component_for_all_entities(EntityMovedComponent)
        for entity in remove_entities:
            World.delete_entity(entity)
Esempio n. 24
0
def show_game_over_menu():
    terminal.clear()
    game_over_menu = GameOverMenu(Texts.get_text("GAME_OVER"))
    game_over_menu.initialize()
Esempio n. 25
0
def show_main_menu():
    terminal.clear()
    main_menu = MainMenu(Texts.get_text("GAME_TITLE"))
    main_menu.initialize()
Esempio n. 26
0
def show_main_options_menu():
    terminal.clear()
    main_options_menu = MainOptionsMenu(Texts.get_text("OPTIONS_MENU"))
    main_options_menu.initialize()
Esempio n. 27
0
def show_victory_menu():
    terminal.clear()
    victory_menu = VictoryMenu(Texts.get_text("VICTORY"))
    victory_menu.initialize()
Esempio n. 28
0
def show_quit_game_menu():
    quit_game_menu = QuitGameMenu(Texts.get_text("QUIT_GAME_QUESTION"))
    quit_game_menu.initialize()
Esempio n. 29
0
def show_spell_menu():
    spell_menu = ItemMenu(Texts.get_text("SPELL_MENU"),
                          ItemMenuType.SPELL_MENU)
    spell_menu.initialize()
Esempio n. 30
0
def init_game(master_seed=None):
    if master_seed:
        seed(master_seed)
        World.insert('seed', master_seed)

    # create systems.
    World.add_system(ItemCollectionSystem())

    World.add_system(UseEquipSystem())

    World.add_system(ItemUseSystem())

    World.add_system(SpellUseSystem())

    World.add_system(ItemDropSystem())

    World.add_system(ItemRemoveSystem())

    World.add_system(ItemIdentificationSystem())

    World.add_system(EquipmentChangeSystem())

    World.add_system(VisibilitySystem())

    World.add_system(MapIndexingSystem())

    World.add_system(TriggerSystem())

    World.add_system(MonsterAi())

    World.add_system(MeleeCombatSystem())

    World.add_system(EffectSystem())

    World.add_system(ParticuleSpawnSystem())

    World.add_system(InitiativeSystem())

    World.add_system(TurnStatusEffectSystem())

    # add player position to ressources
    player = spawn_player(0, 0)
    World.insert('player', player)

    master_dungeon = MasterDungeon()
    World.insert('master_dungeon', master_dungeon)
    state = World.fetch('state')
    state.generate_world_map(1)

    # add logs
    log_entry = deque()
    log_entry.append(Texts.get_text("WELCOME_MESSAGE"))
    World.insert('logs', log_entry)

    # add tooltips
    tooltip = list()
    World.insert('tooltip', (tooltip, 0, 0))

    # spawn all spell templates.
    from data_raw_master.raw_master import RawsMaster
    RawsMaster.spawn_all_spells()
Esempio n. 31
0
def menu():
    texts = Texts()

    passenger = Passenger()
    dao = BusDao()

    if os.path.exists(dao.path):
        dao.set_passenger(passenger, texts)

    choice = ""
    while choice != "0":

        views = Views(texts)
        choice = multipy_input(texts.show_menutext())

        if choice == "1":
            passenger.set_bus_lines(multipy_input(texts.busline_input_text))

        elif choice == "2":
            views.show_near_lines(passenger, dao)

        elif choice == "3":
            views.show_bus_lines(passenger, dao)

        elif choice == "4":
            passenger.bus_lines_del(multipy_input(texts.busline_input_text))

        elif choice == "5":
            views.show_near(passenger, dao)

        elif choice == "6":
            passenger.show_bus_lines()

        elif choice == "7":
            views.open_map(passenger, dao, (multipy_input(texts.busid_input_text)))

        elif choice == "8":
            views.show_by_id(passenger, dao, (multipy_input(texts.busid_input_text)))

        elif choice == "9":
            views.show_fastests(passenger, dao)

        elif choice == "10":
            views.show_all(passenger, dao)

        elif choice == "11":
            views.open_map_manually(multipy_input(texts.latitude_input_text), multipy_input(texts.longitude_input_text))

        elif choice == "12":
            try:
                passenger.set_latitude(multipy_input(texts.latitude_input_text))
                passenger.set_longitude(multipy_input(texts.longitude_input_text))
            except:
                print("=(")
        elif choice == "13":
            try:
                passenger.maxdistance = multipy_input(texts.max_distance_intext)
            except:
                print("=(")

        elif choice == "14":
            try:
                passenger.minspeed = multipy_input(texts.min_speed_text)
            except:
                print("=(")

        elif choice == "97":
            print("%s %s" % (texts.language_text, texts.language))
            passenger.show(texts.passenger_text)

        elif choice == "98":
            dao.write_user_config(passenger, texts)

        elif choice == "99":
            texts.language = multipy_input(texts.lang_chtext)
            print(texts.language)
        else:
            if choice != "0":
                print("\n=(\n")
            else:
                print("\n=)\n")
Esempio n. 32
0
    def create_menu_content(self):
        # header = Texts.get_text('CHARACTER_SHEET_HEADER')
        render_order = 1
        menu_contents = list()
        player = World.fetch('player')
        player_attributes = World.get_entity_component(player,
                                                       AttributesComponent)
        player_pools = World.get_entity_component(player, Pools)
        player_skills = World.get_entity_component(player, SkillsComponent)

        # header
        box = BoxMenu(render_order, linebreak=3)
        render_order += 1
        header = f'[color={config.COLOR_SYS_MSG}] {self.header} [/color]'
        box.add(header, MenuAlignement.CENTER)
        menu_contents.append(box)

        # CENTER TOP
        # level
        color = config.COLOR_MENU_BASE
        box = BoxMenu(render_order, linebreak=3)
        render_order += 1
        text = Texts.get_text('CHARACTER_SHEET_CONTENT_LEVEL').format(
            player_pools.level)
        box.add(f'[color={color}]{text}[/color]', MenuAlignement.CENTER)

        text = Texts.get_text('CHARACTER_SHEET_CONTENT_XP').format(
            player_pools.xp, xp_for_next_level(player_pools.level))
        box.add(f'[color={color}]{text}[/color]', MenuAlignement.CENTER)
        menu_contents.append(box)

        # LEFT
        # attributes
        box = BoxMenu(render_order, linebreak=3)
        render_order += 1
        color = config.COLOR_MENU_SUBTITLE_BASE
        text = Texts.get_text('CHARACTER_SHEET_CONTENT_ATTRIBUTES')
        box.add(f'[color={color}]{text}[/color]', MenuAlignement.CENTER)

        color = config.COLOR_MENU_BASE
        text = Texts.get_text(
            'CHARACTER_SHEET_CONTENT_MIGHT') + f'{player_attributes.might.value} + ' \
                                               f'{player_attributes.might.bonus_value - player_attributes.might.value}'
        box.add(f'[color={color}]{text}[/color]', MenuAlignement.CENTER)

        text = Texts.get_text(
            'CHARACTER_SHEET_CONTENT_BODY') + f'{player_attributes.body.value} + ' \
                                              f'{player_attributes.body.bonus_value - player_attributes.body.value}'
        box.add(f'[color={color}]{text}[/color]', MenuAlignement.CENTER)

        text = Texts.get_text(
            'CHARACTER_SHEET_CONTENT_QUICKNESS') + f'{player_attributes.quickness.value} + ' \
                                                   f'{player_attributes.quickness.bonus_value - player_attributes.quickness.value}'
        box.add(f'[color={color}]{text}[/color]', MenuAlignement.CENTER)

        text = Texts.get_text(
            'CHARACTER_SHEET_CONTENT_WITS') + f'{player_attributes.wits.value} + ' \
                                              f'{player_attributes.wits.bonus_value - player_attributes.wits.value}'
        box.add(f'[color={color}]{text}[/color]', MenuAlignement.CENTER)
        menu_contents.append(box)

        # RIGHT
        # skills
        box = BoxMenu(render_order, linebreak=3)
        render_order += 1
        color = config.COLOR_MENU_SUBTITLE_BASE
        text = Texts.get_text('CHARACTER_SHEET_CONTENT_SKILLS')
        box.add(f'[color={color}]{text}[/color]', MenuAlignement.CENTER)

        color = config.COLOR_MENU_BASE
        for skill in player_skills.skills:
            text = Texts.get_text(
                f'{skill}') + f': {player_skills.skills[skill]}'
            box.add(f'[color={color}]{text}[/color]', MenuAlignement.CENTER)
        menu_contents.append(box)

        # BOTTOM: Equipped?

        # HOW TO QUIT?
        box = BoxMenu(render_order, linebreak=0)
        render_order += 1
        text = f' {Texts.get_text("ESCAPE_TO_CANCEL")} '
        text = f'[color=darker yellow]{text}[/color]'
        box.add(text, MenuAlignement.CENTER)
        menu_contents.append(box)

        self.menu_contents = menu_contents