예제 #1
0
    def __init__(self, userid, weaponslist):
        if playerlib.getPlayer(userid).isbot:
            es.give(userid, "weapon_" + weaponslist[0])
            return None

        if len(weaponslist) == 1:
            es.give(userid, "weapon_" + weaponslist[0])
            return None

        self.userid = userid
        self.weaponslist = weaponslist
        menuid = random.randint(0, 1000)
        if es.exists("popup", "ultilib_weaponmenu%d" % menuid):
            popuplib.delete("ultilib_weaponmenu%d" % menuid)

        weaponMenu = popuplib.create("ultilib_weaponmenu%d" % menuid)
        weaponMenu.addline("Choose a weapon:")
        weaponMenu.addline(" ")
        if len(self.weaponslist) < 9:
            for i in range(0, len(self.weaponslist)):
                weaponMenu.addline("->%d. %s" % (i + 1, self.weaponslist[i]))
        else:
            for i in range(0, 9):
                weaponMenu.addline("->%d. %s" % (i + 1, self.weaponslist[i]))

        weaponMenu.addline(" ")
        weaponMenu.addline("0. Cancel")
        weaponMenu.menuselect = self.select

        popuplib.send("ultilib_weaponmenu%d" % menuid, userid)
예제 #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)
예제 #3
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)
예제 #4
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')
예제 #5
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)
예제 #6
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()
예제 #7
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()
예제 #8
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.')
예제 #9
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
예제 #10
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
예제 #11
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
예제 #12
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")
예제 #13
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")
예제 #14
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)
예제 #15
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)
예제 #16
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)
예제 #17
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.")
예제 #18
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)
예제 #19
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)
예제 #20
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)
예제 #21
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)
예제 #22
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
예제 #23
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)
예제 #24
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
예제 #25
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)
예제 #26
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.')
예제 #27
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')
예제 #28
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')
예제 #29
0
def unload():
    for userid in es.getUseridList():
        gamethread.cancelDelayed('burn_%s'%userid)
    for punishment in punishment_method:
        xapunishments.unregisterPunishment(punishment)
    popuplib.delete("xapunishmentmenu")
    popuplib.delete("xapunishtargetmenu")
    popuplib.delete("xapunishsuremenu")
    for page in punishment_pmenus:
        page.delete()
    xapunishments.unregister()
예제 #30
0
def unload():
    for userid in es.getUseridList():
        gamethread.cancelDelayed('burn_%s' % userid)
    for punishment in punishment_method:
        xapunishments.unregisterPunishment(punishment)
    popuplib.delete("xapunishmentmenu")
    popuplib.delete("xapunishtargetmenu")
    popuplib.delete("xapunishsuremenu")
    for page in punishment_pmenus:
        punishment_pmenus[page].delete()
    xapunishments.unregister()
예제 #31
0
def pplchck(name):
    if popuplib.exists(name):
        popuplib.delete(name)
예제 #32
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)
예제 #33
0
import es
예제 #34
0
def unload():
    global menulist
    for menu in menulist:
        if popuplib.exists(str(menu)):
            popuplib.delete(str(menu))
    xalanguage.unregister()
예제 #35
0
def unload():
    popuplib.delete("xasettingmenu")
    xasettings.unregister()
예제 #36
0
def unload():
    global menulist
    for menu in menulist:
        if popuplib.exists(str(menu)): 
            popuplib.delete(str(menu))
    xalanguage.unregister()
예제 #37
0
 def __del__(self):
     """ Default deconstructor. clear the initializations we creating in __init__ """
     popuplib.delete("sourcerpg_admin")
예제 #38
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)
예제 #39
0
def checkPop(p):
    if popuplib.exists(p): popuplib.delete(p)
