Example #1
0
def welcome_handler(userid, choice, popupname):
    # If they selected to see the included addons list
    if choice == 1:
        # If the menu exists, delete it
        if popuplib.exists('gg_welcome_include'):
            popuplib.delete('gg_welcome_include')
        # Create an easylist instance
        menu = popuplib.easylist('gg_welcome_include',
                                 get_loaded_addon_list('included'))
    elif choice == 2:
        # If the menu exists, delete it
        if popuplib.exists('gg_welcome_custom'):
            popuplib.delete('gg_welcome_custom')
        # Create an easylist instance
        menu = popuplib.easylist('gg_welcome_custom',
                                 get_loaded_addon_list('custom'))

    # Set the menu's title
    menu.settitle(title)
    # When the menu is closed, go back to the welcome message
    menu.submenu(0, 'gg_welcome')
    # Set the timeout for the menu
    menu.timeout('send', int(gg_welcome_msg_timeout))
    menu.timeout('view', int(gg_welcome_msg_timeout))
    # Send the popup
    menu.send(userid)
Example #2
0
def welcome_handler(userid, choice, popupname):
    # If they selected to see the included addons list
    if choice == 1:
        # If the menu exists, delete it
        if popuplib.exists('gg_welcome_include'):
            popuplib.delete('gg_welcome_include')
        # Create an easylist instance
        menu = popuplib.easylist('gg_welcome_include',
                                        get_loaded_addon_list('included'))
    elif choice == 2:
        # If the menu exists, delete it
        if popuplib.exists('gg_welcome_custom'):
            popuplib.delete('gg_welcome_custom')
        # Create an easylist instance
        menu = popuplib.easylist('gg_welcome_custom',
                                            get_loaded_addon_list('custom'))

    # Set the menu's title
    menu.settitle(title)
    # When the menu is closed, go back to the welcome message
    menu.submenu(0, 'gg_welcome')
    # Set the timeout for the menu
    menu.timeout('send', int(gg_welcome_msg_timeout))
    menu.timeout('view', int(gg_welcome_msg_timeout))
    # Send the popup
    menu.send(userid)
Example #3
0
def unload():
    for popup in ['pistols','shotguns','smgs','rifles','snipers','machinegun','grenades','item','health','cash','']:
        if popuplib.exists('admingive' + popup):
            popuplib.close('admingive' + popup, es.getUseridList())
            popuplib.delete('admingive' + popup)
    for popup in ['targetmenu','giveplayermenu']:
        if popuplib.exists(popup):
            popuplib.close(popup, es.getUseridList())
            popuplib.delete(popup)
    xaadmingive.unregister()
Example #4
0
def unload():
    for popup in ['pistols', 'shotguns', 'smgs', 'rifles', 'snipers', 'machinegun', 'grenades', 'others', 'all', 'health', 'cash', '']:
        if popuplib.exists('admingive' + popup):
            popuplib.close('admingive' + popup, es.getUseridList())
            popuplib.delete('admingive' + popup)
    for popup in ['targetmenu', 'giveplayermenu']:
        if popuplib.exists(popup):
            popuplib.close(popup, es.getUseridList())
            popuplib.delete(popup)
    xaadmingive.unregister()
Example #5
0
def unload():
    # Unregister !welcome
    unregisterSayCommand('!welcome')

    # Clean up existing popups
    if popuplib.exists('gg_welcome'):
        popuplib.delete('gg_welcome')
    if popuplib.exists('gg_welcome_include'):
        popuplib.delete('gg_welcome_include')
    if popuplib.exists('gg_welcome_custom'):
        popuplib.delete('gg_welcome_custom')
Example #6
0
def unload():
    # Unregister !welcome
    unregisterSayCommand('!welcome')

    # Clean up existing popups
    if popuplib.exists('gg_welcome'):
        popuplib.delete('gg_welcome')
    if popuplib.exists('gg_welcome_include'):
        popuplib.delete('gg_welcome_include')
    if popuplib.exists('gg_welcome_custom'):
        popuplib.delete('gg_welcome_custom')
Example #7
0
def _inputbox_handle():
    userid = es.getcmduserid()
    count = int(es.getargc())
    if count > 4:
        parent = es.getargv(1)
        if popuplib.exists(parent):
            module = es.getargv(2)
            if xa.exists(module):
                module = xa.find(module)
                varname = es.getargv(3)
                if module and varname in module.variables:
                    var = module.variables[varname]
                    i = 4
                    oldval = str(var)
                    newvalue = ''
                    while i < count:
                        newvalue = newvalue+' '+es.getargv(i)
                        i = i + 1
                    newvalue = newvalue.strip()
                    var.set(newvalue)
                    es.esctextbox(10, userid, "Changed '"+str(varname)+"' setting", "Changed '%s' to '%s'\nThe variable menu is open again.\nPress [ESC] a second time." %(varname,newvalue))
                    menu = _variableEditMenu(userid, module, var, parent)
                    menu.send(userid)
                    xaconfig.logging.log("Admin %s just change config %s from %s to %s" % (es.getplayername(userid), varname, oldval, newvalue) )
    else:
        es.esctextbox(10, userid, "Invalid Entry", "<value>")
