Exemplo n.º 1
0
def doCommand(userid):
    player_entity = Player(index_from_userid(userid))
    racel = wcs.wcs.wcsplayers[userid].currace
    race = wcs.wcs.racedb.getRace(racel)
    name = race['skillnames'].split('|')
    skills = wcs.wcs.wcsplayers[userid].skills.split('|')
    levels = int(race['numberoflevels'])
    myinfo_menu = SimpleMenu()
    myinfo_menu.select_callback = myinfo_select
    myinfo_menu.append(Text('->1. %s' % player_entity.name))
    myinfo_menu.append(Text('-' * 25))
    myinfo_menu.append(
        Text('o Total level %s' % str(wcs.wcs.wcsplayers[userid].totallevel)))
    myinfo_menu.append(Text('-' * 25))
    myinfo_menu.append(
        Text('o %s: Level %s' % (str(wcs.wcs.wcsplayers[userid].currace),
                                 str(wcs.wcs.wcsplayers[userid].level))))
    for skill, level in enumerate(skills):
        myinfo_menu.append(
            Text(' - %s: [%s/%s]' % (name[skill], str(level), str(levels))))
    myinfo_menu.append(Text('-' * 25))
    myinfo_menu.append(Text('Health : %s HP' % player_entity.health))
    myinfo_menu.append(
        Text('Speed : %s%%' % str(round(player_entity.speed * 100))))
    myinfo_menu.append(
        Text('Gravity : %s%%' % str(round(player_entity.gravity * 100))))
    myinfo_menu.append(Text(' '))
    myinfo_menu.append(SimpleOption(8, 'Next', value=7))
    myinfo_menu.append(SimpleOption(9, 'Close', highlight=False))
    myinfo_menu.send(index_from_userid(userid))
Exemplo n.º 2
0
def restedexp_menu_build(menu, index):
    player = Player(index)
    steamid = player.steamid
    menu.clear()
    menu.append(Text('Rested Experience - Main Menu'))
    menu.append(Text('-----------------------------'))
    menu.append(Text('Current Rested Experience: %s' %
                     int(db[steamid]["exp"])))
    if db[steamid]["gaintrig"] and int(toggle.get_int()):
        menu.append(Text("Collect Per Kill: On"))
    else:
        if not db[steamid]["gaintrig"] and int(toggle.get_int()):
            menu.append(Text("Collect Per Kill: Off"))
        else:
            menu.append(Text("Collect Per Kill: Off (Server Setting)"))
    menu.append(
        Text("Collected Per Kill: %s (Server Setting)" % gainxp.get_int()))
    menu.append(Text("-----------------------------"))
    menu.append(Text("Gain Amount (Online): %s" % tickoxp.get_int()))
    menu.append(Text("Gain Amount (Offline): %s" % tickaxp.get_int()))
    menu.append(Text("Gain Tick Rate: %s" % timer.get_int()))
    menu.append(Text("-----------------------------"))
    menu.append(SimpleOption(1, 'Toggle Collect Per Kill', 'toggle'))
    menu.append(
        SimpleOption(2, "Check Other Player's Rested Experience", 'check'))
    menu.append(Text("-----------------------------"))
    menu.append(SimpleOption(9, 'Close', highlight=False))
Exemplo n.º 3
0
def doCommand2(userid):
    player_entity = Player(index_from_userid(userid))
    available = available_races(userid)
    left = left_to_next(userid)
    all_count = all_races()
    perc = float(available) / (float(all_count) / 100.0)
    perc = Decimal(perc)
    perc = round(perc, 2)
    rank = wcs.wcs.wcsplayers[userid].get_rank()
    myinfo2_menu = SimpleMenu()
    myinfo2_menu.select_callback = myinfo2_select
    myinfo2_menu.append(Text('->1. %s' % player_entity.name))
    myinfo2_menu.append(Text('-' * 25))
    myinfo2_menu.append(
        Text('Total level: %s' % str(wcs.wcs.wcsplayers[userid].totallevel)))
    myinfo2_menu.append(Text('-' * 25))
    myinfo2_menu.append(Text('- WCS rank: %s' % rank[0]))
    myinfo2_menu.append(Text('- Levels to next race: %s' % left))
    myinfo2_menu.append(
        Text('- Races available: %s of %s' % (available, all_count)))
    myinfo2_menu.append(Text('- Percentage of races: %s' % perc))
    myinfo2_menu.append(Text('-' * 25))
    myinfo2_menu.append(SimpleOption(7, 'Back', value=8))
    myinfo2_menu.append(Text(' '))
    myinfo2_menu.append(SimpleOption(9, 'Close', highlight=False))
    myinfo2_menu.send(index_from_userid(userid))
