예제 #1
0
def indexRegister(args):
    if len(args) == 2:
        var, userid = map(str, args)

        if exists('userid', userid):
            ServerVar(var).set(gP(userid).index)
        else:
            ServerVar(var).set(0)
예제 #2
0
def numericRegister(args):
    if len(args) == 2:
        var = str(args[0])
        value = str(args[1])
        if value.startswith("-"):
            value = value[1:]
    value = value.replace(".", "")
    if value.isdigit():
        ServerVar(var).set("1")
    else:
        ServerVar(var).set("0")
예제 #3
0
    def __delitem__(self, variable):
        '''Removes the variable from the dictionary,
            and sets it back to the default value'''

        # Is the variable in the dictionary?
        if not variable in self:

            # If the variable is not in the dictionary, simply return
            return

        # Set the variable to its default value
        ServerVar(variable).set(self[variable].default)

        # Delete the variable from the dictionary
        super(_VariableBackups, self).__delitem__(variable)
예제 #4
0
    def __init__(self, variable):
        '''Stores the variable, its default value,
            and addons that register for the variable'''

        # Store the variable
        self.variable = variable

        # Get the default value
        value = str(ServerVar(variable))

        # Try to typecast the value to float
        try:
            value = float(value)
        except:
            pass

        # Store the default value
        self.default = value
예제 #5
0
def bullet_impact(ev):
    x, y, z = getplayerlocation(ev['userid'])
    x1, y1, z1 = float(ev['x']), float(ev['y']), float(ev['z'])
    r, g, b = randint(0, 255), randint(0, 255), randint(0, 255)
    msg('%s (number %s/%s)' % (_effects[_users[ev['userid']]], _users[ev['userid']], len(_effects) - 1))
    ServerVar('est_userid').set(ev['userid'])
    ServerVar('wcs_x1').set(x)
    ServerVar('wcs_y1').set(y)
    ServerVar('wcs_z1').set(z)
    ServerVar('wcs_x2').set(x1)
    ServerVar('wcs_y2').set(y1)
    ServerVar('wcs_z2').set(z1)
    if int(_users[ev['userid']]) < 234:
        server.queuecmd('es_doblock effects/%s' % _effects[_users[ev['userid']]])
    else:
        exec("ice_test.ice_test.%s(%s)" % (_effects[_users[ev['userid']]], [(x, y, z), (x1, y1, z1)]))
    weapon = getWeapon(getPlayer(ev['userid']).weapon)
    if weapon.slot == 1:
        getPlayer(ev['userid']).clip.primary += 1
    elif weapon.slot==2:
        getPlayer(ev['userid']).clip.secondary += 1
예제 #6
0
def decimalRegister(args):
    if len(args) == 2:
        var = str(args[0])
        amount = str(args[1])
        ServerVar(var).set(round(float(amount)))