Example #8
0
 def backmenu(self, backmenu):
     if popuplib.exists(backmenu):
         self.popup.submenu(10, popuplib.find(backmenu))
         self.backpopup = popuplib.find(backmenu)
         es.dbgmsg(
             1, "Keymenulib: Set backmenu of '%s' to popup '%s'" %
             (self.name, self.backpopup))
         return True
     elif settinglib.exists(backmenu):
         self.popup.submenu(10, settinglib.find(backmenu).popup)
         self.backpopup = settinglib.find(backmenu).popup
         es.dbgmsg(
             1, "Keymenulib: Set backmenu of '%s' to setting '%s'" %
             (self.name, self.backpopup))
         return True
     elif exists(backmenu):
         self.popup.submenu(10, find(backmenu).popup)
         self.backpopup = find(backmenu).popup
         es.dbgmsg(
             1, "Keymenulib: Set backmenu of '%s' to keymenu '%s'" %
             (self.name, self.backpopup))
         return True
     else:
         es.dbgmsg(
             0, "keymenu: Could not set backmenu of '%s' to '%s'!" %
             (self.name, backmenu))
         return False
Example #9
0
def _inputbox_handle():
    userid = es.getcmduserid()
    count = int(es.getargc())
    if count > 4:
        parent = es.getargv(1)
        if popuplib.exists(parent):
            module = es.getargv(2)
            if xa.exists(module):
                module = xa.find(module)
                varname = es.getargv(3)
                if module and varname in module.variables:
                    var = module.variables[varname]
                    i = 4
                    oldval = str(var)
                    newvalue = ''
                    while i < count:
                        newvalue = newvalue + ' ' + es.getargv(i)
                        i = i + 1
                    newvalue = newvalue.strip()
                    var.set(newvalue)
                    es.esctextbox(
                        10, userid, "Changed '" + str(varname) + "' setting",
                        "Changed '%s' to '%s'\nThe variable menu is open again.\nPress [ESC] a second time."
                        % (varname, newvalue))
                    menu = _variableEditMenu(userid, module, var, parent)
                    menu.send(userid)
                    xaconfig.logging.log(
                        "Admin %s just change config %s from %s to %s" %
                        (es.getplayername(userid), varname, oldval, newvalue))
    else:
        es.esctextbox(10, userid, "Invalid Entry", "<value>")
Example #10
0
def voteOption(userid, choice, popupid):
    if not vote_list.has_key(choice): 
        return
    if vote_list[choice]['type'] == 'submenu':
        if popuplib.exists(choice):
            popuplib.send(choice, userid)
    elif callable(vote_list[choice]['function']):
            vote_list[choice]['function'](userid, choice)
Example #11
0
def unload():
    # Delete the popup if it exists
    if popuplib.exists('ggLevelMenu'):
        popuplib.unsendname('ggLevelMenu', getUseridList('#human'))
        popuplib.delete('ggLevelMenu')

    # Unregister commands
    unregisterSayCommand('!level')
Example #12
0
def voteOption(userid, choice, popupid):
    if not vote_list.has_key(choice):
        return
    if vote_list[choice]['type'] == 'submenu':
        if popuplib.exists(choice):
            popuplib.send(choice, userid)
    elif callable(vote_list[choice]['function']):
        vote_list[choice]['function'](userid, choice)
Example #13
0
def leader_menu_cmd(userid, args):
    global leaderList

    # Make sure player exists
    if not es.exists('userid', userid) and userid != 0:
        return

    # Get menu contents
    newLeaderList = ['->1. Current Leaders:']
    leaderNames = get_leader_names()

    # Add names if we have leaders
    if leaderNames:
        # Add leader level and weapon
        leaderLevel = get_leader_level()
        newLeaderList.append('    Level %s (%s)' % (leaderLevel,
                                get_level_weapon(leaderLevel)))

        # Divider
        newLeaderList.append('-' * 26)

        # Add player names
        for player_name in leaderNames:
            newLeaderList.append('   * %s' % player_name)

    # No leader
    else:
        newLeaderList.extend(('-' * 26, '   * There currently is no leader'))

    # Finish popup with divider and exit
    newLeaderList.extend(('-' * 26, '0. Exit'))

    # Does the popup exists ?
    if popuplib.exists('ggLeaderMenu'):

        # Send the user the current popup ?
        if newLeaderList == leaderList:
            popuplib.send('ggLeaderMenu', userid)
            return

        # Delete the popup
        popuplib.unsendname('ggLeaderMenu', getUseridList('#human'))
        popuplib.delete('ggLeaderMenu')

    # Build new popup
    ggLeaderMenu = popuplib.create('ggLeaderMenu')
    ggLeaderMenu.timeout('send', 10)
    ggLeaderMenu.timeout('view', 10)

    # Add lines to new popup
    for line in newLeaderList:
        ggLeaderMenu.addline(line)

    # Save current popup
    leaderList = newLeaderList

    # Send it
    popuplib.send('ggLeaderMenu', userid)
Example #14
0
def _keymenu_select(userid, choice, popupid):
    # handling selected option popup/keymenu
    if popuplib.exists(popupid):
        k = find(getmenuname(popupid))
        if k.block:
            if callable(k.block):
                k.block(userid, choice, k.name)
            else:
                es.doblock(k.block)
Example #15
0
def _create_menu():
    if popuplib.exists('xacfgloader_menu'):
        popuplib.delete('xacfgloader_menu')
    menu = popuplib.easymenu("xacfgloader_menu", "_unused", _select_cfg)
    menu.addoption('reload','Reload CFG Files',lang="en")
    for file in [f for f in os.listdir(cfg_dir) if os.path.isfile(os.path.join(cfg_dir, f)) and f.endswith('.cfg')]:
        menu.addoption(file,file,lang="en")
    menu.settitle(xalanguage['menu_title'])
    menu.setdescription(xalanguage['menu_description'])
    return menu
