Exemple #1
0
	async def on_start(self):
		# Register permissions + commands.
		await self.instance.permission_manager.register('clear', 'Clear the jukebox', app=self, min_level=1)
		await self.instance.command_manager.register(
			Command(command='clearjukebox', aliases=['cjb'], target=self.clear_jukebox, perms='jukebox:clear', admin=True,
					description='Clears the current maps from the jukebox.'),
			Command(command='list', target=self.show_map_list,
					description='Displays the maps currently in the jukebox.').add_param(name='search', required=False),
			Command(command='jukebox', target=self.chat_command,
					description='Provides access to the jukebox commands.').add_param(name='option', required=False),
			Command(command='mapfolders', aliases=['mf'], target=self.show_map_folders,
					description='Shows the available (personal) map folders.'),
		)

		# Register settings.
		await self.context.setting.register(self.setting_newest_days_range, self.setting_allow_juking)

		# Register callback.
		self.context.signals.listen(mp_signals.flow.podium_start, self.podium_start)

		# Add button to the map list for adding to a folder.
		MapListView.add_action(self.add_to_folder, 'Add to folder', '', order=-50)

		# Fetch all folders.
		await self.folder_manager.on_start()
Exemple #2
0
    async def on_start(self):
        # Register permissions + commands.
        await self.instance.permission_manager.register('clear',
                                                        'Clear the jukebox',
                                                        app=self,
                                                        min_level=1)
        await self.instance.command_manager.register(
            Command(command='cjb',
                    target=self.clear_jukebox,
                    perms='jukebox:clear',
                    admin=True),
            Command(command='clearjukebox',
                    target=self.clear_jukebox,
                    perms='jukebox:clear',
                    admin=True),
            Command(command='list',
                    target=self.show_map_list).add_param(name='search',
                                                         required=False),
            Command(command='jukebox',
                    target=self.chat_command).add_param(name='option',
                                                        required=False),
            Command(command='mapfolders', target=self.show_map_folders))

        # Register callback.
        self.context.signals.listen(mp_signals.flow.podium_start,
                                    self.podium_start)

        # Add button to the map list for adding to a folder.
        MapListView.add_action(self.add_to_folder,
                               'Add to folder',
                               '',
                               order=-50)

        # Fetch all folders.
        await self.folder_manager.on_start()
Exemple #3
0
	async def on_start(self):
		await self.instance.permission_manager.register('previous', 'Skip to the previous map', app=self.app, min_level=1)
		await self.instance.permission_manager.register('next', 'Skip to the next map', app=self.app, min_level=1)
		await self.instance.permission_manager.register('restart', 'Restart the maps', app=self.app, min_level=1)
		await self.instance.permission_manager.register('replay', 'Replay the maps', app=self.app, min_level=1)
		await self.instance.permission_manager.register('extend', 'Extend the TA limit', app=self.app, min_level=1)
		await self.instance.permission_manager.register('add_local_map', 'Add map from server disk', app=self.app, min_level=2)
		await self.instance.permission_manager.register('remove_map', 'Remove map from server', app=self.app, min_level=2)
		await self.instance.permission_manager.register('write_map_list', 'Write Matchsettings to file', app=self.app, min_level=2)
		await self.instance.permission_manager.register('read_map_list', 'Read and load specific Matchsettings file', app=self.app, min_level=2)
		await self.instance.permission_manager.register('shuffle', 'Shuffle map list order', app=self.app, min_level=2)

		await self.app.context.setting.register(self.setting_juke_after_adding)

		await self.instance.command_manager.register(
			Command(command='next', target=self.next_map, perms='admin:next', admin=True),
			Command(command='skip', target=self.next_map, perms='admin:next', admin=True),
			Command(command='previous', aliases=['prev'], target=self.prev_map, perms='admin:previous', admin=True),
			Command(command='restart', aliases=['res', 'rs'], target=self.restart_map, perms='admin:restart', admin=True),
			Command(command='replay', target=self.replay_map, perms='admin:replay', admin=True),
			Command(command='local', namespace='add', target=self.add_local_map, perms='admin:add_local_map', admin=True)
				.add_param('map', nargs=1, type=str, required=True, help='Map filename (relative to Maps directory).'),
			Command(command='remove', target=self.remove_map, perms='admin:remove_map', admin=True, description='Remove map from maplist.')
				.add_param('nr', required=False, type=int, help='The number from a list window or the unique identifier.'),
			Command(command='erase', target=self.erase_map, perms='admin:remove_map', admin=True, description='Remove and delete map from maplist and disk.')
				.add_param('nr', required=False, type=int, help='The number from a list window or the unique identifier.'),
			Command(command='writemaplist', aliases=['wml'], target=self.write_map_list, perms='admin:write_map_list', admin=True)
				.add_param('file', required=False, type=str, help='Give custom match settings file to save to.'),
			Command(command='readmaplist', aliases=['rml'], target=self.read_map_list, perms='admin:read_map_list', admin=True)
				.add_param('file', required=True, type=str, help='Give custom match settings file to load from.'),
			Command(command='shuffle', target=self.shuffle, perms='admin:shuffle', admin=True),
			Command(command='extend', target=self.extend, perms='admin:extend', admin=True)
				.add_param('seconds', required=False, type=int, help='Extend the TA limit with given seconds.'),
		)

		# If jukebox app is loaded, register the map actions.
		if 'jukebox' in self.instance.apps.apps:
			from pyplanet.apps.contrib.jukebox.views import MapListView
			MapListView.add_action(self.list_action_remove, 'Delete', '')
Exemple #4
0
	async def show_map_list(self, player, data, **kwargs):
		view = MapListView(self, player)
		if data.search is not None:
			view.search_text = data.search
		await view.display()