Exemplo n.º 1
0
def customVoteTitle():
    userid = es.getcmduserid()
    title = es.getargs()
    lang = playerlib.getPlayer(userid).get("lang")
    es.escinputbox(30, userid, xalanguage("vote options", lang=lang),
                   xalanguage("select vote options", lang=lang),
                   'xa_set_options %s ^^^' % title)
Exemplo n.º 2
0
def _newgroup_handle(userid, choice, popupid):
    es.dbgmsg(1, '*****_newgroup_handle')
    if auth.isUseridAuthorized(userid, 'manage_auth'):
        es.escinputbox(
            30, userid,
            'Add a group:\n <groupname- no spaces>, <grouptype>\n -Accepted types (in order of most powerful to least)\n- admin \n  poweruser \n  known \n  all',
            '<groupname> <access level>', 'newgroup')
Exemplo n.º 3
0
def _setconfig_handle(userid, module, var, parent):
    if xaconfig.isUseridAuthorized(userid, 'change_config'):
        es.escinputbox(
            30, userid, "Change '" + str(var.getName()) + "' setting" +
            '\n \nCurrent value: ' + str(var) + '\nDefault value: ' +
            str(var._def) + '\n \n' + str(var._descr),
            'Type in the new value:', 'setconfig ' + str(parent) + ' ' +
            str(module) + ' ' + str(var.getName()))
Exemplo n.º 4
0
def _setconfig_handle(userid, module, key, lang, parent):
    if xalanguage.isUseridAuthorized(userid, 'change_language'):
        keylist = langlist[str(module)]
        es.escinputbox(
            30, userid, "Change '" + str(keylist(key, lang)) + "' string",
            'Type in the new string:', 'setlanguage ' + str(parent) + ' ' +
            str(module) + ' ' + str(lang) + ' ' + str(key).replace(' ', '+'))
        es.tell(userid, '#green',
                xalang('press esc',
                       playerlib.getPlayer(userid).get('lang')))
Exemplo n.º 5
0
    def addXp(self, userid, choice, popupid):
        """
        This method adds a cetain amount of experience to a player. If the player
        is online when we shall execute the method to add the experience; otherwise
        we have to query the experience levels and credits and simulate the 
        main thesis behind incrementing the experience and testing for levels up
        only with values from the database rather than throught the PlayerObject
        instance.
        
        @PARAM userid - the admin who gave the experience
        @PARAM choice - the amount of experience to award
        @PARAM popupid - the id of the popup which was used to give the player experience
        """
        target = popupid.replace("sourcerpg_addxp_player", "")
        if isinstance(choice, str):
            if choice.isdigit():
                choice = int(choice)
        if isinstance(choice, int):
            tokens = {}
            tokens['amount'] = str(choice)
            if popup.isOnline(target):
                player = es.getuserid(target)
                sourcerpg.players[player].addXp(choice, 'being liked by the admin')
                tokens['name'] = sourcerpg.players[player]['name']
                if userid is not None:
                    self.chosenPlayer(userid, target, "sourcerpg_onlineplayers")
            else:
                query = "SELECT xp,level,name FROM Player WHERE steamid=?"
                sourcerpg.database.execute(query, target)
                xp, level, name = sourcerpg.database.fetchone()
                xp += choice
                amountOfLevels = 0
                nextXpAmount = level * int(sourcerpg.xpIncrement) + int(sourcerpg.startXp)
                while xp > nextXpAmount:
                    xp -= nextXpAmount
                    amountOfLevels += 1
                    nextXpAmount += int(sourcerpg.xpIncrement)
                if amountOfLevels:
                    query = "UPDATE Player SET xp=?, level=level+?, credits=credits+? WHERE steamid=?"
                    sourcerpg.database.execute(query, xp, amountOfLevels, amountOfLevels * int(sourcerpg.creditsReceived), target)
                else:
                    query = "UPDATE Player SET xp=? WHERE steamid=?"
                    sourcerpg.database.execute(query, xp, target)
                sourcerpg.database.execute(query)

                tokens['name'] = name
                if userid is not None:
                    self.chosenPlayer(userid, target, "sourcerpg_offlineplayers")
            if userid is not None:
                tell(userid, 'add xp', tokens)
        else:
            tell(userid, 'escape')
            es.escinputbox(30, userid, '=== %s Add Xp ===' % sourcerpg.prefix, 
                'Enter the amount' , 'rpgaddxp %s' % target)