Exemplo n.º 4
0
def on_github_new_version_checked(version, commits):
    wcsadmin_github_info_menu._checking_cycle = None
    wcsadmin_github_info_menu[3] = SimpleOption(1, menu_strings['wcsadmin_github_info_menu check'])

    wcsadmin_github_info_confirm_commits_menu.clear()

    if version is None:
        wcsadmin_github_info_menu[4] = Text(' ')
        wcsadmin_github_info_confirm_menu[2].text.tokens['version'] = ''
    else:
        wcsadmin_github_info_menu[4] = SimpleOption(2, menu_strings['wcsadmin_github_info_menu update'])
        wcsadmin_github_info_menu[4].text.tokens['version'] = version
        wcsadmin_github_info_confirm_menu[2].text.tokens['version'] = version

        for commit in commits:
            menu = PagedMenu(title=menu_strings['wcsadmin_github_info_commits_detail_menu title'], parent_menu=wcsadmin_github_info_confirm_commits_menu)
            menu.append(Text(deepcopy(menu_strings['wcsadmin_github_info_commits_detail_menu line 1'])))
            menu.append(Text(deepcopy(menu_strings['wcsadmin_github_info_commits_detail_menu line 2'])))
            menu.append(Text(menu_strings['wcsadmin_github_info_commits_detail_menu line 3']))

            menu[0].text.tokens['name'] = commit['author']
            menu[1].text.tokens['date'] = commit['date']

            for message in commit['messages'].splitlines():
                for text in wrap('   ' + message, 50):
                    menu.append(Text(text))

            wcsadmin_github_info_confirm_commits_menu.append(PagedOption(commit['date'], value=menu))

        for index in wcsadmin_github_info_confirm_commits_menu._player_pages:
            if wcsadmin_github_info_confirm_commits_menu.is_active_menu(index):
                wcsadmin_github_info_confirm_commits_menu._refresh(index)
Exemplo n.º 5
0
def doCommand(userid):
    index = index_from_userid(userid)
    userid = int(userid)
    race = wcs.wcs.wcsplayers[userid].currace
    skills = wcs.wcs.wcsplayers[userid].all_races[race]['skills'].split('|')
    names = wcs.wcs.racedb.races[race]['skillnames'].split('|')
    n = 0
    showskills = SimpleMenu(select_callback=showskills_select)
    showskills.append(Text('Your %s skills:' % race))
    showskills.append(Text('------------------------------'))
    while n < len(names):
        try:
            level = str(skills[n])
        except IndexError:
            level = 0
        name = str(names[n])
        n += 1
        showskills.append(
            SimpleOption(n,
                         '%s : %s' % (str(name), str(level)),
                         value=None,
                         highlight=True,
                         selectable=False))
    showskills.append(Text('------------------------------'))
    showskills.append(
        Text('Unused points: %s' %
             str(wcs.wcs.wcsplayers[userid].all_races[race]['unused'])))
    showskills.append(Text('------------------------------'))
    showskills.append(
        SimpleOption(8, 'Back', value='back', highlight=True, selectable=True))
    showskills.append(SimpleOption(9, 'Close', highlight=False))
    showskills.send(index)