def _create_menu():
    if popuplib.exists('xacfgloader_menu'):
        popuplib.delete('xacfgloader_menu')
    menu = popuplib.easymenu("xacfgloader_menu", "_unused", _select_cfg)
    menu.addoption('reload','Reload CFG Files',lang="en")
    for file in [f for f in os.listdir(cfg_dir) if os.path.isfile(os.path.join(cfg_dir, f)) and f.endswith('.cfg')]:
        menu.addoption(file,file,lang="en")
    menu.settitle(xalanguage['menu_title'])
    menu.setdescription(xalanguage['menu_description'])
    return menu
Example #17
0
def load():
    # Delete the popup if it exists
    if popuplib.exists('ggLeaderMenu'):
        popuplib.unsendname('ggLeaderMenu', getUseridList('#human'))
        popuplib.delete('ggLeaderMenu')

    # Register commands
    registerSayCommand('!leader', leader_menu_cmd, 'Displays a !leader menu.')
    registerSayCommand('!leaders', leader_menu_cmd,
        'Displays a !leaders menu.')
Example #18
0
def cmd_commands(userid,args):
    if popuplib.exists('xs_commands_list'):
        popuplib.send('xs_commands_list',userid)
    else:
        c = popuplib.easylist('xs_commands_list')
        c.settitle(text.getSimple('command list','title'))
        for x in xs.reggedccmd:
            c.additem(text.getTokenString('command list','console',[('command',x)]))
        for x in xs.reggedscmd:
            c.additem(text.getTokenString('command list','chat',[('command',x)]))
        c.send(userid)
Example #19
0
def prep_level_menu(userid, popupid):
    # Make sure the popup exists
    if not popuplib.exists('ggLevelMenu'):
        return

    ggLevelMenu = popuplib.find('ggLevelMenu')
    ggPlayer = Player(userid)

    # Get multikill count for the player's level
    multiKill = get_level_multikill(ggPlayer.level)

    # Use multikill style menu ?
    if multiKill > 1:
        ggLevelMenu.modline(2,
           '   * You are on level %s (%s)' % (ggPlayer.level, ggPlayer.weapon))
        ggLevelMenu.modline(3, '   * You have made %s' % ggPlayer.multikill +
        '/%s of your required kills' % multiKill)

    # Normal style menu
    else:
        ggLevelMenu.modline(2, '   * You are on level %s' % ggPlayer.level)
        ggLevelMenu.modline(3,
                        '   * You need a %s kill to advance' % ggPlayer.weapon)

    # Get leader's level
    leaderLevel = get_leader_level()

    # See if the leader is higher than level 1
    if leaderLevel > 1:

        # See if the player is a leader:
        if is_leader(userid):

            # See if there is more than 1 leader
            if get_leader_count() > 1:
                ggLevelMenu.modline(4,
                        '   * You are currently tied for the leader position')

            # Player is the only leader
            else:
                ggLevelMenu.modline(4, '   * You are currently the leader')

        # This player is not a leader
        else:
            ggLevelMenu.modline(4,
                '   * You are %s level(s)' % (leaderLevel - ggPlayer.level) +
                'behind the leader')

    # There are no leaders
    else:
        ggLevelMenu.modline(4, '   * There currently is no leader')

    # Wins information
    ggLevelMenu.modline(6, '   * You have won %s time(s)' % ggPlayer.wins)
def wum_handler(userid,choice,popupname):
	wum_playerinfo = popuplib.create("%s%s"%(popups[1],userid))
	wum_playerinfo.menuselect = wum_playerinfo_handler
	wum_playerinfo.addline("->1. %s"%es.getplayername(choice))
	wum_playerinfo.addline("-----------------------")
	wum_playerinfo.addline("TLevel: %s"%es.keygetvalue("wcsuserdata",choice,"total_level"))
	wum_playerinfo.addline("-----------------------")
	race = es.keygetvalue("wcsuserdata",choice,"race")
	wum_playerinfo.addline("o %s : %s"%(es.keygetvalue("wcsraces",race,"name"),es.keygetvalue("wcsuserdata",choice,"level")))
	numberofskills = int(es.keygetvalue("wcsraces",race,"numberofskills"))
	if numberofskills > 0:
		counter = 1
		scounter = 0
		skillnames = es.keygetvalue("wcsraces",race,"skillnames").split("|")
		while counter <= numberofskills:
			level = es.keygetvalue("wcsuserdata",choice,"skill_%s"%(counter))
			if not level or level == 0:
				level = 0
			wum_playerinfo.addline("- %s : %s"%(skillnames[scounter],level))
			scounter += 1
			counter += 1
	wum_playerinfo.addline("-----------------------")
	skulls = 0
	if es.keygetvalue("wcsuserdata",choice,"skulls"): skulls = int(es.keygetvalue("wcsuserdata",choice,"skulls"))
	if skulls and skulls != 0:
		wum_playerinfo.addline("- skulls: %s%%"%skulls)
	speed = 0
	if es.keygetvalue("wcsuserdata",choice,"speed"): speed = float(es.keygetvalue("wcsuserdata",choice,"speed"))
	if speed and speed != 0:
		speed = int(round(speed * 100))
		if speed != 100 and speed != 0: wum_playerinfo.addline("- speed: %s%%"%speed)
	gravity = 0
	if es.keygetvalue("wcsuserdata",choice,"gravity"): gravity = float(es.keygetvalue("wcsuserdata",choice,"gravity"))
	if gravity and gravity > 0:
		gravity = int(round(gravity * 100))
		if gravity != 100 and gravity != 0: wum_playerinfo.addline("- gravity: %s%%"%gravity)
	longjump = 0
	if es.keygetvalue("wcsuserdata",choice,"longjump"): longjump = float(es.keygetvalue("wcsuserdata",choice,"longjump"))
	if longjump and longjump > 0:
		longjump = int(round(longjump * 100))
		if longjump != 100 and longjump != 0: wum_playerinfo.addline("- longjump: %s%%"%longjump)
	invisp = 0
	if es.keygetvalue("wcsuserdata",choice,"invisp"): invisp = float(es.keygetvalue("wcsuserdata",choice,"invisp"))
	if invisp and invisp > 0:
		invisp = int(round(invisp))
		if invisp != 0: wum_playerinfo.addline("- invis: %s%%"%invisp)
	if es.getplayerprop(choice,"CCSPlayer.baseclass.pl.deadflag") == 0:
		wum_playerinfo.addline("- health %s%%"%es.getplayerprop(choice,"CCSPlayer.baseclass.m_iHealth"))
	wum_playerinfo.addline("-----------------------")
	wum_playerinfo.addline("->8. Back")
	wum_playerinfo.addline("->0. Exit")
	for popup in popups:
		if popuplib.exists("%s%s"%(popup,userid)): popuplib.close("%s%s"%(popup,userid),userid)
	gamethread.delayed(0.0001,wum_playerinfo.send,(userid))
