Beispiel #1
0
def bomb_defused(ev):
    userid = ev['userid']
    xp = random.randint(10, 70)
    xp_msg = langlib.Strings(
        es.getAddonPath('superhero') + '/languages/xp_msg.ini')
    global popup_language
    sh_givexp(userid, xp, xp_msg('xp_bombdefused', lang=str(popup_language)))
Beispiel #2
0
def herolist(userid, args):
    userid = str(userid)
    heroes = str(es.ServerVar('herolist'))
    heroes = heroes.split(',')
    herolist = popuplib.easymenu('herolist', None, None)
    herolist_popup = langlib.Strings(
        es.getAddonPath("superhero") + "/languages/herolist_popup.ini")
    global popup_language
    herolist.settitle(
        herolist_popup("herolist_title", lang=str(popup_language)))
    for hero in heroes:
        text = langlib.Strings(
            es.getAddonPath("superhero/heroes/" + hero + "/strings.ini"))
        string = str(text("heroname")) + '    -   ' + str(
            text("description", lang=str(popup_language)))
        herolist.addoption(None, string)
    #close_popups(userid)
    popuplib.send('herolist', userid)
Beispiel #3
0
def load():
    config.execute()
    lmv['command'] = str(lmv_command)
    if lmv['command']:
        cmdlib.registerSayCommand(lmv['command'],sendVote,'Send Player Vote popup')
        cmdlib.registerClientCommand(lmv['command'],sendVote,'Send Player Vote popup')
    ini = cfglib.AddonINI(addonpath + '/strings.ini')
    ini.addValueToGroup('Vote on GamePlay','en','Vote for next GamePlay:')
    ini.addValueToGroup('Vote on Map','en','Vote on a Map:')
    ini.addValueToGroup('Start GamePlay Vote','en','#green[LooneyMapVote]#default Use the command "#lightgreen$command#default" to vote for the next GamePlay')
    ini.addValueToGroup('End GamePlay Vote','en','#green[LooneyMapVote]#default Next GamePlay will be#lightgreen $gameplay#default!')
    ini.addValueToGroup('Start Map Vote','en','#green[LooneyMapVote]#default Use the command "#lightgreen$command#default" to Vote for the next Map')
    ini.addValueToGroup('End Map Vote','en','#green[LooneyMapVote]#default Next Map is#lightgreen $nextmap#default!')
    ini.addValueToGroup('Vote Not Started','en','#green[LooneyMapVote]#default Vote has not started yet')
    ini.addValueToGroup('Between Votes','en','#green[LooneyMapVote]#default Please wait to use this command, we are between votes')
    ini.addValueToGroup('Vote Over','en','#green[LooneyMapVote]#default Sorry, voting is over')
    ini.addValueToGroup('NextMap Decided','en','#green[LooneyMapVote]#default NextMap has already been decided.#lightgreen  NextMap#default:#green $nextmap')
    ini.addValueToGroup('Already Voted','en','#green[LooneyMapVote]#default You already voted for#lightgreen $playervote')
    ini.addValueToGroup('Player Vote','en','#green[LooneyMapVote]#default $player voted for#lightgreen $choice')
    ini.addValueToGroup('Time Remaining','en','#green[LooneyMapVote]#default Vote ends in $seconds seconds')
    ini.addValueToGroup('One Second Remains','en','#green[LooneyMapVote]#default Vote ends in 1 second')
    lmv['maps'] = cfglib.AddonINI(addonpath + '/maptypes.ini')
    for mapbsp in os.listdir(str(es.ServerVar('eventscripts_gamedir')) + '/maps/'):
        if not mapbsp.endswith('.bsp'): continue
        mapname = mapbsp[0:~3]
        if mapname in str(lmv_maps_to_not_use).split(','): continue
        allmaps.add(mapname)
        if notInHeader(mapname):
            prefix = mapname.split('_')[0] + '_'
            lmv['maps'].addValueToGroup(prefix,getNumber(prefix),mapname)
    lmv['maps'].write()
    serverlang = langlib.getDefaultLang()
    for gameplay in lmv['maps']:
        ini.addValueToGroup(gameplay,serverlang,gameplay)
    first = True
    for group in ini:
        if first:
            first = False
        else:
            ini.setGroupComments(group,'')
    ini.write()
    lmv['lang'] = langlib.Strings(ini)
    if lmv_scripts_for_gameplay:
        scriptpath = addonpath + '/scriptmanager'
        if not os.path.isdir(scriptpath):
            os.makedirs(scriptpath)
        for gameplay in lmv['maps']:
            gameplay_ini[gameplay] = cfglib.AddonINI(scriptpath + '/%s.ini'%gameplay)
            gameplay_ini[gameplay].addValueToGroup('Scripts','1','')
            gameplay_ini[gameplay].setGroupComments('Scripts',['Set scripts to be loaded for maptype below','Use a different number for each and follow the same syntax'])
            gameplay_ini[gameplay].addValueToGroup('Configs','1','')
            gameplay_ini[gameplay].setGroupComments('Configs',['Set .cfg files to be executed for maptype below','Use a different number for each and follow the same syntax','Please use the path relative to <gamename>','For instance, if your cfg is in <gamename>/cfg/myconfigs/configone.cfg, you would use "cfg/myconfigs/configone"'])
            gameplay_ini[gameplay].write()
    mapVote.mapStart(str(lmv_default_gameplay))
    mapVote.resetMapVote(str(es.ServerVar('eventscripts_currentmap')))
    startTimeVote()