Exemplo n.º 6
0
    def send_menu_stats(self, kill_type, attacker_name, attacker_headshot,
                        weapon, distance, health, distance_setting,
                        use_hitgroups):
        """Send victim stats to the player via a menu."""
        wounded_only = {
            username: values
            for username, values in self.given.items()
            if username not in self.killed
        }
        killed_only = {
            username: values
            for username, values in self.given.items()
            if username in self.killed
        }
        menu = SimpleMenu()
        for num, (string_name, group) in enumerate(iterable=[
            ('Attackers', self.taken),
            ('Wounded', wounded_only),
            ('Killed', killed_only),
        ],
                                                   start=1):
            if not group:
                continue

            menu.append(
                SimpleOption(
                    choice_index=num,
                    text=TRANSLATION_STRINGS[f'Type:{string_name}'],
                    selectable=False,
                ))
            for message in self.iter_messages(
                    string_name=string_name,
                    group=group,
                    use_hitgroups=use_hitgroups,
                    distance_setting=distance_setting,
            ):
                menu.append('  ' + message)

        kill_message = self.get_kill_message(
            kill_type=kill_type,
            attacker_name=attacker_name,
            attacker_headshot=attacker_headshot,
            weapon=weapon,
            distance=distance,
            health=health,
            distance_setting=distance_setting,
        )
        if kill_message:
            menu.append(
                SimpleOption(
                    choice_index=4,
                    text=TRANSLATION_STRINGS['Type:Killer'],
                    selectable=False,
                ))
            menu.append('   ' + kill_message)

        menu.send(self.index)
Exemplo n.º 7
0
 def _build_submenus(cls, menu, index):
     """Auto build menus which inherit from the current menu"""
     i = 1
     for subcls in cls.__subclasses__():
         try:
             if check_permission(Player(index), subcls.needed_flag):
                 menu.append(SimpleOption(i, subcls.caption, subcls.menu()))
         except AttributeError:
             menu.append(SimpleOption(i, subcls.caption, subcls.menu()))
         i += 1
Exemplo n.º 8
0
 def build(cls, menu, index):
     """Auto build a SimpleMenu with his caption, back link if needed and close button"""
     menu.clear()
     menu.append(Text(cls.caption))
     cls._build_submenus(menu, index)
     if cls.__name__ != 'AdminMenu':
         try:
             menu.append(
                 SimpleOption(7,
                              menus['Back'],
                              menu.parent_menu,
                              highlight=False))
         except AttributeError:
             pass
     menu.append(SimpleOption(9, menus['Close'], highlight=False))
def send_delete_popup(index):
    if index in popups:
        popups[index].close(index)

    popup = popups[index] = SimpleMenu(select_callback=select_callback_delete)
    popup.append(Text(strings['popup delete title']))
    popup.append(
        SimpleOption(choice_index=1,
                     text=strings['popup delete no'],
                     value=False))
    popup.append(
        SimpleOption(choice_index=2,
                     text=strings['popup delete yes'],
                     value=True))
    popup.send(index)
Exemplo n.º 10
0
Arquivo: build.py Projeto: herlak/WCS
def wcsadmin_players_sub_menu_build(menu, client):
    wcsplayer = Player(client)
    accountid = wcsplayer.data['_internal_wcsadmin_player']

    if accountid is None:
        menu[0].text.tokens['name'] = menu_strings['wcsadmin_players_menu all']
        menu[2].selectable = menu[2].highlight = True
        menu[3].selectable = menu[3].highlight = True

        menu[4] = Text(' ')
    else:
        wcstarget = Player.from_accountid(accountid)

        if wcstarget.ready:
            menu[0].text.tokens['name'] = wcstarget.name
        else:
            menu[0].text.tokens['name'] = wcsplayer.data[
                '_internal_wcsadmin_player_name']

        menu[2].selectable = menu[2].highlight = wcstarget.ready
        menu[3].selectable = menu[3].highlight = wcstarget.ready

        menu[4] = SimpleOption(
            3, menu_strings['wcsadmin_players_sub_menu line 3'])
        menu[4].selectable = menu[
            4].highlight = wcstarget.ready and wcstarget.online
