示例#1
0
def customVoteQuestions():
    userid = es.getcmduserid()
    title = str(es.getargs()).split('^^^')[0].strip()
    questions = str(es.getargs()).split('^^^')[1].split(',')
    myvote = Vote(str(userid))
    myvote.CreateVote(title)
    for question in questions:
        myvote.AddOption(question.strip())
    myvote.StartVote()
示例#2
0
def customVoteQuestions():
    userid    = es.getcmduserid()
    title     = str(es.getargs()).split('^^^')[0].strip()
    questions = str(es.getargs()).split('^^^')[1].split(',')
    myvote = Vote(str(userid))
    myvote.CreateVote(title)
    for question in questions:
        myvote.AddOption(question.strip())
    myvote.StartVote()
示例#3
0
def services_proxy():
  service = es.getargv(1)
  myserv = services.use(service)
  if not isinstance(myserv, LegacyAuthorizationService):
    # e2py
    function = es.getargv(2)
  
    # HACK: For auth services
    responsevarn = 0
    responsevar = None
    if service=="auth":
      # fix the case of the function
      for caser in returnvarlist.keys():
        if caser.lower() == function.lower():
          function = caser
      responsevarn = returnvarlist[function] if returnvarlist.has_key(function) else 0
      if responsevarn:
        responsevar = es.ServerVar(es.getargv(responsevarn))
    
    arglist = [myserv]
    for j in range(3,es.getargc()):
      if not j == responsevarn:
        arglist.append(es.getargv(j))
    func = myserv.__class__.__dict__[function]
    d = func(*arglist)
    if d is not None and responsevar is not None:
      responsevar.set(d)
  else:
    # e2e
    cmd = myserv.cmdname
    args = es.getargs()[len(service)+1:]
    newcmd = "%s %s" % (cmd, args)
    es.server.cmd(newcmd)
示例#4
0
def services_proxy():
    service = es.getargv(1)
    myserv = services.use(service)
    if not isinstance(myserv, LegacyAuthorizationService):
        # e2py
        function = es.getargv(2)

        # HACK: For auth services
        responsevarn = 0
        responsevar = None
        if service == "auth":
            # fix the case of the function
            for caser in returnvarlist.keys():
                if caser.lower() == function.lower():
                    function = caser
            responsevarn = returnvarlist[function] if returnvarlist.has_key(
                function) else 0
            if responsevarn:
                responsevar = es.ServerVar(es.getargv(responsevarn))

        arglist = [myserv]
        for j in range(3, es.getargc()):
            if not j == responsevarn:
                arglist.append(es.getargv(j))
        func = myserv.__class__.__dict__[function]
        d = func(*arglist)
        if d is not None and responsevar is not None:
            responsevar.set(d)
    else:
        # e2e
        cmd = myserv.cmdname
        args = es.getargs()[len(service) + 1:]
        newcmd = "%s %s" % (cmd, args)
        es.server.cmd(newcmd)
示例#5
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)
示例#6
0
 def __call__(self):
     self.run(priority=True,
              userargs={
                  'cmdname': getargv(0),
                  'argv': list(map(getargv, range(1, getargc()))),
                  'args': getargs(),
                  'uid': int(getcmduserid())
              })
     sv.save()
示例#7
0
def buyxp(userid, args):
    userid = str(es.getcmduserid())
    buyxp_msg = langlib.Strings(
        es.getAddonPath("superhero") + "/languages/buyxp_msg.ini")
    global popup_language
    tokens = {}
    if int(es.ServerVar('buyxp')) != 0:
        playerList = playerlib.getPlayerList('#human,#all')
        if len(playerList) >= int(es.ServerVar('buyxp_players')):
            amount = es.getargs()
            if amount != None:
                player = playerlib.getPlayer(userid)
                cash = int(player.getCash())
                if str(amount) == 'all':
                    xp = cash * float(es.ServerVar('xp_dollar'))
                    string = 'Used ' + str(amount) + '$'
                    sh_givexp(userid, int(xp), string)
                    player.setCash(0)
                    return
                elif str(amount) == '#all':
                    xp = cash * float(es.ServerVar('xp_dollar'))
                    string = 'Used ' + str(amount) + '$'
                    sh_givexp(userid, int(xp), string)
                    player.setCash(0)
                    return
                amount = int(amount)
                if amount >= 100:
                    if amount <= cash:
                        xp = amount * float(es.ServerVar('xp_dollar'))
                        string = 'Used ' + str(amount) + '$'
                        sh_givexp(userid, int(xp), string)
                        player.setCash(cash - amount)
                    else:
                        tokens['amount'] = amount
                        es.tell(
                            userid, '#multi',
                            buyxp_msg('buyxp_notamount',
                                      tokens,
                                      lang=str(popup_language)))
                else:
                    es.tell(
                        userid, '#multi',
                        buyxp_msg('buyxp_notenough', lang=str(popup_language)))
            else:
                es.tell(userid, '#multi',
                        buyxp_msg('buyxp_none', lang=str(popup_language)))
        else:
            tokens['players'] = es.ServerVar('buyxp_players')
            es.tell(
                userid, '#multi',
                buyxp_msg('buyxp_players', tokens, lang=str(popup_language)))
    else:
        es.tell(userid, '#multi',
                buyxp_msg('buyxp_disabled', lang=str(popup_language)))