Beispiel #4
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)))
Beispiel #5
0
def clearpowers(userid, args):
    userid = str(userid)
    steamid = es.getplayersteamid(userid)
    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, punspent, pheroes, ppower1, ppower2, ppower3 = cursor.execute(
        'SELECT id, unspent, heroes, power1, power2, power3 FROM users WHERE id=?',
        (steamid, )).fetchone()
    heroes = pheroes
    heroes = heroes.split(',')
    counter = 0
    for hero in heroes:
        if hero != '0':
            cursor.execute('UPDATE users SET unspent=(unspent + 1) WHERE id=?',
                           (steamid, ))
            if ppower1 == hero:
                cursor.execute('UPDATE users SET power1=\'0\' WHERE id=?',
                               (steamid, ))
            if ppower2 == hero:
                cursor.execute('UPDATE users SET power2=\'0\' WHERE id=?',
                               (steamid, ))
            if ppower3 == hero:
                cursor.execute('UPDATE users SET power3=\'0\' WHERE id=?',
                               (steamid, ))
            counter += 1
    cursor.execute('UPDATE users SET heroes=\'0\', powerx=\'0\' WHERE id=?',
                   (steamid, ))
    connection.commit()
    other_msg = langlib.Strings(
        es.getAddonPath("superhero") + "/languages/other_msg.ini")
    tokens = {}
    tokens['counter'] = counter
    es.tell(userid, '#multi',
            other_msg('other_cleared', tokens, lang=str(popup_language)))
Beispiel #6
0
def getLanguage(module, file = None):
    if file:
        filename = "%s/modules/%s/%s.ini" % (xa.coredir(), module, file)
    else:
        filename = "%s/modules/%s/strings.ini" % (xa.coredir(), module)
    if os.path.exists(filename.replace('.ini', '.custom.ini')):
        customlangobj = langlib.Strings(filename.replace('.ini', '.custom.ini'))
    else:
        customlangobj = None
    if os.path.exists(filename):
        langobj = langlib.Strings(filename)
    else:
        raise IOError, "Could not find %s!" % filename
    if langobj and customlangobj:
        for key in customlangobj:
            if key in langobj:
                langobj[key].update(customlangobj[key])
            else:
                langobj[key] = customlangobj[key]
    if langobj:
        for key in langobj:
            langobj[key] = LanguageDict(key, langobj[key])
    return langobj
Beispiel #7
0
def sh_levelup(userid, amount):
    steamid = es.getplayersteamid(userid)
    if steamid == 'BOT':
        return
    amount = int(amount)
    cursor.execute(
        'UPDATE users SET level=(level + ?), unspent=(unspent + ?) WHERE id=?',
        (amount, amount, getID(userid)))
    es.playsound(userid, 'ambient/tones/elev1.wav', 1.0)
    #es.playsound(userid, 'plats/elevbell1.wav', 1.0)
    xp_msg = langlib.Strings(
        es.getAddonPath('superhero') + '/languages/xp_msg.ini')
    global popup_language
    es.tell(userid, '#multi', xp_msg('xp_levelup', lang=str(popup_language)))
    es.server.cmd('es_xsexec %s say /showxp' % userid)
    connection.commit()