Exemplo n.º 11
0
def rules(userid):
	menu = SimpleMenu()
	menu.append(Text('The Rules'))
	menu.append(Text(' '))
	for i in get_rules:
		menu.append(Text('%s' % (i)))
	menu.append(Text(' '))
	menu.append(Text('Do you accept the rules?'))
	menu.append(Text(' '))
	menu.append(SimpleOption(no_button, 'No', 'No'))
	menu.append(SimpleOption(yes_button, 'Yes', 'Yes'))
	menu.append(SimpleOption(close_button, 'Close', 0))
	@menu.register_close_callback
	def on_close_checkpoints_menu(menu, index):
		queue_command_string('kickid %s You have to accept the rules!' % (userid))
	menu.select_callback = rule_menu_callback
	menu.send(index_from_userid(userid))
Exemplo n.º 12
0
 def _add_option(self, choice_index, value):
     """Add the value to the menu."""
     self.menu.append(
         SimpleOption(
             choice_index=choice_index,
             text='{:+d}'.format(value),
             value=value,
         ))
Exemplo n.º 13
0
def _admin_build_callback(menu, player_index):
    """Admin menu's build_callback function."""

    player = Player(player_index)

    menu.clear()

    if player.steamid in admins:
        menu.extend([
            Text('Admin'),
            Text(' '),
            SimpleOption(1, 'Player Management', menus['Admin Players Menu']),
            SimpleOption(2, 'Experience Rate', menus['Change Exp']),
            Text(' '),
            SimpleOption(9, _TR['Close'], 0, highlight=False)
        ])
    else:
        menu.append(Text('Not an admin!'))
Exemplo n.º 14
0
def init_popups():
    @nomination_popup.register_select_callback
    def select_callback(popup, index, option):
        mcplayers[index].nominate_callback(option.value)

    @likemap_popup.register_select_callback
    def select_callback(popup, index, option):
        mcplayers[index].likemap_callback(option.value)

    @main_popup.register_select_callback
    def select_callback(popup, index, option):
        option.value.votes += 1
        vote_progress_bar.count_vote(option.value)
        mcplayers[index].vote_callback(option.value)

    likemap_popup.append(Text(popups_strings['rate_map']))

    choice_index = 1

    # First of all, add "I Don't Care" option if it's enabled
    if config_manager['likemap_whatever_option']:

        # Add to the list
        likemap_popup.append(SimpleOption(
            choice_index=choice_index,
            text=popups_strings['whatever'],
            value=0,
        ))
        choice_index += 1

    likemap_popup.append(SimpleOption(
        choice_index=choice_index,
        text=popups_strings['likemap_like'],
        value=1,
    ))
    choice_index += 1

    likemap_popup.append(SimpleOption(
        choice_index=choice_index,
        text=popups_strings['likemap_dislike'],
        value=-1,
    ))
def send_highlight_popup(index, zombie_spawn):
    if index in popups:
        popups[index].close(index)

    popup = popups[index] = SimpleMenu(
        select_callback=select_callback_highlight)

    popup.append(SimpleOption(
            choice_index=1,
            text=strings['popup highlight next_zombie_spawn'],
            value=HighlightChoice.HL_NEXT
    ))

    popup.append(SimpleOption(
        choice_index=2,
        text=strings['popup highlight prev_zombie_spawn'],
        value=HighlightChoice.HL_PREV
    ))

    if zombie_spawn is None:
        popup.append(
            Text(strings['popup highlight current_zombie_spawn none']))
    else:
        popup.append(
            Text(strings['popup highlight current_zombie_spawn'].tokenize(
                origin=vector_to_str(zombie_spawn.origin),
                angles=vector_to_str(zombie_spawn.angles),
                classname=zombie_spawn.classname
            ))
        )

        popup.append(SimpleOption(
            choice_index=3,
            text=strings['popup highlight delete'],
            value=HighlightChoice.DELETE
        ))

    popup.send(index)
Exemplo n.º 16
0
def _admin_build_callback(menu, player_index):
    """Admin menu's build_callback function."""

    player = get_player(player_index, key='index')

    menu.clear()

    if player.steamid in admins:
        menu.extend([
            Text('Admin'),
            SimpleOption(1, 'Player Management', menus['Admin Players Menu'])
        ])
    else:
        menu.append(Text('Not an admin!'))