示例#8
0
def drop(userid, args):
    userid = str(userid)
    steamid = es.getplayersteamid(userid)
    heroname = str(es.getargs())
    global popup_language
    drop_msg = langlib.Strings(
        es.getAddonPath("superhero/languages/drop_msg.ini"))
    if int(es.ServerVar('drop_alive')) == 0:
        if int(playerlib.getPlayer(userid).isdead) == 0:
            es.tell(userid, '#multi',
                    drop_msg('drop_alive', lang=str(popup_language)))
            return
    pid, plevel, punspent, pheroes, ppower1, ppower2, ppower3 = cursor.execute(
        'SELECT id, level, unspent, heroes, power1, power2, power3 FROM users WHERE id=?',
        (steamid, )).fetchone()
    heroes = pheroes
    heroes = heroes.split(',')
    text = langlib.Strings(
        es.getAddonPath("superhero/heroes/" + heroname + "/strings.ini"))
    tokens = {}
    tokens['heroname'] = heroname
    if heroname in heroes:
        heroes.remove(heroname)
        string = heroes[0]
        for hero in heroes:
            if not hero in string:
                string = string + ',' + str(hero)
        cursor.execute('UPDATE users SET heroes=? WHERE id=?',
                       (string, steamid))
        cursor.execute('UPDATE users SET unspent=(unspent + 1) WHERE id=?',
                       (steamid, ))
        connection.commit()
        if int(text('power')) == 1:
            if ppower1 == heroname:
                cursor.execute('UPDATE users SET power1=\'0\' WHERE id=?',
                               (steamid, ))
                connection.commit()
            if ppower2 == heroname:
                cursor.execute('UPDATE users SET power2=\'0\' WHERE id=?',
                               (steamid, ))
                connection.commit()
            if ppower3 == heroname:
                cursor.execute('UPDATE users SET power3=\'0\' WHERE id=?',
                               (steamid, ))
                connection.commit()
        es.tell(userid, '#multi',
                drop_msg('drop_suc', tokens, lang=str(popup_language)))
    else:
        es.tell(userid, '#multi',
                drop_msg('drop_not', tokens, lang=str(popup_language)))
示例#9
0
def exp(args_dummy):
    args = es.getargs()
    if ('\(' in args) or ('\)' in args):
        args = args.replace('\(', '%left%').replace('\)', '%right%').replace(
            '\"', '%quote%')
    if args and ('(' in args) and (')' in args):
        global funcs
        global uxpfuncs
        global regex1
        global srcdsargs
        if args.count('"') % 2:
            args += '"'
        infuncs = regex1.findall(''.join(re.findall('"[^"]*"|([^"]+)', args)))
        if infuncs:
            regex2 = re.compile('(' + '|'.join(infuncs) +
                                ')\\((("[^\\(\\)"]*"|[^\\(\\)"]+)*)\\)')
            temp = True
            count = 10
            while temp:
                count -= 1
                if not count:
                    temp = 0
                regex = regex2.search(args)
                if regex:
                    regex = regex.groups()
                    func = regex[0]
                    val = regex[1]
                    es.msg(func + '(' + val + ')')
                    if func in funcs:
                        if not func in ('nq', 'eq'):
                            es.server.cmd('_exp_eval ' + val)
                        else:
                            srcdsargs = val
                        if len(srcdsargs) >= funcs[func]['minargs']:
                            if func in uxpfuncs:
                                uxp_eval(func, srcdsargs)
                                result = es.server_var['_uxp_result']
                            else:
                                funcpointer = funcs[func]['function']
                                result = funcpointer(srcdsargs)
                            if not func in ('nq', 'eq'):
                                result = '"' + result + '"'
                        else:
                            result = '0'
                        args = args.replace(func + '(' + val + ')', result)
                else:
                    temp = False
    args = args.replace('%left%', '(').replace('%right%',
                                               '(').replace('%quote%', '"')
    es.server.cmd(args)