def unload():
    es.dbgmsg(1, '*****unload')
    if authaddon == 'basic_auth':
        popuplib.delete('admindetail')
        if int(popuplib.exists('adminlistmenu')):
            popuplib.delete('adminlistmenu')
        es.dbgmsg(1, 'basicadmins_default=%s' % basicadmins_default)
        es.set('BASIC_AUTH_ADMIN_LIST', basicadmins_default)
    elif authaddon == 'group_auth':
        popuplib.delete('groupsmainmenu')
        popuplib.delete('usermenu')
        popuplib.delete('capmain')
        if int(popuplib.exists('groupsmenu')):
            popuplib.delete('groupsmenu')
        if int(popuplib.exists('groupslist')):
            popuplib.delete('groupslist')
        if int(popuplib.exists('groupsusers')):
            popuplib.delete('groupsusers')
        if int(popuplib.exists('groupcaps')):
            popuplib.delete('groupcaps')

    if int(popuplib.exists('playermenu')):
        popuplib.delete('playermenu')

    xa.unregister(xaauthmanage)
Example #22
0
def unload():
    es.dbgmsg(1,'*****unload')
    if authaddon == 'basic_auth': 
        popuplib.delete('admindetail')
        if int(popuplib.exists('adminlistmenu')):
            popuplib.delete('adminlistmenu')
        es.dbgmsg(1,'basicadmins_default=%s' %basicadmins_default)
        es.set('BASIC_AUTH_ADMIN_LIST', basicadmins_default)
    elif authaddon == 'group_auth':
        popuplib.delete('groupsmainmenu')
        popuplib.delete('usermenu')
        popuplib.delete('capmain')
        if int(popuplib.exists('groupsmenu')):
            popuplib.delete('groupsmenu')
        if int(popuplib.exists('groupslist')):
            popuplib.delete('groupslist')
        if int(popuplib.exists('groupsusers')):
            popuplib.delete('groupsusers')
        if int(popuplib.exists('groupcaps')):
            popuplib.delete('groupcaps')
		
    if int(popuplib.exists('playermenu')):
        popuplib.delete('playermenu')

    xa.unregister(xaauthmanage)
Example #23
0
 def mainCallback(userid, choice, popupid):
     """
     Executed when an option is selected from the main admin menu option.
     
     @PARAM userid - the user who chose the option
     @PARAM choice - the choice that the user selected
     @PARAM popupid - the name of the popup the user just chose an option from
     """
     if isinstance(choice, str) and popuplib.exists(choice):
         popuplib.send(choice, userid)
     elif callable(choice):
         choice(userid)
     else:
         raise ValueError, "Expected a function or popup for sourcerpg_admin, received type %s" % repr(choice)
Example #24
0
 def mainCallback(userid, choice, popupid):
     """
     Executed when an option is selected from the main admin menu option.
     
     @PARAM userid - the user who chose the option
     @PARAM choice - the choice that the user selected
     @PARAM popupid - the name of the popup the user just chose an option from
     """
     if isinstance(choice, str) and popuplib.exists(choice):
         popuplib.send(choice, userid)
     elif callable(choice):
         choice(userid)
     else:
         raise ValueError, "Expected a function or popup for sourcerpg_admin, received type %s" % repr(
             choice)
Example #25
0
 def getTop10Popup(self):
     """ Returns a popup that has the top10 player's info populated """
     if len(self.ranklist) >= 10:
         top10 = self.ranklist[0:10]
     else:
         top10 = self.ranklist # Potential referencing issue
     if popuplib.exists("ultirank_top10"):
         popuplib.delete("ultirank_top10")
     rankPopup = popuplib.create("ultirank_top10")
     rankPopup.addline("[UltiRank %s] Top 10" % info.version)
     rankPopup.addline("=================================")
     for i in range(len(top10)):
         rankPopup.addline("%d. %s: %d points (KDR: %s)" % (i+1, top10[i][3], top10[i][0], self.getKDR(top10[i][1], top10[i][2])))
     rankPopup.addline(" ")
     rankPopup.addline("0. Close")
     return rankPopup
Example #26
0
 def backmenu(self, backmenu):
     if popuplib.exists(backmenu):
         for page in self.popup:
             self.popup[page].submenu(10, backmenu)
         self.backmenuvar = backmenu
         es.dbgmsg(1, 'Settinglib: Set backmenu of %s to popup %s' % (self.name, self.backmenuvar))
         return True
     elif keymenulib.exists(backmenu):
         keymenu = keymenulib.find(backmenu)
         for page in self.popup:
             self.popup[page].submenu(10, keymenu.popup.name)
         self.backmenuvar = keymenu.popup.name
         es.dbgmsg(1, 'Settinglib: Set backmenu of %s to keymenu %s' % (self.name, self.backmenuvar))
         return True
     else:
         es.dbgmsg(0, 'setting: Could not set backmenu of %s to %s' % (self.name, backmenu))
         return False