Exemplo n.º 17
0
def _main_menu_build(menu, index):
    menu.clear()
    menu.append(Text('WCS Menu'))
    menu.append(SimpleOption(1, 'shopmenu - buy shop items', 'shopmenu'))
    menu.append(SimpleOption(2, 'shopinfo - show item info', 'shopinfo'))
    menu.append(Text('-------------------'))
    menu.append(
        SimpleOption(3, 'showskills - show all skills levels', 'showskills'))
    menu.append(
        SimpleOption(4, 'resetskills - reset your skills', 'resetskills'))
    menu.append(
        SimpleOption(5, 'spendskills - spend skill points', 'spendskills'))
    menu.append(Text('-------------------'))
    menu.append(SimpleOption(6, 'changerace - choose your race', 'changerace'))
    menu.append(
        SimpleOption(7, 'raceinfo - show info about skills', 'raceinfo'))
    menu.append(Text('-------------------'))
    menu.append(
        SimpleOption(8, 'playerinfo - shows info about a player',
                     'playerinfo'))
    menu.append(Text('-------------------'))
    menu.append(SimpleOption(9, 'Close', highlight=False))
Exemplo n.º 18
0
    def send_winner_menu(self, player):
        """Send the winner menu to the winning player."""
        gamemode_choices = database.keys()
        if player.is_fake_client():
            self.set_choice(player, choice(gamemode_choices))
            return

        winner_menu.clear()
        for num, item in enumerate(
                sample(gamemode_choices, self._count),
                start=1,
        ):
            winner_menu.append(
                SimpleOption(
                    choice_index=num,
                    text=item,
                    value=item,
                ))
        winner_menu.send(player.index)
Exemplo n.º 19
0
    def _menu_build(self, menu, index):
        """Build the menu."""
        self.menu.clear()
        self.menu.append(self.name if self.text is None else self.text)

        # Get the player's information
        player = Player(index)
        uniqueid = player.uniqueid
        current_value = self.get_setting(index)

        description = _settings_strings['Description'].get_string(
            language=player.language,
            value=current_value,
        )
        self.menu.append(description)
        self.menu.append('-' * len(description))
        counter = 1
        if self.min is None or self.max is None or self.max - self.min > 100:
            for value in (100, -100):
                self._add_option(choice_index=counter, value=value)
                counter += 1

        if self.min is None or self.max is None or self.max - self.min > 10:
            for value in (10, -10):
                self._add_option(choice_index=counter, value=value)
                counter += 1

        for value in (1, -1):
            self._add_option(choice_index=counter, value=value)
            counter += 1

        if uniqueid not in self.current_values:
            self.current_values[uniqueid] = current_value

        self.menu.append(
            SimpleOption(
                choice_index=counter,
                text='Save ({current_value})'.format(
                    current_value=self.current_values[uniqueid], ),
                value='Save',
            ))
Exemplo n.º 20
0
def on_github_new_version_installed():
    wcsadmin_github_info_menu._installing_cycle = None
    wcsadmin_github_info_menu[3] = SimpleOption(
        1, menu_strings['wcsadmin_github_info_menu check'])
    wcsadmin_github_info_menu[4] = Text(' ')
Exemplo n.º 21
0
wcsadmin_github_info_confirm_commits_menu.title = menu_strings[
    'wcsadmin_github_info_confirm_commits_menu title']
wcsadmin_github_info_commits_menu.title = menu_strings[
    'wcsadmin_github_info_commits_menu title']

wcsadmin_github_races_menu._cycle = None
wcsadmin_github_items_menu._cycle = None
wcsadmin_github_info_menu._checking_cycle = None
wcsadmin_github_info_menu._installing_cycle = None