示例#10
0
def exp(args_dummy):
    args = es.getargs()
    if ("\(" in args) or ("\)" in args):
        args = args.replace("\(", "%left%").replace("\)", "%right%").replace('"', "%quote%")
    if args and ("(" in args) and (")" in args):
        global funcs
        global uxpfuncs
        global regex1
        global srcdsargs
        if args.count('"') % 2:
            args += '"'
        infuncs = regex1.findall("".join(re.findall('"[^"]*"|([^"]+)', args)))
        if infuncs:
            regex2 = re.compile("(" + "|".join(infuncs) + ')\\((("[^\\(\\)"]*"|[^\\(\\)"]+)*)\\)')
            temp = True
            count = 10
            while temp:
                count -= 1
                if not count:
                    temp = 0
                regex = regex2.search(args)
                if regex:
                    regex = regex.groups()
                    func = regex[0]
                    val = regex[1]
                    es.msg(func + "(" + val + ")")
                    if func in funcs:
                        if not func in ("nq", "eq"):
                            es.server.cmd("_exp_eval " + val)
                        else:
                            srcdsargs = val
                        if len(srcdsargs) >= funcs[func]["minargs"]:
                            if func in uxpfuncs:
                                uxp_eval(func, srcdsargs)
                                result = es.server_var["_uxp_result"]
                            else:
                                funcpointer = funcs[func]["function"]
                                result = funcpointer(srcdsargs)
                            if not func in ("nq", "eq"):
                                result = '"' + result + '"'
                        else:
                            result = "0"
                        args = args.replace(func + "(" + val + ")", result)
                else:
                    temp = False
    args = args.replace("%left%", "(").replace("%right%", "(").replace("%quote%", '"')
    es.server.cmd(args)
示例#11
0
def exp(args_dummy):
    args = es.getargs()
    if ('\(' in args) or ('\)' in args):
        args = args.replace('\(', '%left%').replace('\)', '%right%').replace('\"', '%quote%')
    if args and ('(' in args) and (')' in args):
        global funcs
        global uxpfuncs
        global regex1
        global srcdsargs
        if args.count('"') % 2:
            args += '"'
        infuncs = regex1.findall(''.join(re.findall('"[^"]*"|([^"]+)', args)))
        if infuncs:
            regex2 = re.compile('(' + '|'.join(infuncs) + ')\\((("[^\\(\\)"]*"|[^\\(\\)"]+)*)\\)')
            temp = True
            count = 10
            while temp:
                count -= 1
                if not count:
                    temp = 0
                regex = regex2.search(args)
                if regex:
                    regex = regex.groups()
                    func = regex[0]
                    val = regex[1]
                    es.msg(func + '(' + val + ')')
                    if func in funcs:
                        if not func in ('nq', 'eq'):
                            es.server.cmd('_exp_eval ' + val)
                        else:
                            srcdsargs = val
                        if len(srcdsargs) >= funcs[func]['minargs']:
                            if func in uxpfuncs:
                                uxp_eval(func, srcdsargs)
                                result = es.server_var['_uxp_result']
                            else:
                                funcpointer = funcs[func]['function']
                                result = funcpointer(srcdsargs)
                            if not func in ('nq', 'eq'):
                                result = '"' + result + '"'
                        else:
                            result = '0'
                        args = args.replace(func + '(' + val + ')', result)
                else:
                    temp = False
    args = args.replace('%left%', '(').replace('%right%', '(').replace('%quote%', '"')
    es.server.cmd(args)
def buyxp(userid, args):
    userid = str(es.getcmduserid())
    buyxp_msg = langlib.Strings(es.getAddonPath("superhero") + "/languages/buyxp_msg.ini")
    global popup_language
    tokens = {}
    if int(es.ServerVar('buyxp')) != 0:
        playerList = playerlib.getPlayerList('#human,#all')
        if len(playerList) >= int(es.ServerVar('buyxp_players')):
            amount = es.getargs()
            if amount != None:
                player = playerlib.getPlayer(userid)
                cash = int(player.getCash())
                if str(amount) == 'all':
                    xp = cash * float(es.ServerVar('xp_dollar'))
                    string = 'Used '+str(amount)+'$'
                    sh_givexp(userid,int(xp),string)
                    player.setCash(0)
                    return                  
                elif str(amount) == '#all':
                    xp = cash * float(es.ServerVar('xp_dollar'))
                    string = 'Used '+str(amount)+'$'
                    sh_givexp(userid,int(xp),string)
                    player.setCash(0)
                    return         
                amount = int(amount)
                if amount >= 100:
                    if amount <= cash:
                        xp = amount * float(es.ServerVar('xp_dollar'))
                        string = 'Used '+str(amount)+'$'
                        sh_givexp(userid,int(xp),string)
                        player.setCash(cash-amount)
                    else:
                        tokens['amount'] = amount
                        es.tell(userid,'#multi',buyxp_msg('buyxp_notamount',tokens,lang=str(popup_language)))
                else:
                    es.tell(userid,'#multi',buyxp_msg('buyxp_notenough',lang=str(popup_language)))
            else:
                es.tell(userid,'#multi',buyxp_msg('buyxp_none',lang=str(popup_language)))
        else:
            tokens['players'] = es.ServerVar('buyxp_players')
            es.tell(userid,'#multi',buyxp_msg('buyxp_players',tokens,lang=str(popup_language)))
    else:
        es.tell(userid,'#multi',buyxp_msg('buyxp_disabled',lang=str(popup_language)))