예제 #40
0
def consolecmd():
    #Command from server console or non-python script
    subcmd = es.getargv(1).lower()
    pname = es.getargv(2)
    argc = es.getargc()
    if pname in popuplib.gPopups:
        p = popuplib.gPopups[pname]
    else:
        p = None
    debug = info
    if subcmd == "create":
        if pname:
            popuplib.create(pname)
        else:
            es.dbgmsg(0,"Syntax: popup create <popupname>")
    elif subcmd == "delete":
        if pname:
            if p:
                popuplib.delete(pname)
            else:
                es.dbgmsg(0,"Popup delete: No such popup: "+pname)
        else:
            es.dbgmsg(0,"Syntax: popup delete <popupname>")
    elif subcmd == "addline":
        if argc == 4:
            if p:
                text = str(es.getargv(3))
                p.addline(text)
            else:
                es.dbgmsg(0,"Popup addline: No such popup: "+pname)
        else:
            es.dbgmsg(0,"Syntax: popup addline <popupname> <text>")
    elif subcmd == "delline":
        if argc == 4:
            if p:
                line = int(es.getargv(3))
                p.delline(line)
            else:
                es.dbgmsg(0,"Popup delline: No such popup: "+pname)
        else:
            es.dbgmsg(0,"Syntax: popup delline <popupname> <line#>")
    elif subcmd == "insline":
        if argc == 5:
            if p:
                line = int(es.getargv(3))
                text = str(es.getargv(4))
                p.insline(line, text)
            else:
                es.dbgmsg(0,"Popup insline: No such popup: "+pname)
        else:
            es.dbgmsg(0,"Syntax: popup insline <popupname> <line#> <text>")
    elif subcmd == "modline":
        if argc == 5:
            if p:
                line = int(es.getargv(3))
                text = str(es.getargv(4))
                p.modline(line, text)
            else:
                es.dbgmsg(0,"Popup modline: No such popup: "+pname)
        else:
            es.dbgmsg(0,"Syntax: popup modline <popupname> <line#> <text>")
    elif subcmd == "prepuser":
        if argc == 4:
            if p:
                block = str(es.getargv(3))
                if block == "0": block = ""
                p.prepuser = block
            else:
                es.dbgmsg(0,"Popup prepuser: No such popup: "+pname)
        else:
            es.dbgmsg(0,"Syntax: popup prepuser <popupname> <block>")
    elif subcmd == "menuselect":
        if argc == 4:
            if p:
                block = es.getargv(3)
                if block == "0": block = ""
                p.menuselect = block
            else:
                es.dbgmsg(0,"Popup menuselect: No such popup: "+pname)
        else:
            es.dbgmsg(0,"Syntax: popup menuselect <popupname> <block>")
    elif subcmd == "menuselectfb":
        if argc == 4:
            if p:
                block = es.getargv(3)
                if block == "0": block = ""
                p.menuselectfb = block
            else:
                es.dbgmsg(0,"Popup menuselectfb: No such popup: "+pname)
        else:
            es.dbgmsg(0,"Syntax: popup menuselectfb <popupname> <block>")
    elif subcmd == "select":
        if argc == 5:
            if p:
                item = int(es.getargv(3))
                block = es.getargv(4)
                if block == "0": block = ""
                p.select(item, block)
            else:
                es.dbgmsg(0,"Popup select: No such popup: "+pname)
        else:
            es.dbgmsg(0,"Syntax: popup select <popupname> <choice#> <block>")
    elif subcmd == "submenu":
        if argc == 5:
            if p:
                item = int(es.getargv(3))
                block = es.getargv(4)
                if block == "0": block = ""
                p.submenu(item, block)
            else:
                es.dbgmsg(0,"Popup submenu: No such popup: "+pname)
        else:
            es.dbgmsg(0,"Syntax: popup submenu <popupname> <choice#> <submenu>")
    elif subcmd == "menuvalue":
        if argc == 6:
            if p:
                item = int(es.getargv(4))
                varn = es.getargv(3)
                varv = es.getargv(5)
                p.menuvalue(varn, item, varv)
            else:
                es.dbgmsg(0,"Popup menuvalue: No such popup: "+pname)
        else:
            es.dbgmsg(0,"Syntax: popup menuvalue <popupname> <variable> <choice#> <value>")
    elif subcmd == "timeout":
        if argc == 5:
            if p:
                tomode = es.getargv(3)
                time = float(es.getargv(4))
                p.timeout(tomode, time)
            else:
                es.dbgmsg(0,"Popup timeout: No such popup: "+pname)
        else:
            es.dbgmsg(0,"Syntax: popup timeout <popupname> <mode> <time>")
            es.dbgmsg(0," mode: \"send\" or \"view\"")
    elif subcmd == "send":
        if argc == 5:
            try:
                prio = bool(int(es.getargv(4)))
            except ValueError:
                prio = False
        else:
            prio = False
        if argc >= 4:
            if p:
                users = es.getargv(3)
                p.send(playerlib.getUseridList(users),prio)
            else:
                es.dbgmsg(0,"Popup send:No such popup: "+pname)
        else:
            es.dbgmsg(0,"Syntax: popup send <popupname> <users>")
    elif subcmd == "unsendname":
        if argc == 4:
            if p:
                users = es.getargv(3)
                popuplib.unsendname(pname, playerlib.getUseridList(users))
            else:
                es.dbgmsg(0,"Popup unsendname: No such popup: "+pname)
        else:
            es.dbgmsg(0,"Syntax: popup unsendname <popupname> <users>")
    elif subcmd == "close":
        if argc == 4:
            if p:
                users = es.getargv(3)
                popuplib.close(pname, playerlib.getUseridList(users))
            else:
                es.dbgmsg(0,"Popup close: No such popup: "+pname)
        else:
            es.dbgmsg(0,"Syntax: popup close <popupname> <users>")
    elif subcmd == "isqueued":
        if argc == 5:
            if p:
                retvar = es.getargv(3)
                userid = int(es.getargv(4))
                es.set(retvar,popuplib.isqueued(pname,userid))
            else:
                es.dbgmsg(0,"Popup isqueued: No such popup: "+pname)
        else:
            es.dbgmsg(0,"Syntax: popup isqueued <popupname> <var> <userid>")
    elif subcmd == "active":
        if argc == 5:
            retvar = es.getargv(3)
            userid = int(es.getargv(4))
            try:
                r = popuplib.active(userid)
                es.set(pname,r['name'])
                es.set(retvar,r['count'])
            except KeyError:
                es.dbgmsg(0,"Popup active: No userid "+str(userid)+" on server.")
        else:
            es.dbgmsg(0,"Syntax: popup active <name var> <count var> <userid>")
    elif subcmd == "exists":
        if argc == 4:
            retvar = es.getargv(3)
            es.set(retvar,int(popuplib.exists(pname)))
        else:
            es.dbgmsg(0,"Syntax: popup exists <popupname> <var>")
    elif subcmd == "addlinef":
        if argc > 3:
            if p:
                text = _formatv(3)
                p.addline(text)
            else:
                es.dbgmsg(0,"Popup addlinef: No such popup: "+pname)
        else:
            es.dbgmsg(0,"Syntax: popup addlinef <popupname> <format> [vartoken1] ... [vartoken9]")
    elif subcmd == "inslinef":
        if argc > 4:
            if p:
                line = int(es.getargv(3))
                text = _formatv(4)
                p.insline(line,text)
            else:
                es.dbgmsg(0,"Popup inslinef: No such popup: "+pname)
        else:
            es.dbgmsg(0,"Syntax: popup inslinef <popupname> <line#> <format> [vartoken1] ... [vartoken9]")
    elif subcmd == "modlinef":
        if argc > 4:
            if p:
                line = int(es.getargv(3))
                text = _formatv(4)
                p.modline(line,text)
            else:
                es.dbgmsg(0,"Popup modlinef: No such popup: "+pname)
        else:
            es.dbgmsg(0,"Syntax: popup modlinef <popupname> <line#> <format> [vartoken1] ... [vartoken9]")
    elif subcmd == "cachemode":
        if argc == 4:
            if p:
                tomode = es.getargv(3)
                p.cachemode = tomode
            else:
                es.dbgmsg(0,"Popup cachemode: No such popup: "+pname)
        else:
            es.dbgmsg(0,"Syntax: popup cachemode <popupname> <mode>")
            es.dbgmsg(0," mode: \"global\", \"static\" or \"user\"")
    elif subcmd == "recache":
        if argc > 2:
            if p:
                if argc == 4:
                    users = playerlib.getUseridList(es.getargv(3))
                    p.recache(users)
                else: p.recache()
            else:
                es.dbgmsg(0,"Popup recache: No such popup: "+pname)
        else:
            es.dbgmsg(0,"Syntax: popup recache <popupname> [users]")
    elif subcmd == "update":
        if argc == 4:
            if p:
                users = playerlib.getUseridList(es.getargv(3))
                p.update(users)
            else:
                es.dbgmsg(0,"Popup update: No such popup: "+pname)
        else:
            es.dbgsmg(0,"Syntax: popup update <popupname> <users>")
    elif subcmd == "displaymode":
        if argc == 4:
            if p:
                tomode = es.getargv(3)
                p.displaymode = tomode
            else:
                es.dbgmsg(0,"Popup displaymode: No such popup: "+pname)
        else:
            es.dbgmsg(0,"Syntax: popup displaymode <popupname> <mode>")
            es.dbgmsg(0," mode: \"normal\" or \"sticky\"")
    elif subcmd == "construct":
        if argc == 6:
            varp = es.getargv(5)
        else:
            varp = "_popup_choice"
        if argc >= 5:
            plist = es.getargv(3)
            pflags = es.getargv(4)
            nep = popuplib.construct(pname,plist,pflags)
            nep.c_savevar = varp
        else:
            es.dbgmsg(0,"Syntax: popup construct <popupname> <list> <flags> [var]")
    elif subcmd == "setvar":
        if argc == 5:
            if p:
                ok = False
                varp = es.getargv(3)
                if varp.isalnum():
                    ok = True
                else:
                    if varp[:2] == "c_" and varp[2:].isalnum():
                        ok = True
                varv = es.getargv(4)
                if ok:
                    p.__setattr__(varp,varv)
                else:
                    es.dbgmsg(0,"Invalid popup variable name")
            else:
                es.dbgmsg(0,"Popup setvar: No such popup: "+pname)
        else:
            es.dbgmsg(0,"Syntax: popup setvar <popupname> <variable> <value>")
    elif subcmd == "getvar":
        if argc == 5:
            if p:
                ok = False
                varp = es.getargv(3)
                varv = es.getargv(4)
                if varv.isalnum():
                    ok = True
                else:
                    if varv[:2] == "c_" and varv[2:].isalnum():
                        ok = True
                if ok:
                    es.set(varp, p.__getattr__(varv))
                else:
                    es.dbgmsg(0,"Invalid popup variable name")
            else:
                es.dbgmsg(0,"Popup getvar: No such popup: "+pname)
        else:
            es.dbgmsg(0,"Syntax: popup getvar <popupname> <var> <variable>")
    elif subcmd == "easymenu":
        if argc == 5:
            varp = es.getargv(3)
            block = es.getargv(4)
            popuplib.easymenu(pname,varp,block)
        else:
            es.dbgmsg(0,"Syntax: popup easymenu <popupname> <var> <block>")
    elif subcmd == "addoption":
        if argc > 4:
            if p:
                item = str(es.getargv(3))
                text = str(es.getargv(4))
                if argc == 6: state = int(es.getargv(5))
                else: state = 1
                p.addoption(item, text, state)
            else:
                es.dbgmsg(0,"Easymenu addoption: No such popup: "+pname)
        else:
            es.dbgmsg(0,"Syntax: popup addoption <popupname> <value> <text> [state]")
    elif subcmd == "setoption":
        if argc > 3:
            if p:
                item = int(es.getargv(3))
                if argc == 5:
                    text = es.getargv(4)
                    if int(text) > 0 and int(text) <= 2 or str(text) == '0':
                        p.setoption(item,None,int(text))
                    else:
                        p.setoption(item,text,None)
                elif argc == 6:
                    text = es.getargv(4)
                    state = int(es.getargv(5))
                    p.setoption(item,text,state)
            else:
                es.dbgmsg(0,"Easymenu setoption: No such popup: "+pname)
        else:
            es.dbgmsg(0,"Syntax: popup setoption <popupname> <item> [text] [state]")
    elif subcmd == "description":
        if argc == 4:
            if p:
                text = es.getargv(3)
                p.setdescription(text)
            else:
                es.dbgmsg(0,"Popup description: No such popup: "+pname)
        else:
            es.dbgmsg(0,"Usage: popup description <popupname> <text>")
    elif subcmd == "info":
        if argc >= 3:
            if argc == 4:
                listlevel = int(es.getargv(3))
            else:
                listlevel = 4
            if p:
                p.information(listlevel)
        else:
            es.dbgmsg(0, "Syntax: popup info <popupname> [level]")
    elif subcmd == "emulate":
        if argc == 5:
            if p:
                item = int(es.getargv(3))
                users = es.getargv(4)
                popuplib.emulate(pname,item,users)
            else:
                es.dbgmsg(0,"Popup emulate: No such popup: "+pname)
        else:
            es.dbgmsg(0,"Syntax: popup emulate <popupname> <choice#> <users>")
    elif subcmd == "editlang":
        if argc == 4:
            if p:
                p.editlang = str(es.getargv(3))
            else:
                es.dbgmsg(0,"Popup editlang: No such popup: "+pname)
        else:
            es.dbgmsg(0,"Syntax: popup editlang <popupname> <language>")
    elif subcmd == "setstyle":
        if argc >= 3:
            style = es.getargv(argc-1)
            passvalue = 0
            if style.startswith("radio"): passvalue |= 1
            if style.startswith("esc"): passvalue |= 2
            if style.endswith("!"): passvalue |= 128
            if argc == 4:
                if p:
                    p.visualstyle = passvalue
                else:
                    es.dbgmsg(0,"Popup setstyle: No such popup: "+pname)
            else:
                popuplib.gameSupportAdmin = passvalue
        else:
            es.dbgmsg(0,"Syntax: popup setstyle [popupname] {auto|radio|esc}[!]")
    elif subcmd == "quicksend":
        if argc == 6:
            block = str(es.getargv(5))
        else:
            block = ""
        if argc > 4:
            time = float(es.getargv(2))
            userid = float(es.getargv(3))
            text = str(es.getargv(4))
            popuplib.quicksend(time,userid,text,block)
        else:
            es.dbgmsg(0,"Syntax: popup quicksend <time> <userid> <text> [block]")
    elif subcmd == "list":
        es.dbgmsg(0,"---------- List of popups:")
        if argc == 2:
            listlevel = 0
        else:
            listlevel = int(pname)
        for pname in popuplib.gPopups:
            p = popuplib.gPopups[pname]
            p.information(listlevel)
        if argc == 2:
            es.dbgmsg(0, " ")
            es.dbgmsg(0, "For more details, supply list level (0-4):")
            es.dbgmsg(0, "Syntax: popup list [level]")
        es.dbgmsg(0,"----------")
    else:
        es.dbgmsg(0,"Invalid popup subcommand, see http://www.eventscripts.com/pages/Popup/ for help")
예제 #41
0
def unload():
    popuplib.delete("xasettingmenu")
    xasettings.unregister()
예제 #42
0
def unload():
    for menu in menulist:
        if popuplib.exists(str(menu)):
            popuplib.delete(str(menu))
    xaconfig.unregister()
예제 #43
0
def unload():
    for menu in menulist:
        if popuplib.exists(str(menu)):
            popuplib.delete(str(menu))
    xaconfig.unregister()
예제 #44
0
 def __del__(self):
     """ Default deconstructor. clear the initializations we creating in __init__ """
     popuplib.delete("sourcerpg_admin")
예제 #45
0
import es
예제 #46
0
import es
예제 #47
0
import es