Exemplo n.º 6
0
 def addLevels(self, userid, choice, popupid):
     """
     This method adds a cetain amount of levels to a player by a given
     steamid. If the player is currently online then add the levels by
     the sourcerpg player object; otherwise query the database and update
     it via that.
     
     @PARAM userid - the admin who gave the levels
     @PARAM choice - the amount of levels to give
     @PARAM popupid - the id of the popup which was used to give the player levels
     """
     target = popupid.replace("sourcerpg_addlevel_player", "")
     tokens = {}
     tokens['amount'] = str(choice)
     if isinstance(choice, str):
         if choice.isdigit():
             choice = int(choice)
     if isinstance(choice, int):
         if popup.isOnline(target):
             player = es.getuserid(target)
             sourcerpg.players[player].addLevel(choice)
             tokens['name'] = sourcerpg.players[player]['name']
             if userid is not None:
                 self.chosenPlayer(userid, target,
                                   "sourcerpg_onlineplayers")
         else:
             query = "UPDATE Player SET level=level+?, credits=credits+? WHERE steamid=?"
             sourcerpg.database.execute(
                 query, choice, (choice * sourcerpg.creditsReceived),
                 target)
             query = "SELECT name FROM Player WHERE steamid=?"
             sourcerpg.database.execute(query, target)
             name = sourcerpg.database.fetchone()
             tokens['name'] = name
             if userid is not None:
                 self.chosenPlayer(userid, target,
                                   "sourcerpg_offlineplayers")
         if userid is not None:
             tell(userid, 'add levels', tokens)
     else:
         tell(userid, 'escape')
         es.escinputbox(30, userid, '=== %s Add Xp ===' % sourcerpg.prefix,
                        'Enter the amount', 'rpgaddlevels %s' % target)
Exemplo n.º 7
0
 def addLevels(self, userid, choice, popupid):
     """
     This method adds a cetain amount of levels to a player by a given
     steamid. If the player is currently online then add the levels by
     the sourcerpg player object; otherwise query the database and update
     it via that.
     
     @PARAM userid - the admin who gave the levels
     @PARAM choice - the amount of levels to give
     @PARAM popupid - the id of the popup which was used to give the player levels
     """
     target = popupid.replace("sourcerpg_addlevel_player", "")
     tokens = {}
     tokens['amount'] = str(choice)
     if isinstance(choice, str):
         if choice.isdigit():
             choice = int(choice)
     if isinstance(choice, int):
         if popup.isOnline(target):
             player = es.getuserid(target)
             sourcerpg.players[player].addLevel(choice)
             tokens['name'] = sourcerpg.players[player]['name']
             if userid is not None:
                 self.chosenPlayer(userid, target, "sourcerpg_onlineplayers")
         else:
             query = "UPDATE Player SET level=level+?, credits=credits+? WHERE steamid=?"
             sourcerpg.database.execute(query, choice, (choice * sourcerpg.creditsReceived), target)
             query = "SELECT name FROM Player WHERE steamid=?"
             sourcerpg.database.execute(query, target)
             name = sourcerpg.database.fetchone()
             tokens['name'] = name
             if userid is not None:
                 self.chosenPlayer(userid, target, "sourcerpg_offlineplayers")
         if userid is not None:
             tell(userid, 'add levels', tokens)
     else:
         tell(userid, 'escape')
         es.escinputbox(30, userid, '=== %s Add Xp ===' % sourcerpg.prefix,
             'Enter the amount' , 'rpgaddlevels %s' % target)
Exemplo n.º 8
0
def _newgroup_handle(userid,choice,popupid):
    es.dbgmsg(1,'*****_newgroup_handle')
    if auth.isUseridAuthorized(userid, 'manage_auth'):
        es.escinputbox(30,userid,'Add a group:\n <groupname- no spaces>, <grouptype>\n -Accepted types (in order of most powerful to least)\n- admin \n  poweruser \n  known \n  all','<groupname> <access level>','newgroup')
Exemplo n.º 9
0
def _setconfig_handle(userid, module, key, lang, parent):
    if xalanguage.isUseridAuthorized(userid, 'change_language'):
        keylist = langlist[str(module)]
        es.escinputbox(30,userid,"Change '"+str(keylist(key, lang))+"' string",'Type in the new string:','setlanguage '+str(parent)+' '+str(module)+' '+str(lang)+' '+str(key).replace(' ', '+'))
        es.tell(userid, '#green', xalang('press esc', playerlib.getPlayer(userid).get('lang')))