Example #27
0
 def __init__(self, setting, menu, texts):
     self.name = str(setting)
     self.texts = dict(texts)
     if popuplib.exists(menu):
         self.menu = menu
         self.menutype = "popup"
         self.menuobj = popuplib.find(self.menu)
     elif keymenulib.exists(menu):
         self.menu = menu
         self.menutype = "keymenu"
         self.menuobj = keymenulib.find(self.menu)
     elif settinglib.exists(menu):
         self.menu = menu
         self.menutype = "setting"
         self.menuobj = settinglib.find(self.menu)
     xasettingmenu = popuplib.find("xasettingmenu")
     xasettingmenu.addoption(setting, self.texts)
Example #28
0
 def __init__(self, setting, menu, texts):
     self.name = str(setting)
     self.texts = dict(texts)
     if popuplib.exists(menu):
         self.menu = menu
         self.menutype = "popup"
         self.menuobj = popuplib.find(self.menu)
     elif keymenulib.exists(menu):
         self.menu = menu
         self.menutype = "keymenu"
         self.menuobj = keymenulib.find(self.menu)
     elif settinglib.exists(menu):
         self.menu = menu
         self.menutype = "setting"
         self.menuobj = settinglib.find(self.menu)
     xasettingmenu = popuplib.find("xasettingmenu")
     xasettingmenu.addoption(setting, self.texts)
Example #29
0
def unload():
    """
    Executed when the script unloads. Manually remove all instance
    of the singletons so the deconstructor is called on each one
    """
    sourcerpg.addons.removeAddon(addonName)
    
    del globals()['admin']
    del globals()['popup']
    if popuplib.exists("sourcerpg_confirmDeleteDatabase"):
        popuplib.delete("sourcerpg_confirmDeleteDatabase")
    
    cmdlib.unregisterSayCommand("rpg_admin")
    cmdlib.unregisterSayCommand("rpgadmin")
    cmdlib.unregisterClientCommand("rpgaddxp")
    cmdlib.unregisterClientCommand("rpgaddlevels")
    cmdlib.unregisterClientCommand("rpgaddcredits")
Example #30
0
def unload():
    """
    Executed when the script unloads. Manually remove all instance
    of the singletons so the deconstructor is called on each one
    """
    sourcerpg.addons.removeAddon(addonName)

    del globals()['admin']
    del globals()['popup']
    if popuplib.exists("sourcerpg_confirmDeleteDatabase"):
        popuplib.delete("sourcerpg_confirmDeleteDatabase")

    cmdlib.unregisterSayCommand("rpg_admin")
    cmdlib.unregisterSayCommand("rpgadmin")
    cmdlib.unregisterClientCommand("rpgaddxp")
    cmdlib.unregisterClientCommand("rpgaddlevels")
    cmdlib.unregisterClientCommand("rpgaddcredits")
Example #31
0
def _inputbox_handle():
    userid = es.getcmduserid()
    count = int(es.getargc())
    if count > 5:
        parent = es.getargv(1)
        if popuplib.exists(parent):
            module = es.getargv(2)
            if xa.exists(module):
                module = xa.find(module)
                keylist = langlist[str(module)]
                lang = es.getargv(3)
                key = es.getargv(4)
                if not key in keylist:
                    key = es.getargv(4).replace('+', ' ')
                if module and lang and key in keylist:
                    i = 5
                    newvalue = ''
                    while i < count:
                        newvalue = newvalue + ' ' + es.getargv(i)
                        i = i + 1
                    newvalue = newvalue.strip()
                    if newvalue:
                        language = cfglib.AddonINI(
                            "%s/modules/%s/strings.custom.ini" %
                            (xa.coredir(), module))
                        language.addValueToGroup(key, lang, newvalue, True)
                        language.write()
                        es.tell(
                            userid, '#green',
                            xalang('string warning',
                                   playerlib.getPlayer(userid).get('lang')))
                    else:
                        newvalue = langlist[str(module)](key, lang)
                    try:
                        langlist[str(module)] = module.language.getLanguage()
                    except IOError:
                        pass
                    es.esctextbox(
                        10, userid,
                        "Changed '" + str(keylist(key, lang)) + "' string",
                        "Changed '%s' to '%s'\nThe language menu is open again.\nPress [ESC] a second time."
                        % (keylist(key, lang), newvalue))
                    menu = _stringEditMenu(userid, module, key, parent)
                    menu.send(userid)
    else:
        es.esctextbox(10, userid, "Invalid Entry", "<string>")