Beispiel #8
0
def commandlist_selection(userid, choice, name):
    userid = str(userid)
    cmdlist_msg = langlib.Strings(
        es.getAddonPath('superhero') + '/languages/cmdlist_msg.ini')
    global popup_language
    if choice != None:
        if str(choice) == 'disable':
            Users[userid]['cmdlist'] = 0
            es.tell(userid, '#multi',
                    cmdlist_msg('cmdlist_disable', lang=str(popup_language)))
        elif str(choice) == 'enable':
            Users[userid]['cmdlist'] = 1
            es.tell(userid, '#multi',
                    cmdlist_msg('cmdlist_enable', lang=str(popup_language)))
        else:
            popupname = '/' + str(choice)
            es.sexec(userid, 'say', popupname)
Beispiel #9
0
def player_death(ev):
    userid = ev['userid']
    steamid = es.getplayersteamid(userid)
    if steamid == 'BOT': steamid = es.getplayername(userid)
    attacker = ev['attacker']
    weapon = ev['weapon']
    if weapon != 'world':
        if weapon != 'worldspawn':
            if userid != attacker:
                if ev['es_userteam'] != ev['es_attackerteam']:
                    # Normal Player kill
                    xp_kill_min = es.ServerVar('xp_kill_min')
                    xp_kill_max = es.ServerVar('xp_kill_max')
                    xp = random.randint(xp_kill_min, xp_kill_max)
                    if attacker != '0':
                        if userid != '0':
                            pid, plevel = cursor.execute(
                                'SELECT id, level FROM users WHERE id=?',
                                (steamid, )).fetchone()
                            if es.getplayersteamid(attacker) == 'BOT':
                                aid = getID(attacker)
                                alevel = '1'
                            else:
                                aid, alevel = cursor.execute(
                                    'SELECT id, level FROM users WHERE id=?',
                                    (getID(attacker), )).fetchone()
                            level_dif = int(plevel) - int(alevel)
                            if alevel < 1:
                                xp = xp * float(es.ServerVar('xp_multi'))
                            if level_dif > 1:
                                xp = xp * level_dif * level_dif
                            elif level_dif == 1:
                                xp = xp * 2
                            if steamid == 'BOT':
                                return
                            xp_msg = langlib.Strings(
                                es.getAddonPath('superhero') +
                                '/languages/xp_msg.ini')
                            global popup_language
                            sh_givexp(
                                attacker, xp,
                                xp_msg('xp_kill', lang=str(popup_language)))
Beispiel #10
0
def player_spawn(ev):
    userid = ev['userid']
    steamid = ev['es_steamid']
    if steamid == 'BOT':
        return
    player = playerlib.getPlayer(userid)
    if int(player.isdead) != 1:
        spawn_msg = langlib.Strings(
            es.getAddonPath('superhero') + '/languages/spawn_msg.ini')
        global popup_language
        pid, plevel = cursor.execute('SELECT id, level FROM users WHERE id=?',
                                     (steamid, )).fetchone()
        es.tell(userid, '#multi',
                spawn_msg('spawn_cmdlist', lang=str(popup_language)))
        es.server.cmd('es_xsexec %s say /showxp' % userid)
        if int(es.ServerVar('start_level')) > 0:
            if int(plevel) == 0:
                es.tell(
                    userid, '#multi',
                    spawn_msg('spawn_startlevel', lang=str(popup_language)))
                sh_levelup(userid, int(es.ServerVar('start_level')))
