³ò
˜õÜNc           @   sÍ   d  Z  d d k l Z d d k l Z d d k l Z d d k l Z d d k l	 Z	 d „  Z
 d „  Z d	 „  Z d
 „  Z d „  Z d „  Z d d k l Z e i
 i  e
 _  e i i  e _  e i i  e _  d S(   sj   
$Rev: 588 $
$LastChangedBy: satoon101 $
$LastChangedDate: 2011-11-13 10:23:46 -0500 (Sun, 13 Nov 2011) $
iÿÿÿÿ(   t   copy(   t   getPlayerList(   t   Player(   t   _PlayerContainer(   t   reset_leadersc         C   s   t  i |  | | ƒ d  S(   N(   R   t   add_attribute_callback(   t	   attributet   functiont   addon(    (    sZ   /home/saberrider/srcds/css/cstrike/addons/eventscripts/gungame51/core/players/shortcuts.pyR      s    c         C   s   t  i |  ƒ d  S(   N(   R   t   remove_attribute_callback(   R   (    (    sZ   /home/saberrider/srcds/css/cstrike/addons/eventscripts/gungame51/core/players/shortcuts.pyR	      s    c         C   s   t  i |  ƒ d  S(   N(   R   t   remove_callbacks_for_addon(   R   (    (    sZ   /home/saberrider/srcds/css/cstrike/addons/eventscripts/gungame51/core/players/shortcuts.pyR
   #   s    c         C   sv   t  |  t ƒ o t |  ƒ }  n d |  j o5 x* t |  ƒ D] } t | ƒ t | ƒ | <q: Wd Sn | t |  ƒ | <d S(   s/  
    Sets a Player() attribute by userid or by filter:
        #all, #alive, #dead, #human, #bot, #un, #spec
    Note:
        See playerlib.getPlayerList() for the appropriate filters.

    Usage:
        from gungame.core.players.shortcuts import setAttribute

        # Set a custom attribute for all players
        setAttribute('#all', 'myattribute', 0)

        # Call this attribute (from some event that provides a userid)
        es.msg('myattribute for %s = %s' % (event_var['es_username'],
            Player(event_var['userid']).myattribute))
    t   #N(   t
   isinstancet   intt   strR   R    R   (   t   filterR   t   valuet   userid(    (    sZ   /home/saberrider/srcds/css/cstrike/addons/eventscripts/gungame51/core/players/shortcuts.pyt   setAttribute'   s     c         C   sj   t  |  t ƒ o t |  ƒ }  n d |  j o, x! t |  ƒ D] } t | ƒ | =q: Wd Sn t |  ƒ | =d S(   sæ  
    Deletes a Player() attribute by userid or by filter:
        #all, #alive, #dead, #human, #bot, #un, #spec

    Note:
        See playerlib.getPlayerList() for the appropriate filters.

    Usage:
        from gungame.core.players.shortcuts import deleteAttribute

        # Delete a custom attribute for all players
        deleteAttribute('#all', 'myattribute')

        # Delete a custom attribute from one player
        deleteAttribute(event_var['userid'], 'myattribute')
    R   N(   R   R   R   R   R   (   R   R   R   (    (    sZ   /home/saberrider/srcds/css/cstrike/addons/eventscripts/gungame51/core/players/shortcuts.pyt   deleteAttributeB   s     c           C   s   t  ƒ  i ƒ  t ƒ  d S(   sr  
    Resets the BasePlayer instances, setting their attributes back to default.

    Notes:
        * All custom attributes will have to be re-declared after this
          command has been issued.
        * It is recommended that if any custom attributes are set, that
          the scripter uses event gg_start to re-initialize custom
          player attributes.
    N(   R   t   resetR   (    (    (    sZ   /home/saberrider/srcds/css/cstrike/addons/eventscripts/gungame51/core/players/shortcuts.pyt   reset_players]   s    (   t   PlayerCallbacksN(   t   __doc__R    t	   playerlibR   t   gungame51.core.playersR   t   gungame51.core.players.playersR   t    gungame51.core.leaders.shortcutsR   R   R	   R
   R   R   R   t    gungame51.core.players.callbacksR   t   _CB(    (    (    sZ   /home/saberrider/srcds/css/cstrike/addons/eventscripts/gungame51/core/players/shortcuts.pys   <module>   s   						