Exemplo n.º 10
0
def escinputbox(argv):
  es.escinputbox(*argv)
Exemplo n.º 11
0
def _setconfig_handle(userid, module, var, parent):
    if xaconfig.isUseridAuthorized(userid, 'change_config'):
        es.escinputbox(30,userid,"Change '"+str(var.getName())+"' setting"+'\n \nCurrent value: '+str(var)+'\nDefault value: '+str(var._def)+'\n \n'+str(var._descr),'Type in the new value:','setconfig '+str(parent)+' '+str(module)+' '+str(var.getName()))
Exemplo n.º 12
0
def customVote(userid, choice):
    lang = playerlib.getPlayer(userid).get("lang")
    es.escinputbox(30, userid, xalanguage("select vote title", lang=lang),
                   xalanguage("select vote title", lang=lang), 'xa_set_title')
    es.tell(userid, '#green', xalanguage("escape prompt", lang=lang))
Exemplo n.º 13
0
def escinputbox(argv):
    es.escinputbox(*argv)
Exemplo n.º 14
0
def customVoteTitle():
    userid = es.getcmduserid()
    title  = es.getargs()
    lang   = playerlib.getPlayer(userid).get("lang")
    es.escinputbox(30, userid, xalanguage("vote options", lang=lang), xalanguage("select vote options", lang=lang), 'xa_set_options %s ^^^'%title) 
Exemplo n.º 15
0
def customVote(userid, choice):
    lang = playerlib.getPlayer(userid).get("lang")
    es.escinputbox(30, userid, xalanguage("select vote title", lang=lang), xalanguage("select vote title", lang=lang), 'xa_set_title') 
    es.tell(userid, '#green',  xalanguage("escape prompt", lang=lang)) 
Exemplo n.º 16
0
    def addXp(self, userid, choice, popupid):
        """
        This method adds a cetain amount of experience to a player. If the player
        is online when we shall execute the method to add the experience; otherwise
        we have to query the experience levels and credits and simulate the 
        main thesis behind incrementing the experience and testing for levels up
        only with values from the database rather than throught the PlayerObject
        instance.
        
        @PARAM userid - the admin who gave the experience
        @PARAM choice - the amount of experience to award
        @PARAM popupid - the id of the popup which was used to give the player experience
        """
        target = popupid.replace("sourcerpg_addxp_player", "")
        if isinstance(choice, str):
            if choice.isdigit():
                choice = int(choice)
        if isinstance(choice, int):
            tokens = {}
            tokens['amount'] = str(choice)
            if popup.isOnline(target):
                player = es.getuserid(target)
                sourcerpg.players[player].addXp(choice,
                                                'being liked by the admin')
                tokens['name'] = sourcerpg.players[player]['name']
                if userid is not None:
                    self.chosenPlayer(userid, target,
                                      "sourcerpg_onlineplayers")
            else:
                query = "SELECT xp,level,name FROM Player WHERE steamid=?"
                sourcerpg.database.execute(query, target)
                xp, level, name = sourcerpg.database.fetchone()
                xp += choice
                amountOfLevels = 0
                nextXpAmount = level * int(sourcerpg.xpIncrement) + int(
                    sourcerpg.startXp)
                while xp > nextXpAmount:
                    xp -= nextXpAmount
                    amountOfLevels += 1
                    nextXpAmount += int(sourcerpg.xpIncrement)
                if amountOfLevels:
                    query = "UPDATE Player SET xp=?, level=level+?, credits=credits+? WHERE steamid=?"
                    sourcerpg.database.execute(
                        query, xp, amountOfLevels,
                        amountOfLevels * int(sourcerpg.creditsReceived),
                        target)
                else:
                    query = "UPDATE Player SET xp=? WHERE steamid=?"
                    sourcerpg.database.execute(query, xp, target)
                sourcerpg.database.execute(query)

                tokens['name'] = name
                if userid is not None:
                    self.chosenPlayer(userid, target,
                                      "sourcerpg_offlineplayers")
            if userid is not None:
                tell(userid, 'add xp', tokens)
        else:
            tell(userid, 'escape')
            es.escinputbox(30, userid, '=== %s Add Xp ===' % sourcerpg.prefix,
                           'Enter the amount', 'rpgaddxp %s' % target)