Beispiel #11
0
def playerinfo_list_build():
    # Create and update player info
    playerinfo_list = popuplib.easymenu('playerinfo_list', None,
                                        playerinfo_list_selection)
    playerinfo_popup = langlib.Strings(
        es.getAddonPath("superhero") + "/languages/playerinfo_popup.ini")
    global popup_language
    playerinfo_list.settitle(
        playerinfo_popup('playerinfo_title', lang=str(popup_language)))
    PlayerList = playerlib.getPlayerList('#all,#all')
    counter = 0
    for player in PlayerList:
        steamid = getID(player.userid)
        plevel = cursor.execute('SELECT level FROM users WHERE id=?',
                                (steamid, )).fetchone()
        if plevel:
            playerinfo_list.addoption(
                player, (str(player.name) + ' [Lvl ' + str(plevel[0]) + ']'))
            counter += 1
    if counter == 0:
        playerinfo_list.addoption(
            None,
            playerinfo_popup('playerinfo_update', lang=str(popup_language)))
Beispiel #12
0
import psyco

psyco.full()

# Set the addon info data
info = es.AddonInfo()
info.name = 'SourceRPG Admin'
info.basename = sourcerpg.info.basename + "/addons/sourcerpg_admin"
info.author = sourcerpg.info.author

# Create the langlib function
text = lambda userid, textIdent, tokens={
}: "No strings.ini found in ./sourcerpg/addons/sourcerpg_admin/"
textPath = os.path.join(es.getAddonPath(info.basename), "strings.ini")
if os.path.isfile(textPath):
    text = langlib.Strings(textPath)


class AdminManager(object):
    """
    This class manages the admin menu so that we can easilly add options and
    callbacks to this main popup. It allows us to keep a reference of the main
    popup so we don't have to find it at a later stage.
    """
    def __init__(self):
        """ Default constructor. Initialize variables. """
        self.popup = popuplib.easymenu("sourcerpg_admin", "_popup_userid",
                                       popup.mainCallback)
        self.popup.settitle("=== %s Admin ===" % sourcerpg.prefix)

    def __del__(self):
Beispiel #13
0
def load():
    global text
    mattie_mugmod.makepublic()
    # load our strings
    text = langlib.Strings(es.getAddonPath("mugmod") + "/strings.ini")
Beispiel #14
0
info.description = 'Provides user based setting handling for Source games'

#global variables:
## gSettings holds all the settings by their names for backwards compatibility
gSettings = {}

# Get this library handle for registering events dynamically:
selfmodule = __import__('settinglib')
# Get the data path for reading/writing KeyValues
selfdatapath = '%s/%s' % (es.server_var['eventscripts_addondir'],
                          'setting/data')
selfdatatest = '%s/__init__.pkl' % selfdatapath
# Get the language strings
selflangpath = '%s/%s' % (es.server_var['eventscripts_addondir'],
                          '_libs/python/settinglib')
selflangtext = langlib.Strings(selflangpath + '/strings.ini')
# Create default data folder
if not os.path.isdir(selfdatapath):
    os.mkdir(selfdatapath)


## Setting_setting class is the setting base class
class Setting_base(object):
    def __init__(self, pType):
        self.popup = {}  #contains the popup object's per userid
        self.backmenuvar = 0  #backmenu that displays on 0. Cancel
        self.languages = selflangtext  #langlib object
        self.keyvalues = self.createKey(self.name)
        self.init(str(pType))

    def delete(self):
Beispiel #15
0
                                   '#green%d seconds to explosion.' % x)
    bomb_timer_ini.addValueToGroup('text_%d' % x, 'de',
                                   '#green%d Sekunden bis zur Explosion.' % x)
for x in [30, 20, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1]:
    bomb_timer_ini.addGroup('sound_%d' % x)
    bomb_timer_ini.addValueToGroup('sound_%d' % x, 'spec',
                                   'bombtimer/%dsec.mp3' % x)
    bomb_timer_ini.addValueToGroup('sound_%d' % x, 't',
                                   'bombtimer/%dsec.mp3' % x)
    bomb_timer_ini.addValueToGroup('sound_%d' % x, 'ct',
                                   'bombtimer/%dsec.mp3' % x)
bomb_timer_ini.write()

# Global Variables
bomb_timer_mp_c4timer = es.ServerVar('mp_c4timer')
bomb_timer_language = langlib.Strings('%s/bomb_timer.ini' %
                                      es.getAddonPath('bomb_timer'))

# Settinglib Object
bomb_timer_setting = settinglib.create('bombtimer', 'Bomb Timer', 'toggle')


