Exemplo n.º 1
0
    def _finish(self):
        '''Updates GunGame info and clears the queue'''

        # Update GunGame info
        gungame_info('update')

        # Clear the queue
        self.clear()
Exemplo n.º 2
0
def initialize():
    '''Tries to initialize GunGame'''

    # Load GunGame's events
    load_events()

    # Load custom events
    gg_resource_file.declare_and_load()

    # Load the base translations
    load_translation('gungame', 'gungame')

    # Send message about GunGame loading
    es.dbgmsg(0, langstring("Load_Start",
            {'version': gungame_info('version')}))

    # Load config files
    load_configs()

    # Load weapon orders
    WeaponOrderManager().load_orders()

    # Load menus
    MenuManager().load_menus()

    # Make the sounds downloadable
    make_downloadable(True)

    # Pause a moment for the configs to be loaded (OB engine requires this)
    delayed(0.1, complete_initialization)
Exemplo n.º 3
0
def initialize():
    '''Tries to initialize GunGame'''

    # Load GunGame's events
    load_events()

    # Load custom events
    gg_resource_file.declare_and_load()

    # Load the base translations
    load_translation('gungame', 'gungame')

    # Send message about GunGame loading
    es.dbgmsg(0, langstring("Load_Start",
                            {'version': gungame_info('version')}))

    # Load config files
    load_configs()

    # Load weapon orders
    WeaponOrderManager().load_orders()

    # Load menus
    MenuManager().load_menus()

    # Make the sounds downloadable
    make_downloadable(True)

    # Pause a moment for the configs to be loaded (OB engine requires this)
    delayed(0.1, complete_initialization)
Exemplo n.º 4
0
def make_log_file():
    # Log file header
    header = [
        '*' * 79 + '\n', '*' + ' ' * 77 + '*\n',
        '*' + 'GUNGAME v5.1 ERROR LOGGING'.center(77) + '*' + '\n',
        '*' + 'HTTP://FORUMS.GUNGAME.NET/'.center(77) + '*\n',
        '*' + ' ' * 77 + '*\n',
        ('*' + 'GG VERSION: '.rjust(19) + gungame_info('version').ljust(19) +
         'IP: '.rjust(19) + str(ip).upper().ljust(15) + ' ' * 5 + '*\n'),
        ('*' + 'SPE VERSION: '.rjust(19) + str(spe_version_var).ljust(19) +
         'PORT: '.rjust(19) + str(port).ljust(15) + ' ' * 5 + '*\n'),
        ('*' + 'PLATFORM: '.rjust(19) + str(OS).upper().ljust(19) +
         'DATE: '.rjust(19) + strftime('%m-%d-%Y').ljust(15) + ' ' * 5 +
         '*\n'),
        ('*' + 'ES VERSION: '.rjust(19) + str(eventscripts_ver).ljust(19) +
         'ES CORE VERSION: '.rjust(19) + str(es_corelib_ver).ljust(15) +
         ' ' * 5 + '*\n'),
        ('*' + 'MM VERSION: '.rjust(19) + str(metamod_version).ljust(19) +
         'SM VERSION: '.rjust(19) + str(sourcemod_version).ljust(15) +
         ' ' * 5 + '*\n'),
        ('*' + 'MANI VERSION: '.rjust(19) +
         str(mani_admin_plugin_version).ljust(19) + 'EST VERSION: '.rjust(19) +
         str(est_version).ljust(15) + ' ' * 5 + '*\n'), '*' + ' ' * 77 + '*\n',
        '*' * 79 + '\n', '\n', '\n'
    ]

    # Does the file allready exists ?
    if file_name.isfile():

        # Read the file
        with file_name.open() as log_file:

            readlines = log_file.readlines()

        # Does the header match ?
        for i in range(len(header)):
            if readlines[i] != header[i]:
                if i == 7 and header[7][20:39] == readlines[7][20:39]:
                    continue
                break

        # Header matched, use this file
        else:
            return

        # Find a new file name for the old file
        n = 0

        while True:
            n += 1
            new_file_name = (
                get_game_dir('cfg/gungame51/logs') +
                '/GunGame%s' % gungame_info('version').replace('.', '_') +
                '_Log_Old[%01i].txt' % n)
            if not new_file_name.isfile():
                break

        # Make new file w/ old errors
        with new_file_name.open('w') as log_file:
            log_file.writelines(readlines)

    # Start new log file
    with file_name.open('w') as log_file:
        log_file.writelines(header)

    global file_created
    file_created = True
Exemplo n.º 5
0
# >> GLOBAL VARIABLES
# =============================================================================
# Server Vars
spe_version_var = es.ServerVar('spe_version')
eventscripts_ver = es.ServerVar('eventscripts_ver')
es_corelib_ver = es.ServerVar('es_corelib_ver')
ip = es.ServerVar('ip')
port = es.ServerVar('hostport')
metamod_version = es.ServerVar('metamod_version')
sourcemod_version = es.ServerVar('sourcemod_version')
mani_admin_plugin_version = es.ServerVar('mani_admin_plugin_version')
est_version = es.ServerVar('est_version')

# Other vars
file_name = get_game_dir('cfg/gungame51/logs' + '/GunGame%s_Log.txt' %
                         gungame_info('version').replace('.', '_'))

file_created = False

OS = get_os()


# =============================================================================
# >> TRACEBACK EVENT
# =============================================================================
def gungame_except_hook(tb_type, value, trace_back, mute_console=False):
    # If this error was called to stop an attribute from being set, do not log
    # it.
    if str(value) == "gg_cancel_callback":
        return