Example #32
0
def _selectmenu(userid, choice, name):
    """ This function makes the submenu for whichever set of skins was chosen """
    playermenu[userid] = choice
    if popuplib.exists("xaskinselect"+str(userid)):
        popuplib.delete("xaskinselect"+str(userid))
    page = popuplib.easymenu("xaskinselect"+str(userid), "_tempcore", _selectsubmenu)
    # This is commented out becuase popuplib seems to have a bug
    # page.cachemode = "user"
    page.settitle(xalanguage["choose skins"])
    if choice in skinlist:
        for skinName in skinlist[choice]:
            page.addoption(skinName, xaskins.language.createLanguageString(skinName) )
    else:
        page.addoption(None, xalanguage["no skins"], False)
    page.submenu(0, "xaskinmenu%s" % userid)
    page.c_exitformat = "0. Back"
    page.send(userid)
 def backmenu(self, backmenu):
     if popuplib.exists(backmenu):
         self.popup.submenu(10, popuplib.find(backmenu))
         self.backpopup = popuplib.find(backmenu)
         es.dbgmsg(1, f"Keymenulib: Set backmenu of '{self.name}' to popup '{self.backpopup}'")
         return True
     elif settinglib.exists(backmenu):
         self.popup.submenu(10, settinglib.find(backmenu).popup)
         self.backpopup = settinglib.find(backmenu).popup
         es.dbgmsg(1, f"Keymenulib: Set backmenu of '{self.name}' to setting '{self.backpopup}'")
         return True
     elif exists(backmenu):
         self.popup.submenu(10, find(backmenu).popup)
         self.backpopup = find(backmenu).popup
         es.dbgmsg(1, f"Keymenulib: Set backmenu of '{self.name}' to keymenu '{self.backpopup}'")
         return True
     else:
         es.dbgmsg(0, f"keymenu: Could not set backmenu of '{self.name}' to '{backmenu}'!")
         return False
Example #34
0
 def tellPersonalRank(self, userid):
     """ Use a popup to display the rank """
     popupName = "ultirank_rank_%s" % str(userid)
     playerRank = self.getPersonalRank(self.identifyPlayer(userid))
     if popuplib.exists(popupName):
         popuplib.delete(popupName)
     rpopup = popuplib.create(popupName)
     rpopup.addline(playerlib.Player(userid).name)
     rpopup.addline("================")
     rpopup.addline("Rank: %d of %d" % (playerRank[0], len(self.ranklist)))
     rpopup.addline("Points: %d" % playerRank[1])
     rpopup.addline("Kills: %d" % playerRank[2])
     rpopup.addline("Deaths: %d" % playerRank[3])
     rpopup.addline("KDR: %s" % self.getKDR(playerRank[2], playerRank[3]))
     rpopup.addline(" ")
     rpopup.addline("0. Close")
     rpopup.send(userid)
     if self.readonly:
         self.tellplayer(userid, "The ranking system is currently in read-only mode. Your kills and deaths will not be logged.")
Example #35
0
def _sendmenu(playerid = False):
    """ This function handles the console and client command.  Probably need to modify for use with XA """
    if not playerid:
        playerid = es.getcmduserid()
    if popuplib.exists("xaskinmenu" + str(playerid)):
        popuplib.delete("xaskinmenu" + str(playerid))
    page = popuplib.easymenu("xaskinmenu" + str(playerid), "_tempcore", _selectmenu)
    # This is commented out becuase popuplib seems to have a bug
    # page.cachemode = "user"
    page.settitle(xalanguage["choose skins"])
    for skinName in skinmenu:
        skinIndex = skinmenu.index(skinName)
        if (skinName != "Misc") and ((xaskins.isUseridAuthorized(playerid, "skin_admin") and ("admin" == skinnames[skinIndex][:5])) or \
                (xaskins.isUseridAuthorized(playerid, "skin_reserved") and ("reserved" == skinnames[skinIndex][:8])) or \
                ("public" == skinnames[skinIndex][:6])):
            xaplayerdata = players[skinnames[skinIndex]]
            mySkin       = xaplayerdata.get(playerid)
            page.addoption(skinnames[skinIndex], xaskins.language.createLanguageString(skinName + " - " + mySkin) )
    page.send(playerid)
Example #36
0
 def backmenu(self, backmenu):
     if popuplib.exists(backmenu):
         self.popup.submenu(10, popuplib.find(backmenu))
         self.backpopup = popuplib.find(backmenu)
         es.dbgmsg(1, "Keymenulib: Set backmenu of '%s' to popup '%s'"%(self.name, self.backpopup))
         return True
     elif settinglib.exists(backmenu):
         self.popup.submenu(10, settinglib.find(backmenu).popup)
         self.backpopup = settinglib.find(backmenu).popup
         es.dbgmsg(1, "Keymenulib: Set backmenu of '%s' to setting '%s'"%(self.name, self.backpopup))
         return True
     elif exists(backmenu):
         self.popup.submenu(10, find(backmenu).popup)
         self.backpopup = find(backmenu).popup
         es.dbgmsg(1, "Keymenulib: Set backmenu of '%s' to keymenu '%s'"%(self.name, self.backpopup))
         return True
     else:
         es.dbgmsg(0, "keymenu: Could not set backmenu of '%s' to '%s'!"%(self.name, backmenu))
         return False
Example #37
0
def _selectmenu(userid, choice, name):
    """ This function makes the submenu for whichever set of skins was chosen """
    playermenu[userid] = choice
    if popuplib.exists("xaskinselect" + str(userid)):
        popuplib.delete("xaskinselect" + str(userid))
    page = popuplib.easymenu("xaskinselect" + str(userid), "_tempcore",
                             _selectsubmenu)
    # This is commented out becuase popuplib seems to have a bug
    # page.cachemode = "user"
    page.settitle(xalanguage["choose skins"])
    if choice in skinlist:
        for skinName in skinlist[choice]:
            page.addoption(skinName,
                           xaskins.language.createLanguageString(skinName))
    else:
        page.addoption(None, xalanguage["no skins"], False)
    page.submenu(0, "xaskinmenu%s" % userid)
    page.c_exitformat = "0. Back"
    page.send(userid)