예제 #7
0
def register(args):
    if len(args) >= 2:
        todo = str(args[0]).lower()
        userid = str(args[1])

        if exists('userid', userid):
            if todo == 'damage':
                if len(args) >= 4:
                    v, q, w = int(args[2]) if int(args[2]) else None, int(
                        args[4]) if len(args) >= 5 else False, str(
                            args[5]) if len(args) == 6 else None
                    tools.expand.expand.damage(userid, str(args[3]), v, q, w)
                    #server.insertcmd('damage %s %s 32 %s'%(userid, int(float(args[3])), str(args[2])))

            elif todo == 'explode':
                if len(args) == 5:
                    magnitude = round(float(args[3]) * float(args[4]) / 150)
                    #server.damage(args[2], magnitude, 32, userid)
                    tools.expand.expand.damage(args[2], magnitude, userid)
                    #player.damage(magnitude, 32, args[2])
                    #server.insertcmd('damage %s %s 32 %s'%(args[2], magnitude, userid))

            elif todo == 'spawn':
                if len(args) in (2, 3):
                    tools.expand.expand.spawn(
                        userid,
                        int(args[2]) if len(args) == 3 else False)

            elif todo == 'strip':
                if len(args) == 2:
                    tools.expand.expand.strip(userid)

            elif todo == 'drop':
                if len(args) == 3:
                    tools.expand.expand.drop(userid, args[2])

            elif todo == 'push':
                if len(args) >= 3:
                    tools.expand.expand.push(userid, args[2],
                                             args[3] if len(args) >= 4 else 0,
                                             args[4] if len(args) == 5 else 0)

            elif todo == 'pushto':
                if len(args) == 4:
                    tools.expand.expand.pushto(userid, args[2], args[3])

            elif todo == 'gravity':
                if len(args) == 3:
                    tools.expand.expand.gravity(userid, args[2])

            elif todo == 'removeweapon':
                if len(args) == 3:
                    tools.expand.expand.removeWeapon(userid, args[2])

            elif todo == 'getviewplayer':
                if len(args) == 3:
                    v = tools.expand.expand.getViewPlayer(userid)
                    ServerVar(args[2]).set(v if v is not None else 0)

            elif todo == 'getviewentity':
                if len(args) == 3:
                    v = tools.expand.expand.getViewEntity(userid)
                    ServerVar(args[2]).set(v if v is not None else 0)

            elif todo == 'keyhint':
                if len(args) >= 3:
                    tools.expand.expand.keyHint(userid,
                                                ' '.join(map(str, args[3:])))

            elif todo == 'give':
                if len(args) == 3:
                    tools.expand.expand.give(userid, args[2])

            elif todo == 'fire':
                if len(args) >= 2:
                    tools.expand.expand.fire(userid,
                                             args[2] if len(args) == 3 else 0)

            elif todo == 'extinguish':
                if len(args) == 2:
                    tools.expand.expand.extinguish(userid)

            elif todo == 'drug':
                if len(args) >= 2:
                    tools.expand.expand.drug(
                        userid,
                        float(args[2]) if len(args) >= 3 else 0)

            elif todo == 'drunk':
                if len(args) >= 2:
                    tools.expand.expand.drunk(
                        userid,
                        float(args[2]) if len(args) >= 3 else 0,
                        int(args[3]) if len(args) == 4 else 155)

            elif todo == 'poison':
                if len(args) == 5:
                    tools.expand.expand.dealPoison(userid, int(float(args[3])),
                                                   str(args[2]), int(args[4]))

            elif todo == 'changeteam':
                if len(args) == 3:
                    tools.expand.expand.changeTeam(userid, str(args[2]))
예제 #8
0
def register_uptime(args):
    if len(args) == 1:
        var = str(args[0])
        global starttime
        ServerVar(var).set(time.time() - starttime)
예제 #9
0
def register(args):
    if len(args) >= 1:
        todo = str(args[0]).lower()

        if todo == 'get':
            if len(args) == 4:
                key = str(args[1])
                var = str(args[2])
                userid = str(args[3])

                if exists('userid', userid):
                    player = getPlayer(userid)
                    if hasattr(player, key):
                        attr = getattr(player, key)

                        if callable(attr):
                            attr = attr()

                        attr = _func(attr)

                        ServerVar(var).set(attr)
        elif todo == 'set':
            if len(args) >= 4:
                key = str(args[1])
                userid = str(args[2])

                if exists('userid', userid):
                    player = getPlayer(userid)
                    if hasattr(player, key):
                        val = _func(args[3:])

                        uhm = getattr(player, key)
                        if hasattr(val,
                                   '__iter__') and not key in ('location'):
                            val = val[0]

                        if key in ('location') and not hasattr(
                                val, '__iter__'):
                            val = val.split(',')

                        if callable(uhm):
                            uhm(val)
                        else:
                            setattr(player, key, val)

        elif todo == 'math':
            if len(args) == 5:
                key = str(args[1])
                userid = str(args[2])
                operator = str(args[3])
                amount = _convert(args[4])

                if exists('userid', userid):
                    player = getPlayer(userid)
                    if hasattr(player, key):
                        keyv = getattr(player, key)
                        if operator == '+':
                            keyv += amount
                        elif operator == '-':
                            keyv -= amount
                        elif operator == '=':
                            keyv = amount
                        else:
                            return

                        setattr(player, key, keyv)

        elif todo == 'call':
            if len(args) == 3:
                key = str(args[1])
                userid = str(args[2])

                if exists('userid', userid):
                    player = getPlayer(userid)
                    if hasattr(player, key):
                        attr = getattr(player, key)
                        if callable(attr):
                            attr()

        elif todo == 'create':
            if len(args) >= 2:
                var = str(args[1])

                ServerVar(var).set(','.join(map(str, args[2:])))

        elif todo == 'split':
            if len(args) >= 3:
                value = str(args[1]).split(',')

                vars = args[2:]

                for x in xrange(0, len(vars)):
                    ServerVar(vars[x]).set(value[x])
