³ò
˜õÜNc        
   @   s¥   d  Z  d d k Z d d k Z d d k l Z d d k l	 Z
 d d k Z d d k l Z d d k l Z e
 d ƒ Z e
 d ƒ Z e
 ƒ  Z d	 e f d
 „  ƒ  YZ d S(   sj   
$Rev: 585 $
$LastChangedBy: satoon101 $
$LastChangedDate: 2011-10-30 18:48:42 -0400 (Sun, 30 Oct 2011) $
iÿÿÿÿN(   t	   getPlayer(   t   getWeaponNameList(   t   GunGameError(   t   get_level_weapons   #primarys
   #secondaryt   PlayerWeaponsc           B   sV   e  Z d  Z e d „  ƒ Z d „  Z d „  Z e e d „ Z e g  d „ Z	 d „  Z
 RS(   s,   Adds weapon methods to the BasePlayer class.c         C   s
   |  i  ƒ  S(   s(   
        Return the weapon name
        (   t
   get_weapon(   t   self(    (    sX   /home/saberrider/srcds/css/cstrike/addons/eventscripts/gungame51/core/players/weapons.pyt   weapon'   s    c         C   s   t  |  i ƒ S(   N(   t   _level_weapont   level(   R   (    (    sX   /home/saberrider/srcds/css/cstrike/addons/eventscripts/gungame51/core/players/weapons.pyR   .   s    c         C   sÿ  d } |  i d j  o d |  i d } n) t |  i ƒ i o d |  i d } n | o t | ƒ ‚ n |  i d j oS t i i	 d |  i ƒ |  i
 d j o |  i t |  i
 d ƒ ƒ qû|  i ƒ  n/|  i d j oh t i |  i d	 ƒ } t i i	 d
 |  i ƒ |  i
 d j o |  i t |  i
 d ƒ ƒ qû|  i ƒ  n·t i |  i d |  i ƒ o( t i i	 d |  i |  i f ƒ d Snrt i |  i ƒ } | oÉ t | i ƒ  ƒ i t ƒ } t | i ƒ  ƒ i t ƒ } d } d |  i t j o | o | i ƒ  } n, d |  i t j o | o | i ƒ  } n | o, t i |  i | ƒ t i | | d ƒ qln t i |  i d |  i ƒ } t i |  i d |  i ƒ } | | j o* t i | ƒ | p |  i ƒ  d SqÛn t i i	 d |  i |  i f ƒ d S(   s=   
        Gives a player their current levels weapon.
        i   s#   Unable to give player weapon (%s): s   is not on a team.s   is not alive.t   knifes   es_xsexec %s "use weapon_knife"i   t	   hegrenadet   weapon_hegrenades#   es_xsexec %s "use weapon_hegrenade"s	   weapon_%ss   es_xsexec %s "use weapon_%s"Nt   weapon_t   instance(   t   Nonet   teamt   useridt
   _getPlayert   isdeadR   R   t   _est   servert   queuecmdR	   t   strip_weaponsR   t   stript   _spet   giveNamedItemt
   ownsWeapont   getWeaponDictt   sett   keyst   intersectiont   list_pWeaponst   list_sWeaponst   popt
   dropWeapont   removeEntityByInstancet   give_weapon(   R   t   errort   given_weapont   playerWeaponst   pWeapont   sWeapont   weapToStript   weapon_check(    (    sX   /home/saberrider/srcds/css/cstrike/addons/eventscripts/gungame51/core/players/weapons.pyR%   1   sh    

			
c         C   s  d t  | ƒ i d d ƒ } | t t d d d g j o t d | d d	 ƒ ‚ n t t i d
 ƒ ƒ o5 |  i i	 | d ƒ t
 i d |  i i | d ƒ n t i |  i | ƒ o2 | d j o t |  i ƒ i ƒ  d j  o d Sn | oØ t i |  i ƒ } | o» t | i ƒ  ƒ i t ƒ } t | i ƒ  ƒ i t ƒ } d } | t j o | o | i ƒ  } n% | t j o | o | i ƒ  } n | o, t i |  i | ƒ t i | | d ƒ qÄqÈn t i |  i | ƒ | o! t i i d |  i | f ƒ n d S(   sý   
        Gives a player the specified weapon.
        Weapons given by this method will not be stripped by gg_dead_strip.

        Setting strip to True will make it strip the weapon currently
        held in the slot you are trying to give to.
        s	   weapon_%sR   t    R   t   weapon_flashbangt   weapon_smokegrenades   Unable to give "%s": i   s   is not a valid weapont   gg_dead_stripgš™™™™™¹?i   NR   s   es_xsexec %s "use %s"(   t   strt   replaceR    R!   t
   ValueErrort   intR   t	   ServerVart   stripexceptionst   appendt   _gamethreadt   delayedt   removeR   R   R   R   t   getFBR   R   R   R   R   R"   R#   R$   R   R   R   (   R   R   t	   useWeaponR   R(   R)   R*   t   stripWeapon(    (    sX   /home/saberrider/srcds/css/cstrike/addons/eventscripts/gungame51/core/players/weapons.pyt   give¤   s>    	
c         C   sŸ   t  i |  i ƒ } | p d Sn xw | D]o } |  i | d j o | p | d j p | d | j o q( n t  i |  i | ƒ t  i | | d ƒ q( Wd S(   sL  
            * Strips/removes all weapons from the player minus the knife and
              their current levels weapon.

            * If True is specified, then their level weapon is also stripped.

            * Exceptions can be entered in list format, and anything in the
              exceptions will not be stripped.
        Ni   t   weapon_knifet	   weapon_c4R   (   s   weapon_knifes	   weapon_c4(   R   R   R   R   R#   R$   (   R   t
   levelStript
   exceptionst   pWeaponsR   (    (    sX   /home/saberrider/srcds/css/cstrike/addons/eventscripts/gungame51/core/players/weapons.pyR   ë   s     c         C   s¾   t  i |  i ƒ } g  } | D]( } | | i d ƒ o | n d | q ~ } t | ƒ i t | i ƒ  ƒ ƒ i t d g ƒ ƒ } x6 | D]. } t  i |  i | ƒ t  i	 | | d ƒ qˆ Wd S(   s¸   
        Strips a list of weapons from a player. (Used primarily for selective
            weapon removal when a player gets a new weapon)
        stripWeapons must be a list.
        R   s	   weapon_%sR?   R   N(
   R   R   R   t
   startswithR   R   R   t
   differenceR#   R$   (   R   t   stripWeaponsR(   t   _[1]t   wt
   remWeaponsR=   (    (    sX   /home/saberrider/srcds/css/cstrike/addons/eventscripts/gungame51/core/players/weapons.pyR     s    5' (   t   __name__t
   __module__t   __doc__t   propertyR   R   R%   t   FalseR>   R   R   (    (    (    sX   /home/saberrider/srcds/css/cstrike/addons/eventscripts/gungame51/core/players/weapons.pyR   %   s   		sG(   RL   t   esR   t
   gamethreadR8   t	   playerlibR    R   t	   weaponlibR   t   _getWeaponNameListt   speR   t   gungame51.coreR   t    gungame51.core.weapons.shortcutsR   R   R    R!   t   list_allWeaponst   objectR   (    (    (    sX   /home/saberrider/srcds/css/cstrike/addons/eventscripts/gungame51/core/players/weapons.pys   <module>   s   	