def map_menu():
    if popuplib.exists('xamapmenu'):
        popuplib.delete('xamapmenu')
    maplist_path = xa.gamedir() + '/maplist.txt'
    if os.path.isfile(maplist_path):
        mapfile = open(maplist_path, 'r')
        maplist = filter(map_check,map(string.strip,mapfile.readlines()))
        mapfile.close()
        if 'test_speakers' in maplist:
            maplist.remove('test_speakers')
        if 'test_hardware' in maplist:
            maplist.remove('test_hardware')
        maplist = sorted(maplist, key=lambda x: str(x).lower())
    else:
        maplist = gDefaultMaps
    xamapmenu = popuplib.easymenu('xamapmenu',None,mapmenu_handler)
    xamapmenu.settitle('Choose a map:')
    xamapmenu.submenu(10, 'xamapmainmenu')
    for mapname in maplist:
        xamapmenu.addoption(mapname,mapname)
def map_menu():
    if popuplib.exists("xamapmenu"):
        popuplib.delete("xamapmenu")
    maplist_path = xa.gamedir() + "/maplist.txt"
    if os.path.isfile(maplist_path):
        mapfile = open(maplist_path, "r")
        maplist = filter(map_check, map(string.strip, mapfile.readlines()))
        mapfile.close()
        if "test_speakers" in maplist:
            maplist.remove("test_speakers")
        if "test_hardware" in maplist:
            maplist.remove("test_hardware")
        maplist = sorted(maplist, key=lambda x: str(x).lower())
    else:
        maplist = gDefaultMaps
    xamapmenu = popuplib.easymenu("xamapmenu", None, mapmenu_handler)
    xamapmenu.settitle("Choose a map:")
    xamapmenu.submenu(10, "xamapmainmenu")
    for mapname in maplist:
        xamapmenu.addoption(mapname, mapname)
Example #40
0
def map_menu():
    if popuplib.exists('xamapmenu'):
        popuplib.delete('xamapmenu')
    maplist_path = xa.gamedir() + '/maplist.txt'
    if os.path.isfile(maplist_path):
        mapfile = open(maplist_path, 'r')
        maplist = filter(map_check, map(string.strip, mapfile.readlines()))
        mapfile.close()
        if 'test_speakers' in maplist:
            maplist.remove('test_speakers')
        if 'test_hardware' in maplist:
            maplist.remove('test_hardware')
        maplist = sorted(maplist, key=lambda x: str(x).lower())
    else:
        maplist = gDefaultMaps
    xamapmenu = popuplib.easymenu('xamapmenu', None, mapmenu_handler)
    xamapmenu.settitle('Choose a map:')
    xamapmenu.submenu(10, 'xamapmainmenu')
    for mapname in maplist:
        xamapmenu.addoption(mapname, mapname)
Example #41
0
def _manage_player(userid,choice,popupid):
    es.dbgmsg(1,'*****_manage_player')
    if authaddon == 'group_auth':
        groups = db.query("SELECT GroupName FROM Groups WHERE GroupName!='UnidentifiedPlayers' and GroupName!='IdentifiedPlayers';")
        if popuplib.exists('groupsmenu'):
            popuplib.delete('groupsmenu')
        groupsmenu = popuplib.easymenu('groupsmenu', None, _set_playergroup)
        for group in groups:
            group = utfcode(group)
            groupsmenu.addoption((group[0],choice), utfcode(group[0]))
        groupsmenu.settitle(choice + '\n-' + lang('add player to group'))
        groupsmenu.send(userid)
    else:
        global addadmin
        addadmin = popuplib.easymenu('addadmin', None, _addadmin_select)
        token = {'choice':str(choice)}
        addadmin.settitle(lang('make admin', token))
        addadmin.addoption((choice,1), lang['yes'])
        addadmin.addoption('no',lang['no'])
        addadmin.send(userid)
Example #42
0
def cleanVote():
    # Clear options
    mapVoteOptions.clear()

    # Clear voters
    votedUserids.clear()

    # Delete popup ?
    if popuplib.exists('gg_map_vote'):
        popuplib.delete('gg_map_vote')

    # Delete repeat ?
    if repeat.find('gg_map_vote'):
        repeat.delete('gg_map_vote')

    # Clear userid lists
    del voteSentUserids[:]
    del voteCmdUserids[:]
    del voteUserids[:]

    global ggVote
    ggVote = None
Example #43
0
def cleanVote():
    # Clear options
    mapVoteOptions.clear()

    # Clear voters
    votedUserids.clear()

    # Delete popup ?
    if popuplib.exists("gg_map_vote"):
        popuplib.delete("gg_map_vote")

    # Delete repeat ?
    if repeat.find("gg_map_vote"):
        repeat.delete("gg_map_vote")

    # Clear userid lists
    del voteSentUserids[:]
    del voteCmdUserids[:]
    del voteUserids[:]

    global ggVote
    ggVote = None
def _manage_player(userid, choice, popupid):
    es.dbgmsg(1, '*****_manage_player')
    if authaddon == 'group_auth':
        groups = db.query(
            "SELECT GroupName FROM Groups WHERE GroupName!='UnidentifiedPlayers' and GroupName!='IdentifiedPlayers';"
        )
        if popuplib.exists('groupsmenu'):
            popuplib.delete('groupsmenu')
        groupsmenu = popuplib.easymenu('groupsmenu', None, _set_playergroup)
        for group in groups:
            group = utfcode(group)
            groupsmenu.addoption((group[0], choice), utfcode(group[0]))
        groupsmenu.settitle(choice + '\n-' + lang('add player to group'))
        groupsmenu.send(userid)
    else:
        global addadmin
        addadmin = popuplib.easymenu('addadmin', None, _addadmin_select)
        token = {'choice': str(choice)}
        addadmin.settitle(lang('make admin', token))
        addadmin.addoption((choice, 1), lang['yes'])
        addadmin.addoption('no', lang['no'])
        addadmin.send(userid)