예제 #10
0
$LastChangedDate: 2011-10-24 01:05:16 -0400 (Mon, 24 Oct 2011) $
'''

# =============================================================================
# >> IMPORTS
# =============================================================================
# Eventscripts Imports
from es import ServerVar

# GunGame Imports
from gungame51.core.sql import Database

# =============================================================================
# >> GLOBALS
# =============================================================================
gg_prune_database = ServerVar('gg_prune_database')


# =============================================================================
# >> CUSTOM/HELPER FUNCTIONS
# =============================================================================
def insert_winner(name, uniqueid, wins, timestamp='strftime("%s","now")'):
    '''
    Inserts a new entry into the database.
    '''
    # Send to be queried
    ggDB = Database()
    ggDB._query("INSERT INTO gg_wins (name, uniqueid, wins, timestamp) " +
                "VALUES(?, ?, ?, ?)",
                values=(name, uniqueid, wins, timestamp))
    ggDB.commit()
예제 #11
0
#imports
from random import randint

from es import getplayerlocation
from es import ServerVar
from es import server
from es import msg
from playerlib import getPlayer
from weaponlib import getWeapon
from effectlib2 import *
from collections import defaultdict

import spe_effects
import ice_test

ServerVar('eventscripts_noisy').set(1)


_effects = ['oran9e', 'SPECTATE', 'Snake', 'SnakePoison', 'IceWdamage', 'IceWfroste', 'SHADEBOLT',
'bullet', 'deadbeam', 'ultcircle', 'toxic', 'fade', 'flashfreeze', 'vortattack', 'electrikwarrior', 
'eclipse', 'darkstrike', 'rage', 'darkmurk', 'darkpandor', 'Hoore2', 'bloody', 'Hoore', 'pyramid', 
'darkbubbles', 'just132541', 'fastdead', 'tornado', 'spider1', 'spider2', 'spider3', 'electrostrike',
'fire', 'flameattack', 'bloodyblades', 'bloodsuck', 'red', 'burningstrike', 'pinch', 'hydra',
'hydra2', 'purpleup', 'explodebomb', 'spider', 'kanibal', 'blackwidow1', 'blackwidow3', 'blackwidow4',
'spirit_of_raven', 'akayatsuku', 'woe', 'eli', 'toxins', 'spruce', 'spectron1', 'spectron2', 'spectron3',
'nortrom1', 'nortrom2', 'nortrom3', 'friz', 'frezult', 'oran9e2', 'fireplay', 'testfire', 'playdog1',
'playdog2', 'playdog3', 'poseidon1', 'poseidon2', 'poseidon3', 'ammobaron1', 'ammobaron2', 'ammobaron3',
'posya', 'posedon', 'assasinspider', 'assasinspider2', 'wafsehg', 'wfagagrhhrt', 'windrunner', 'kori',
'koral1', 'koral2', 'koral3', 'bofdar1', 'bofdar2', 'bofdar3', 'paladinaura', 'purplesmoke', 'purpleup2', 
'triple', 'soldier1', 'soldier2', 'hoore1', 'hoore2', 'jockomonkey1', 'jockomonkey2', 'jockomonkey3', 
'jockomonkey4', 'knife', 'lunabeam', 'iceice', 'vampire', 'scorpion', 'donator', 'deagleranger', 'vagabond2', 
예제 #12
0
def Register(args):
    if len(args) == 2:
        try:
            ServerVar(args[0]).set(choice(getPlayerList(args[1])))
        except IndexError:
            ServerVar(args[0]).set(0)
예제 #13
0
def register(args):
    if len(args) >= 1:
        todo = str(args[0]).lower()
        if todo == 'get':
            if len(args) >= 4:
                key = str(args[1])
                var = str(args[2])
                userid = str(args[3])

                team = None
                if len(args) == 5:
                    userid = team = {2: 'T', 3: 'CT'}[int(args[4])]

                if exists('userid', userid) or team is not None:
                    if not tools.wcsgroup.wcsgroup.existsUser(userid):
                        tools.wcsgroup.wcsgroup.addUser(userid)

                    value = tools.wcsgroup.wcsgroup.getUser(userid, key)
                    if value is None:
                        ServerVar(var).set(0)
                    else:
                        ServerVar(var).set(value)
                else:
                    logging.log('wcsgroup: Information: Unknown userid: ' +
                                userid)
                    logging.log(
                        'wcsgroup: Information: Args: tools.wcsgroup.wcsgroup '
                        + ' '.join(map(str, args)))

            else:
                logging.log(
                    'wcsgroup: Error: Syntax: wcsgroup get <key> <var> <userid> <[team]>'
                )
                logging.log(
                    'wcsgroup: Information: Got: wcsgroup ' +
                    ' '.join(map(str, args)), 1)

        elif todo == 'set':
            if len(args) >= 4:
                key = str(args[1])
                userid = str(args[2])
                value = str(args[3])

                team = None
                if len(args) == 5:
                    userid = team = {2: 'T', 3: 'CT'}[int(args[4])]

                if exists('userid', userid) or team is not None:
                    if not tools.wcsgroup.wcsgroup.existsUser(userid):
                        tools.wcsgroup.wcsgroup.addUser(userid)

                    tools.wcsgroup.wcsgroup.setUser(userid, key, value)

        elif todo == 'foreach':
            var = str(args[1])
            com = str(args[2])
            tools.wcsgroup.wcsgroup.foreach(var, com)

        elif todo == 'foreachval':
            var = str(args[1])
            key = str(args[2])
            command = str(args[3])
            tools.wcsgroup.wcsgroup.foreachval(var, key, command)
예제 #14
0
from es import exists
#   Gamethread
from gamethread import delayed
#   Playerlib
from playerlib import getPlayer

# GunGame Imports
#   Modules
from gungame51.modules.active import ActiveInfo
#   Repeat
from gungame51.core.repeat import Repeat

# =============================================================================
# >> GLOBAL VARIABLES
# =============================================================================
gg_dm_respawn_delay = ServerVar('gg_dm_respawn_delay')


# =============================================================================
# >> CLASSES
# =============================================================================
class PlayerCountdown(object):
    '''Object used to house the countdown methods for BasePlayer objects'''
    def start_repeat(self):
        '''Starts the player's repeat'''

        # Is there a delay?
        if not int(gg_dm_respawn_delay):

            # If not, simply spawn the player
            delayed(0.1, self.check_respawn)