# ============================================================================
# >> MENU FILLER
# ============================================================================
main_menu.extend([
    Text(menu_strings['main_menu title']),
    SimpleOption(1, menu_strings['main_menu line 1'], shopmenu_menu),
    SimpleOption(2, menu_strings['main_menu line 2'], shopinfo_menu),
    Text('-------------------'),
    SimpleOption(3, menu_strings['main_menu line 3'], showskills_menu),
    SimpleOption(4, menu_strings['main_menu line 4'], resetskills_menu),
    SimpleOption(5, menu_strings['main_menu line 5'], spendskills_menu),
    Text('-------------------'),
    SimpleOption(6, menu_strings['main_menu line 6'], changerace_menu),
    SimpleOption(7, menu_strings['main_menu line 7'], raceinfo_menu),
    Text('-------------------'),
    SimpleOption(8, menu_strings['main_menu line 8'], playerinfo_menu),
    Text('-------------------'),
    SimpleOption(BUTTON_CLOSE_SLOT, menu_strings['close'], highlight=False)
])

shopinfo_detail_menu.extend([
Exemplo n.º 22
0
import wcs


def wcshelp_select(menu, index, choice):
    return


wcshelp = SimpleMenu([
    Text('Chat Commands:'),
    Text('wcshelp - This help'),
    Text('changerace - Choose your race'),
    Text('raceinfo - Show info about skills'),
    Text('shopmenu - Buy shopitems'),
    Text('shopinfo - Show item info'),
    Text('showxp - Race, level and XP'),
    Text('showskills - Show all skills levels'),
    Text('resetskills - Reset your skills'),
    Text('spendskills - Spend skill points'),
    Text('playerinfo - Shows info about a player'),
    Text('wcsadmin - Admin menu'),
    Text('wcstop - WCS top'),
    Text('wcsrank - WCS rank'),
    SimpleOption(9, 'Close', highlight=False)
],
                     select_callback=wcshelp_select)


def doCommand(userid):
    index = index_from_userid(userid)
    wcshelp.send(index)
Exemplo n.º 23
0

def _exp_select_callback(menu, player_index, choice):
    multiplier = choice.value
    cfg.exp_multiplier = multiplier
    for player in PlayerIter():
        message(
            player.index,
            '\x02Experience Values \x01changed to \x04{}x\x01, ready Next Round!'
            .format(multiplier))


menus['Change Exp'] = SimpleMenu(data=[
    Text('Change EXP Rate'),
    Text(' '),
    SimpleOption(1, '1x', 1),
    SimpleOption(2, '2x', 2),
    SimpleOption(3, '3x', 3),
    Text(' '),
    SimpleOption(9, _TR['Close'], 0, highlight=False)
],
                                 select_callback=_exp_select_callback)

# ======================================================================
# >> PLAYERS MENU
# ======================================================================


def _players_select_callback(menu, player_index, choice):
    """Admin Players menu's select_callback function."""
Exemplo n.º 24
0
    'wcsadmin_management_items_menu title']
wcsadmin_management_races_add_menu.title = menu_strings[
    'wcsadmin_management_races_add_menu title']
wcsadmin_management_items_add_menu.title = menu_strings[
    'wcsadmin_management_items_add_menu title']
wcsadmin_github_races_menu.title = menu_strings[
    'wcsadmin_github_races_menu title']
wcsadmin_github_items_menu.title = menu_strings[
    'wcsadmin_github_items_menu title']

# ============================================================================
# >> MENU FILLER
# ============================================================================
main_menu.extend([
    Text(menu_strings['main_menu title']),
    SimpleOption(1, menu_strings['main_menu line 1'], shopmenu_menu),
    SimpleOption(2, menu_strings['main_menu line 2'], shopinfo_menu),
    Text('-------------------'),
    SimpleOption(3, menu_strings['main_menu line 3'], showskills_menu),
    SimpleOption(4, menu_strings['main_menu line 4'], resetskills_menu),
    SimpleOption(5, menu_strings['main_menu line 5'], spendskills_menu),
    Text('-------------------'),
    SimpleOption(6, menu_strings['main_menu line 6'], changerace_menu),
    SimpleOption(7, menu_strings['main_menu line 7'], raceinfo_menu),
    Text('-------------------'),
    SimpleOption(8, menu_strings['main_menu line 8'], playerinfo_menu),
    Text('-------------------'),
    SimpleOption(BUTTON_CLOSE_SLOT, menu_strings['close'], highlight=False)
])

shopinfo_detail_menu.extend([
def send_highlight_popup(index, zone):
    if index in popups:
        popups[index].close(index)

    popup = popups[index] = SimpleMenu(
        select_callback=select_callback_highlight)

    popup.append(
        SimpleOption(choice_index=1,
                     text=strings['popup highlight next_zone'],
                     value=HighlightChoice.HL_NEXT))

    popup.append(
        SimpleOption(choice_index=2,
                     text=strings['popup highlight prev_zone'],
                     value=HighlightChoice.HL_PREV))

    if zone is None:
        popup.append(Text(strings['popup highlight current_zone none']))
    else:
        if zone.teleport['origin'] is None:
            teleport_origin = "- - -"
        else:
            teleport_origin = vector_to_str(zone.teleport['origin'])

        if zone.teleport['angles'] is None:
            teleport_angles = "- - -"
        else:
            teleport_angles = vector_to_str(zone.teleport['angles'])

        if zone.boost is None:
            boost = "- - -"
        else:
            boost = vector_to_str(zone.boost)

        popup.append(
            Text(strings['popup highlight current_zone'].tokenize(
                nojump=zone.nojump,
                noduck=zone.noduck,
                speed_cap=zone.speed_cap,
                teleport_origin=teleport_origin,
                teleport_angles=teleport_angles,
                boost=boost,
            )))

        popup.append(
            SimpleOption(choice_index=3,
                         text=strings['popup highlight delete'],
                         value=HighlightChoice.DELETE))

        popup.append(
            SimpleOption(choice_index=4,
                         text=strings['popup highlight toggle_nojump'],
                         value=HighlightChoice.TOGGLE_NOJUMP))

        popup.append(
            SimpleOption(choice_index=5,
                         text=strings['popup highlight toggle_noduck'],
                         value=HighlightChoice.TOGGLE_NODUCK))

    popup.send(index)
Exemplo n.º 26
0
        if has_flag(userid, 'wcsadmin_bank'):
            levelbank.wcsadmin_bank_menu.parent_menu = menu
            levelbank.doCommand(userid)
        else:
            wcs.wcs.tell(
                userid,
                '\x04[WCS] \x05You do not have \x04access \x05this menu!')
            wcs_admin_menu.send(index)
    if choice.choice_index == 9:
        menu.close(index)


wcs_admin_menu = SimpleMenu([
    Text('WCS Admin Menu'),
    Text('-------------------'),
    SimpleOption(1, 'Settings', value_1),
    SimpleOption(2, 'Give XP', value_2),
    SimpleOption(3, 'Give Levels', value_1),
    SimpleOption(4, 'Change Race', value_2),
    SimpleOption(5, 'Reset Race', value_2),
    SimpleOption(6, 'Reset Player', value_1),
    SimpleOption(7, 'Level Bank', value_2),
    Text('-------------------'),
    SimpleOption(9, 'Close', highlight=False),
],
                            select_callback=_wcs_admin_menu_select)


def get_addon_path():
    path = os.path.dirname(os.path.abspath(__file__))
    return path
Exemplo n.º 27
0
    choice.value.previous_menu = menu
    return choice.value


def _main_build_callback(menu, player_index):
    """Main menu's build_callback function."""

    player = get_player(player_index, key='index')
    menu[1].text.get_string(gold=player.gold)


menus['Main'] = SimpleMenu(
    data=[
        Text('Hero-Wars'),
        Text(_TR['Gold']),
        SimpleOption(1, _TR['Current Hero'], menus['Current Hero']),
        SimpleOption(2, _TR['Owned Heroes'], menus['Owned Heroes']),
        SimpleOption(3, _TR['Buy Heroes'], menus['Hero Buy Categories']),
        SimpleOption(4, _TR['Sell Items'], menus['Sell Items']),
        SimpleOption(5, _TR['Buy Items'], menus['Item Buy Categories']),
        SimpleOption(0, _TR['Close'])
    ],
    select_callback=_main_select_callback,
    build_callback=_main_build_callback
)

# ======================================================================
# >> PLAYERS MENU
# ======================================================================

Exemplo n.º 28
0
def doCommand(userid):
    race = wcs.wcs.wcsplayers[userid].currace
    unused = wcs.wcs.wcsplayers[userid].all_races[race]['unused']
    index = index_from_userid(userid)
    if unused:

        skills = wcs.wcs.wcsplayers[userid].all_races[race]['skills'].split(
            '|')
        db = wcs.wcs.racedb.getRace(race)
        nol = db['numberoflevels']
        if '|' in nol:
            nol = nol.split('|')
            nol = [int(x) for x in nol]
        else:
            nos = int(db['numberofskills'])
            nol_tmp = int(db['numberoflevels'])
            nol = []
            x = 0
            while x < nos:
                nol.append(nol_tmp)
                x += 1
        current_level = 0
        for x in skills:
            current_level += int(x)
        max_level = 0
        for x in nol:
            max_level += int(x)
        if current_level < max_level:
            spendskills = SimpleMenu()
            spendskills.append(Text('Available ' + race + ' skills:'))
            spendskills.append(Text('------------------------------'))

            skillnames = db['skillnames'].split('|')
            skillneeded = db['skillneeded'].split('|')

            added = 0
            for number, skill in enumerate(skills):
                added += 1
                if int(skill) >= nol[number]:
                    spendskills.append(
                        SimpleOption(number + 1,
                                     '' + str(skillnames[number]) + ' (maxed)',
                                     number + 1,
                                     highlight=False))
                else:
                    if int(
                            skillneeded[number]
                    ) > wcs.wcs.wcsplayers[userid].all_races[race]['level']:
                        spendskills.append(
                            SimpleOption(number + 1,
                                         '' + str(skillnames[number]) +
                                         ' (need level ' +
                                         skillneeded[number] + ')',
                                         number + 1,
                                         highlight=False))
                    else:
                        spendskills.append(
                            SimpleOption(number + 1,
                                         '' + str(skillnames[number]) + ': ' +
                                         str(skills[number]) + ' > ' +
                                         str(int(skills[number]) + 1),
                                         number + 1,
                                         highlight=True))
            spendskills.append(Text('------------------------------'))
            spendskills.append(Text('Unused Points: ' + str(unused)))
            spendskills.append(Text('------------------------------'))
            spendskills.append(
                SimpleOption(8, 'Back', highlight=True, selectable=True))
            spendskills.append(SimpleOption(9, 'Close', highlight=False))
            spendskills.send(index)

            spendskills.select_callback = popupHandler

        else:
            wcs.wcs.tell(
                userid,
                '\x04[WCS] \x05You have reached the \x04maximum level \x05for this race.'
            )
    else:
        wcs.wcs.tell(userid, '\x04[WCS] \x05No unused points.')
Exemplo n.º 29
0
    if choice.choice_index == 2:
        if has_flag(userid, 'goldadmin_removegold'):
            takeGolddoCommand(userid)
        else:
            SayText2('\x04[WCS] \x05You do not have \x04access \x05this menu!'
                     ).send(index)
            gold_admin_menu.send(index)

    if choice.choice_index == 9:
        menu.close(index)


gold_admin_menu = SimpleMenu([
    Text('Gold Admin Menu'),
    Text('-------------------'),
    SimpleOption(1, 'Give Gold', value_1),
    SimpleOption(2, 'Remove Gold', value_2),
    Text('-------------------'),
    SimpleOption(9, 'Close', highlight=False),
],
                             select_callback=_gold_admin_menu_select)


def get_addon_path():
    path = os.path.dirname(os.path.abspath(__file__))
    return path


@SayCommand('goldadmin')
@ClientCommand('goldadmin')
def _wcs_admin_command(command, index, team=None):