Example #45
0
def _sendmenu(playerid=False):
    """ This function handles the console and client command.  Probably need to modify for use with XA """
    if not playerid:
        playerid = es.getcmduserid()
    if popuplib.exists("xaskinmenu" + str(playerid)):
        popuplib.delete("xaskinmenu" + str(playerid))
    page = popuplib.easymenu("xaskinmenu" + str(playerid), "_tempcore",
                             _selectmenu)
    # This is commented out becuase popuplib seems to have a bug
    # page.cachemode = "user"
    page.settitle(xalanguage["choose skins"])
    for skinName in skinmenu:
        skinIndex = skinmenu.index(skinName)
        if (skinName != "Misc") and ((xaskins.isUseridAuthorized(playerid, "skin_admin") and ("admin" == skinnames[skinIndex][:5])) or \
                (xaskins.isUseridAuthorized(playerid, "skin_reserved") and ("reserved" == skinnames[skinIndex][:8])) or \
                ("public" == skinnames[skinIndex][:6])):
            xaplayerdata = players[skinnames[skinIndex]]
            mySkin = xaplayerdata.get(playerid)
            page.addoption(
                skinnames[skinIndex],
                xaskins.language.createLanguageString(skinName + " - " +
                                                      mySkin))
    page.send(playerid)
Example #46
0
 def backmenu(self, backmenu):
     if popuplib.exists(backmenu):
         for page in self.popup:
             self.popup[page].submenu(10, backmenu)
         self.backmenuvar = backmenu
         es.dbgmsg(
             1, 'Settinglib: Set backmenu of %s to popup %s' %
             (self.name, self.backmenuvar))
         return True
     elif keymenulib.exists(backmenu):
         keymenu = keymenulib.find(backmenu)
         for page in self.popup:
             self.popup[page].submenu(10, keymenu.popup.name)
         self.backmenuvar = keymenu.popup.name
         es.dbgmsg(
             1, 'Settinglib: Set backmenu of %s to keymenu %s' %
             (self.name, self.backmenuvar))
         return True
     else:
         es.dbgmsg(
             0, 'setting: Could not set backmenu of %s to %s' %
             (self.name, backmenu))
         return False
Example #47
0
def _inputbox_handle():
    userid = es.getcmduserid()
    count = int(es.getargc())
    if count > 5:
        parent = es.getargv(1)
        if popuplib.exists(parent):
            module = es.getargv(2)
            if xa.exists(module):
                module = xa.find(module)
                keylist = langlist[str(module)]
                lang = es.getargv(3)
                key = es.getargv(4)
                if not key in keylist:
                    key = es.getargv(4).replace('+', ' ')
                if module and lang and key in keylist:
                    i = 5
                    newvalue = ''
                    while i < count:
                        newvalue = newvalue+' '+es.getargv(i)
                        i = i + 1
                    newvalue = newvalue.strip()
                    if newvalue:
                        language = cfglib.AddonINI("%s/modules/%s/strings.custom.ini" % (xa.coredir(), module))
                        language.addValueToGroup(key, lang, newvalue, True)
                        language.write()
                        es.tell(userid, '#green', xalang('string warning', playerlib.getPlayer(userid).get('lang')))
                    else:
                        newvalue = langlist[str(module)](key, lang)
                    try:
                        langlist[str(module)] = module.language.getLanguage()
                    except IOError:
                        pass
                    es.esctextbox(10, userid, "Changed '"+str(keylist(key, lang))+"' string", "Changed '%s' to '%s'\nThe language menu is open again.\nPress [ESC] a second time." %(keylist(key, lang),newvalue))
                    menu = _stringEditMenu(userid, module, key, parent)
                    menu.send(userid)
    else:
        es.esctextbox(10, userid, "Invalid Entry", "<string>")
Example #48
0
def load():
    # Delete the popup if it exists
    if popuplib.exists('ggLevelMenu'):
        popuplib.unsendname('ggLevelMenu', getUseridList('#human'))
        popuplib.delete('ggLevelMenu')

    # Let's create the "gungameLevelMenu" popup
    ggLevelMenu = popuplib.create('ggLevelMenu')

    # Create empty instance of the popup
    ggLevelMenu.addline('->1. LEVEL')
    ggLevelMenu.addline('   * ')
    ggLevelMenu.addline('   * ')
    ggLevelMenu.addline('   * ')
    ggLevelMenu.addline('->2. WINS')
    ggLevelMenu.addline('   * ')
    ggLevelMenu.addline('->   9. View Leaders Menu')
    ggLevelMenu.select(9, send_leader_menu)
    ggLevelMenu.prepuser = prep_level_menu
    ggLevelMenu.timeout('send', 10)
    ggLevelMenu.timeout('view', 10)

    # Register command
    registerSayCommand('!level', level_menu_cmd, 'Displays a !level menu.')
Example #49
0
def getmenuname(pPopupid):
    if popuplib.exists(pPopupid):
        if pPopupid.startswith('vote_') and exists(pPopupid[5:]):
            return pPopupid[5:]
    return ''
Example #50
0
def _submit(userid, value, popupid):
    if popuplib.exists(popupid):
        find(getmenuname(popupid)).submit(userid, value, True)
def checkPop(p):
    if popuplib.exists(p): popuplib.delete(p)
Example #52
0
def _submit(userid, value, popupid):
    if popuplib.exists(popupid):
        find(getmenuname(popupid)).submit(userid, value, True)
Example #53
0
def getmenuname(pPopupid):
    if popuplib.exists(pPopupid):
        if pPopupid.startswith('keymenu_') and exists(pPopupid[8:]):
            return pPopupid[8:]
    return ''