def drop(userid, args):
    userid = str(userid)
    steamid = es.getplayersteamid(userid)
    heroname = str(es.getargs())
    global popup_language
    drop_msg = langlib.Strings(es.getAddonPath("superhero/languages/drop_msg.ini"))
    if int(es.ServerVar('drop_alive')) == 0:
        if int(playerlib.getPlayer(userid).isdead) == 0:
            es.tell(userid,'#multi',drop_msg('drop_alive',lang=str(popup_language)))
            return
    pid, plevel, punspent, pheroes, ppower1, ppower2, ppower3 = cursor.execute('SELECT id, level, unspent, heroes, power1, power2, power3 FROM users WHERE id=?', (steamid,)).fetchone()
    heroes = pheroes
    heroes = heroes.split(',')
    text = langlib.Strings(es.getAddonPath("superhero/heroes/"+heroname+ "/strings.ini"))
    tokens = {}
    tokens['heroname'] = heroname
    if heroname in heroes:
        heroes.remove(heroname)
        string = heroes[0]
        for hero in heroes:
            if not hero in string:
                string = string+','+str(hero)
        cursor.execute('UPDATE users SET heroes=? WHERE id=?', (string,steamid))
        cursor.execute('UPDATE users SET unspent=(unspent + 1) WHERE id=?', (steamid,))
        connection.commit()
        if int(text('power')) == 1:
            if ppower1 == heroname:
                cursor.execute('UPDATE users SET power1=\'0\' WHERE id=?', (steamid,))
                connection.commit()
            if ppower2 == heroname:
                cursor.execute('UPDATE users SET power2=\'0\' WHERE id=?', (steamid,))
                connection.commit()
            if ppower3 == heroname:
                cursor.execute('UPDATE users SET power3=\'0\' WHERE id=?', (steamid,))
                connection.commit()
        es.tell(userid,'#multi',drop_msg('drop_suc',tokens,lang=str(popup_language)))
    else:
        es.tell(userid,'#multi',drop_msg('drop_not',tokens,lang=str(popup_language)))      
示例#14
0
def rcon_map_cmd():
    """Appends the command to the end of the queue of server commands to execute next map"""
    xarcon.logging.log("set the rcon command %s to be executed next map" % es.getargs(), es.getcmduserid(), True)
    list_map_rcon.append(es.getargs())
示例#15
0
def rcon_cmd():
    """Appends the command to the end of the queue of server commands to execute"""
    xarcon.logging.log("used rcon command %s" % es.getargs(), es.getcmduserid(), True )
    es.server.queuecmd(es.getargs())
示例#16
0
 def concommand(self):
   command, argv, args, exp = escompile(getargv(0), list(map(getargv, range(1, getargc()))), getargs())
   line = (None, command, argv, args, exp)
   stack.queue([line], 'console', priority=True)
   sv.save()
示例#17
0
 def __call__(self):
   self.run(priority=True, userargs={'cmdname': getargv(0), 'argv': list(map(getargv, range(1, getargc()))), 'args': getargs(), 'uid': int(getcmduserid())})
   sv.save()
示例#18
0
def rcon_cmd():
    """Appends the command to the end of the queue of server commands to execute"""
    es.server.queuecmd(es.getargs())
示例#19
0
def rcon_round_cmd():
    """Appends the command to the end of the queue of server commands to execute next round"""
    list_round_rcon.append(es.getargs())
示例#20
0
def rcon_cmd():
    """Appends the command to the end of the queue of server commands to execute"""
    xarcon.logging.log("used rcon command %s" % es.getargs(),
                       es.getcmduserid(), True)
    es.server.queuecmd(es.getargs())
示例#21
0
 def concommand(self):
   command, argv, args, exp = escompile(getargv(0), list(map(getargv, range(1, getargc()))), getargs())
   line = (None, command, argv, args, exp)
   stack.queue([line], 'console', priority=True)
   sv.save()
示例#22
0
 def __str__(self):
    return es.getargs()
示例#23
0
 def __str__(self):
    return es.getargs()
示例#24
0
def rcon_map_cmd():
    """Appends the command to the end of the queue of server commands to execute next map"""
    list_map_rcon.append(es.getargs())
示例#25
0
def rcon_map_cmd():
    """Appends the command to the end of the queue of server commands to execute next map"""
    xarcon.logging.log(
        "set the rcon command %s to be executed next map" % es.getargs(),
        es.getcmduserid(), True)
    list_map_rcon.append(es.getargs())
示例#26
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)