def load():
    public = es.ServerVar('hu_bt', info.version, info.name)
    public.makepublic()

    cmdlib.registerSayCommand('!bombtimer', _say_cmd, 'Bomb Timer')

    bomb_timer_config.execute()
    bomb_timer_setting.addoption('display', 'Display')
    bomb_timer_setting.addoption('text', 'Text')
    bomb_timer_setting.addoption('sound', 'Sound')
    '#lightgreen$name#default se ha conectado desde #lightgreen$location#default.'
)
ini.addValueToGroup(
    'connect', 'nl',
    '#lightgreen$name#default komt uit #lightgreen$location#default.')
ini.addValueToGroup(
    'connect', 'fi',
    '#lightgreen$name#default on liittynyt peliin maasta #lightgreen$location#default.'
)
ini.addValueToGroup(
    'connect', 'ru',
    '#lightgreen$name#default подключился из #lightgreen$location#default.')

ini.write()

lang_text = langlib.Strings(ini)


def remove_tags(text):
    """ Removes #lightgreen, #darkgreen, #green and #default tags from the supplied string """
    return reduce(lambda t, r: t.replace(r, ''),
                  ('#lightgreen', '#darkgreen', '#green', '#default'), text)


###


def load():
    """
   Ensures critical server variables are created by the config
   Updates the database if necessary
             info.description + " made by " + info.author).makepublic()

text = lambda identifier, options={
}, lang="en": "No strings.ini found in ../addons/eventscripts/%(basename)s/%(basename)s.py" % {
    "basename": info.basename
}
""" Load the dictionary """
dictPath = os.path.join(es.getAddonPath(info.basename), "data.db")
if os.path.isfile(dictPath):
    fileStream = open(dictPath, 'r')
    mapDicts = cPickle.load(fileStream)
    fileStream.close()
""" Load the languages """
langPath = os.path.join(es.getAddonPath(info.basename), "strings.ini")
if os.path.isfile(langPath):
    text = langlib.Strings(langPath)
""" Set up an auth check service, to return whether or not the user is authed. """
if services.isRegistered('auth'):
    auth_service = services.use('auth')
    auth_service.registerCapability('surftimer', auth_service.ADMIN)
    isAuthed = lambda x: auth_service.isUseridAuthorized(x, 'surftimer')
else:
    isAuthed = lambda x: False


def load():
    """ If the script is loaded halfway through a load, ensure the delays start """
    if str(currentMap):
        es_map_start({'mapname': str(currentMap)})
    es.regsaycmd('!restart', 'surftimer/restart', 'Teleport back to start')
Beispiel #18
0
from es import exists, centertell
import es
from cmdlib import registerServerCommand, unregisterServerCommand
from playerlib import getUseridList, getPlayer
import langlib
from paths import PLUGIN_PATH
import os
import sys
from players.entity import Player

if os.path.isfile(os.path.join(PLUGIN_PATH, 'wcs/strings', 'strings.ini')):
    strings = langlib.Strings(
        os.path.join(PLUGIN_PATH, 'wcs/strings', 'strings.ini'))


def reg():
    unregisterServerCommand('wcs_xtell')
    unregisterServerCommand('wcs_xcentertell')
    registerServerCommand(
        'wcs_xtell', register,
        'Syntax: wcs_xtell <userid> <text> <[arg]> <[value]>...')
    registerServerCommand(
        'wcs_xcentertell', register_center,
        'Syntax: wcs_xcentertell <userid> <text> <[arg]> <[value]>...')


def register(args):
    if len(args) >= 2:
        userid = str(args[0])
        text = str(args[1])
Beispiel #19
0
import playerlib
import cfglib
import langlib
import random
import usermsg
import es, sys, os.path, time
import traceback as tb_module
import popuplib
from sqlite3 import connect
from path import path
from array import array
addonpath = path(__file__).dirname()
connection = connect(
    addonpath.joinpath('Userdata/xp.db'))  # Connect to database
cursor = connection.cursor()  # Cursor to execute commands
other_msg = langlib.Strings(addonpath.joinpath('languages', 'other_msg.ini'))
Users = {}
info = es.AddonInfo()
info['name'] = "Superhero"
info['version'] = "0.3.5.5"
info['author'] = "NeoSan, Hashed"
info['url'] = "http://forums.eventscripts.com"
info['basename'] = "superhero"
info['description'] = "Superhero Source Mod"
es.set('sh_version', info['version'])
config = cfglib.AddonCFG(es.getAddonPath("superhero") + "/superhero.cfg")
config.text("******************************")
config.text("       Superhero Config")
config.text("******************************")
herolist = config.cvar(
    "herolist",
Beispiel #20
0
def load():
    es.dbgmsg(0, "[SH] Loading.....")
    es.doblock('corelib/noisy_on')
    config.execute()  # Executes the .cfg to register changes
    global popup_language
    popup_language = es.ServerVar('popup_language')
    global rounds_played
    rounds_played = 0
    es.server.queuecmd('es_xload superhero/heroes')
    es.server.queuecmd('es_xload superhero/admins')
    # Create a group
    global heroes
    heroes = []
    ### Get the Strings the popup
    cmdlist_popup = langlib.Strings(
        es.getAddonPath("superhero") + "/languages/cmdlist_popup.ini")
    # Create popups
    global commandlist
    commandlist = popuplib.easymenu('commandlist', 'choice',
                                    commandlist_selection)
    commandlist.settitle('All Commands')
    commandlist.addoption('help',
                          cmdlist_popup('cmd_help',
                                        lang=str(popup_language)))  # Done
    commandlist.addoption('herolist',
                          cmdlist_popup('cmd_herolist',
                                        lang=str(popup_language)))  # Done
    commandlist.addoption(
        'playerinfo', cmdlist_popup('cmd_playerinfo',
                                    lang=str(popup_language)))
    commandlist.addoption('myheroes',
                          cmdlist_popup('cmd_myheroes',
                                        lang=str(popup_language)))  # Done
    commandlist.addoption('clearpowers',
                          cmdlist_popup('cmd_clearpowers',
                                        lang=str(popup_language)))  # Done
    commandlist.addoption('showmenu',
                          cmdlist_popup('cmd_showmenu',
                                        lang=str(popup_language)))  # Done
    commandlist.addoption('showxp',
                          cmdlist_popup('cmd_showxp',
                                        lang=str(popup_language)))  # Done
    commandlist.addoption(None,
                          cmdlist_popup('cmd_drop',
                                        lang=str(popup_language)))  # Done
    commandlist.addoption(None,
                          cmdlist_popup('cmd_buyxp', lang=str(popup_language)))
    commandlist.addoption(
        None, cmdlist_popup('cmd_binding', lang=str(popup_language)))
    helpbox_popup = langlib.Strings(
        es.getAddonPath("superhero") + "/languages/helpbox_popup.ini")
    global helpbox
    helpbox = popuplib.create('helpbox')
    helpbox.addline(helpbox_popup('helpbox_1', lang=str(popup_language)))
    helpbox.addline(helpbox_popup('helpbox_2', lang=str(popup_language)))
    helpbox.addline('\n\n')
    helpbox.addline(helpbox_popup('helpbox_3', lang=str(popup_language)))
    helpbox.addline(helpbox_popup('helpbox_4', lang=str(popup_language)))
    helpbox.addline(helpbox_popup('helpbox_5', lang=str(popup_language)))
    helpbox.addline(helpbox_popup('helpbox_6', lang=str(popup_language)))
    # Saycommands register etc.
    cmdlib.registerSayCommand('/commandlist', 'superhero/commandlist',
                              'COMMANDLIST')
    cmdlib.registerSayCommand('/shmenu', 'superhero/commandlist', 'SHMENU')
    cmdlib.registerSayCommand('/sh', 'superhero/commandlist', 'SH')
    cmdlib.registerSayCommand('/help', superherohelp, 'HELP')
    cmdlib.registerSayCommand('/showmenu', showmenu, 'SHOWMENU')
    cmdlib.registerSayCommand('/drop', drop, 'DROP')
    cmdlib.registerSayCommand('/showxp', showxp, 'SHOWXP')
    cmdlib.registerSayCommand('/myheroes', myheroes, 'MYHEROES')
    cmdlib.registerSayCommand('hashero', 'superhero/hashero', 'HASHERO')
    cmdlib.registerSayCommand('/buyxp', buyxp, 'BUYXP')
    cmdlib.registerSayCommand('/herolist', herolist, 'HEROLIST')
    cmdlib.registerSayCommand('/clearpowers', clearpowers, 'CLEARPOWERS')
    cmdlib.registerSayCommand('/playerinfo', playerinfo, 'PLAYERINFO')
    cmdlib.registerClientCommand('+power1', power, "+power1")
    cmdlib.registerClientCommand('-power1', poweroff, "-power1")
    cmdlib.registerClientCommand('+power2', power, "+power2")
    cmdlib.registerClientCommand('-power2', poweroff, "-power2")
    cmdlib.registerClientCommand('+power3', power, "+power3")
    cmdlib.registerClientCommand('-power3', poweroff, "-power3")
    es.dbgmsg(0, "[SH] Loading Done.")
Beispiel #21
0
def load_language_data(module):
    global lang_data
    mypath = os.path.split(module.__file__)[0]
    filename = os.path.join(mypath, 'language_data.ini')
    lang_data = langlib.Strings(filename)
    return lang_data
Beispiel #22
0
quake_sounds_round_reset = es.ServerVar(
    'quake_sounds_round_reset', '0',
    'Should the player kills be resetted after every round? ( 1=yes 0=no )')
quake_sounds_round_announce = es.ServerVar(
    'quake_sounds_round_announce', '1',
    'Should the quake menu command be announced every round_start? ( 1=yes 0=no )'
)
quake_sounds_soundload = es.ServerVar(
    'quake_sounds_soundload', '1',
    'Should the sounds be downloaded with EventScripts?')
quake_sounds_multikill_time = es.ServerVar(
    'quake_sounds_multikill_time', '1.5',
    'The time between kills that counts up the multikill count? ( >0 )')

# Global Variables
quake_sounds_language = langlib.Strings(
    es.getAddonPath('quake_sounds') + '/language.ini')
quake_sounds_kills = 0
quake_sounds_players = {}

# KeyValues Object
quake_sounds_kv = keyvalues.KeyValues(name='quake_sounds')

# Settinglib Object
quake_sounds_setting = settinglib.create('quakesounds', 'Quake Sounds Style',
                                         'list')

# Module Object
quake_sounds_module = __import__('quake_sounds.quake_sounds')


def load():
Beispiel #23
0
def showmenu_selection(userid, choice, popupname):
    userid = str(userid)
    steamid = es.getplayersteamid(userid)
    showmenu_msg = langlib.Strings(
        es.getAddonPath("superhero/languages/showmenu_msg.ini"))
    global popup_language
    pid, plevel, punspent, pheroes, ppower1, ppower2, ppower3 = cursor.execute(
        'SELECT id, level, unspent, heroes, power1, power2, power3 FROM users WHERE id=?',
        (steamid, )).fetchone()
    if int(punspent) != 0:
        text = langlib.Strings(
            es.getAddonPath("superhero/heroes/" + choice + "/strings.ini"))
        req_level = int(text('req_level'))
        level = int(plevel)
        powerx = '0'
        powers = 0
        heroes = pheroes
        heroes = heroes.split(',')
        heroes.append(choice)
        string = heroes[0]
        for hero in heroes:
            if not hero in string:
                string = string + ',' + str(hero)
        if int(text('power')) == 1:
            for i in range(1, 4):
                if i == 1:
                    if ppower1 == '0':
                        cursor.execute(
                            'UPDATE users SET power1=?, powerx=\'power1\' WHERE id=?',
                            (choice, getID(userid)))
                        break
                elif i == 2:
                    if ppower2 == '0':
                        cursor.execute(
                            'UPDATE users SET power2=?, powerx=\'power2\' WHERE id=?',
                            (choice, getID(userid)))
                        break
                elif i == 3:
                    if ppower3 == '0':
                        cursor.execute(
                            'UPDATE users SET power3=?, powerx=\'power3\' WHERE id=?',
                            (choice, getID(userid)))
                        break
                    else:
                        es.tell(
                            userid, '#multi',
                            showmenu_msg('showmenu_allpowers',
                                         lang=str(popup_language)))
                        return
        else:
            cursor.execute(
                'UPDATE users SET heroes=?, unspent=(unspent - 1) WHERE id=?',
                (string, getID(userid)))
            pid, punspent, pheroes, ppowerx = cursor.execute(
                'SELECT id, unspent, heroes, powerx FROM users WHERE id=?',
                (steamid, )).fetchone()
            tokens = {}
            tokens['choice'] = choice
            es.tell(
                userid, '#multi',
                showmenu_msg('showmenu_picked',
                             tokens,
                             lang=str(popup_language)))
            if int(punspent) > 0:
                showmenu()
            es.server.queuecmd('es_xdoblock superhero/heroes/' + str(choice) +
                               '/selected')
            connection.commit()
            return
        if req_level <= level:
            cursor.execute(
                'UPDATE users SET heroes=?, unspent=(unspent - 1) WHERE id=?',
                (string, getID(userid)))
            pid, punspent, pheroes, ppowerx = cursor.execute(
                'SELECT id, unspent, heroes, powerx FROM users WHERE id=?',
                (steamid, )).fetchone()
            tokens = {}
            tokens['choice'] = choice
            es.tell(
                userid, '#multi',
                showmenu_msg('showmenu_picked',
                             tokens,
                             lang=str(popup_language)))
            es.server.queuecmd('es_xdoblock superhero/heroes/' + str(choice) +
                               '/selected')
            if ppowerx != '0':
                tokens = {}
                tokens['powerx'] = '+' + ppowerx
                es.tell(
                    userid,
                    showmenu_msg('showmenu_bind',
                                 tokens,
                                 lang=str(popup_language)))
            if int(punspent) > 0:
                showmenu()
            connection.commit()  # Commit changes to table
    else:
        es.tell(userid, '#multi',
                showmenu_msg('showmenu_nopoints', lang=str(popup_language)))
Beispiel #24
0
action_on_cheatR = es.ServerVar("action_on_cheat")
ban_durationR = es.ServerVar("ban_duration")
ban_typeR = es.ServerVar("ban_type")
advert_on_cheatR = es.ServerVar("advert_on_cheat")
advert_on_nocheatR = es.ServerVar("advert_on_nocheat")
check_on_fragR = es.ServerVar("check_on_frag")
check_repeatR = es.ServerVar("check_repeat")
check_secondsR = es.ServerVar("check_seconds")
detocs_langR = es.ServerVar("detocs_lang")
ban_with_gbR = es.ServerVar("ban_with_gb")
idreason_gbR = es.ServerVar("idreason_gb")
steamid_gbR = es.ServerVar("steamid_gb")
detect = False
on_connect = False
messages = langlib.Strings(es.getAddonPath("detocs") + "/language.ini")


def load():
    es.log("[DeToCs] Load")
    es.server.cmd(
        "es_xmexec ../addons/source-python/plugins/es_emulator/eventscripts/detocs/detocs.cfg"
    )
    if int(check_repeatR) == 1:
        repeat.create("CheckCheat", check_variable_seconds)
        repeat.start("CheckCheat", int(check_secondsR), 0)


def unload():
    es.log("[DeToCs] Unload")
    if int(check_repeatR) == 1:
import popuplib
import cmdlib
import psyco
import langlib
import random
psyco.full()
from collections import defaultdict
from sqlite3 import connect
from path import path
addonpath = path(__file__).dirname()
connection = connect(addonpath.joinpath('../Userdata/xp.db')) # Connect to database
cursor = connection.cursor() # Cursor to execute commands
superhero = es.import_addon('superhero')
sh_admins = []
popup_language = str(es.ServerVar('popup_language'))
admin_msg = langlib.Strings(es.getAddonPath("superhero") + "/languages/admin_msg.ini")
admin_popup = langlib.Strings(es.getAddonPath("superhero") + "/languages/admin_popup.ini")
tokens = {}
manage_user = defaultdict(int)

def load():
    print "[SH] Admins loading..."
    path = es.getAddonPath("superhero/admins/adminlist.txt")
    for line in open(path):
        line = str(line).rstrip()
        if line != '0':
            if line != "":
                if not '//' in line:
                    sh_admins.append(line)
                    print "[SH] %s is now a Superhero Admin" % line 
    es.dbgmsg(0, "[SH] Admins Loaded")