Exemplo n.º 6
0
def make_log_file():
    # Log file header
    header = ['*' * 79 + '\n', '*' + ' ' * 77 + '*\n',
              '*' + 'GUNGAME v5.1 ERROR LOGGING'.center(77) + '*' + '\n',
              '*' + 'HTTP://FORUMS.GUNGAME.NET/'.center(77) + '*\n',
              '*' + ' ' * 77 + '*\n',
              ('*' + 'GG VERSION: '.rjust(19) +
                gungame_info('version').ljust(19) + 'IP: '.rjust(19) +
                str(ip).upper().ljust(15) + ' ' * 5 + '*\n'),
              ('*' + 'SPE VERSION: '.rjust(19) +
                str(spe_version_var).ljust(19) +
                'PORT: '.rjust(19) + str(port).ljust(15) + ' ' * 5 + '*\n'),
              ('*' + 'PLATFORM: '.rjust(19) + str(OS).upper().ljust(19) +
                'DATE: '.rjust(19) + strftime('%m-%d-%Y').ljust(15) +
                ' ' * 5 + '*\n'), ('*' + 'ES VERSION: '.rjust(19) +
               str(eventscripts_ver).ljust(19) +
               'ES CORE VERSION: '.rjust(19) + str(es_corelib_ver).ljust(15) +
               ' ' * 5 + '*\n'), ('*' + 'MM VERSION: '.rjust(19) +
               str(metamod_version).ljust(19) + 'SM VERSION: '.rjust(19) +
               str(sourcemod_version).ljust(15) + ' ' * 5 + '*\n'),
               ('*' + 'MANI VERSION: '.rjust(19) +
               str(mani_admin_plugin_version).ljust(19) +
               'EST VERSION: '.rjust(19) + str(est_version).ljust(15) +
               ' ' * 5 + '*\n'),
               '*' + ' ' * 77 + '*\n', '*' * 79 + '\n', '\n', '\n']

    # Does the file allready exists ?
    if file_name.isfile():

        # Read the file
        with file_name.open() as log_file:

            readlines = log_file.readlines()

        # Does the header match ?
        for i in range(len(header)):
            if readlines[i] != header[i]:
                if i == 7 and header[7][20:39] == readlines[7][20:39]:
                    continue
                break

        # Header matched, use this file
        else:
            return

        # Find a new file name for the old file
        n = 0

        while True:
            n += 1
            new_file_name = (get_game_dir('cfg/gungame51/logs') +
                '/GunGame%s' % gungame_info('version').replace('.', '_') +
                '_Log_Old[%01i].txt' % n)
            if not new_file_name.isfile():
                break

        # Make new file w/ old errors
        with new_file_name.open('w') as log_file:
            log_file.writelines(readlines)

    # Start new log file
    with file_name.open('w') as log_file:
        log_file.writelines(header)

    global file_created
    file_created = True
Exemplo n.º 7
0
# >> GLOBAL VARIABLES
# =============================================================================
# Server Vars
spe_version_var = es.ServerVar('spe_version')
eventscripts_ver = es.ServerVar('eventscripts_ver')
es_corelib_ver = es.ServerVar('es_corelib_ver')
ip = es.ServerVar('ip')
port = es.ServerVar('hostport')
metamod_version = es.ServerVar('metamod_version')
sourcemod_version = es.ServerVar('sourcemod_version')
mani_admin_plugin_version = es.ServerVar('mani_admin_plugin_version')
est_version = es.ServerVar('est_version')

# Other vars
file_name = get_game_dir('cfg/gungame51/logs' +
              '/GunGame%s_Log.txt' % gungame_info('version').replace('.', '_'))

file_created = False

OS = get_os()


# =============================================================================
# >> TRACEBACK EVENT
# =============================================================================
def gungame_except_hook(tb_type, value, trace_back, mute_console=False):
    # If this error was called to stop an attribute from being set, do not log
    # it.
    if str(value) == "gg_cancel_callback":
        return
Exemplo n.º 8
0
# =============================================================================
# >> ADDON REGISTRATION/INFORMATION
# =============================================================================
info = AddonInfo()
info.name = 'gg_welcome_msg'
info.title = 'GG Welcome Message'
info.author = 'GG Dev Team'
info.version = "5.1.%s" % "$Rev: 571 $".split('$Rev: ')[1].split()[0]


# =============================================================================
# >> GLOBAL VARIABLES
# =============================================================================
# Store the title of the menu
title = 'GunGame%s -- Welcome Message' % gungame_info('version')
gg_welcome_msg_timeout = es.ServerVar('gg_welcome_msg_timeout')

# Create an empty list for detecting if a player just joined the server
messageQueue = []


# =============================================================================
# >> LOAD & UNLOAD
# =============================================================================
def load():
    # Register !welcome
    registerSayCommand('!welcome', welcome, 'Displays a !welcome menu.')

    # Build the main gg_welcome popup
    buildPopups()
Exemplo n.º 9
0
from gungame51.core.addons.shortcuts import get_loaded_addon_list

# =============================================================================
# >> ADDON REGISTRATION/INFORMATION
# =============================================================================
info = AddonInfo()
info.name = 'gg_welcome_msg'
info.title = 'GG Welcome Message'
info.author = 'GG Dev Team'
info.version = "5.1.%s" % "$Rev: 571 $".split('$Rev: ')[1].split()[0]

# =============================================================================
# >> GLOBAL VARIABLES
# =============================================================================
# Store the title of the menu
title = 'GunGame%s -- Welcome Message' % gungame_info('version')
gg_welcome_msg_timeout = es.ServerVar('gg_welcome_msg_timeout')

# Create an empty list for detecting if a player just joined the server
messageQueue = []


# =============================================================================
# >> LOAD & UNLOAD
# =============================================================================
def load():
    # Register !welcome
    registerSayCommand('!welcome', welcome, 'Displays a !welcome menu.')

    # Build the main gg_welcome popup
    buildPopups()