예제 #15
0
from playerlib import getPlayer

# GunGame Imports
#   Modules
from gungame51.modules.active import ActiveInfo
#   Players
from gungame51.core.players.shortcuts import Player as ggPlayer

# Script Imports
from eliminated import EliminatedPlayers
from respawn import respawn_players

# =============================================================================
# >> GLOBAL VARIABLES
# =============================================================================
gg_elimination_spawn = ServerVar('gg_elimination_spawn')


# =============================================================================
# >> CLASSES
# =============================================================================
class Player(object):
    '''Class used to interact with a specific player'''
    def __init__(self, userid):
        '''Called when the class is first initialized'''

        # Store the player's base attributes
        self.userid = userid
        self.gg_player = ggPlayer(userid)
        self.eliminated = EliminatedPlayers()
        self.reconnect = False
예제 #16
0
# =============================================================================
# >> ADDON REGISTRATION/INFORMATION
# =============================================================================
info = AddonInfo()
info.name = 'gg_teamplay'
info.title = 'GG Teamplay'
info.author = 'GG Dev Team'
info.version = '5.1.%s' % '$Rev: 586 $'.split('$Rev: ')[1].split()[0]
info.conflicts = ['gg_deathmatch', 'gg_handicap', 'gg_teamwork']
info.translations = ['gg_teamplay']

# =============================================================================
# >> GLOBAL VARIABLES
# =============================================================================
gg_teamplay_roundend_messages = ServerVar('gg_teamplay_roundend_messages')
gg_teamplay_level_info = ServerVar('gg_teamplay_level_info')
gg_teamplay_winner_messages = ServerVar('gg_teamplay_winner_messages')
gg_teamplay_end_on_first_kill = ServerVar('gg_teamplay_end_on_first_kill')


# =============================================================================
# >> EVENT CLASSES
# =============================================================================
class GG_Team_Win(ESEvent):
    '''Fires when a team wins the game'''

    winner = ShortField(min_value=2,
                        max_value=3,
                        comment='Team that won the match')