³ò
zÆWOc           @   sÀ  d  Z  d d k l Z d d k 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 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 d k l Z d d k l Z d d k l Z d d k l Z d d k l Z e ƒ  Z d e _  d e _! d e _" d d i# d ƒ d i# ƒ  d e _$ d g e _% e i& d ƒ Z' e i& d ƒ Z( e i& d ƒ Z) e i& d ƒ Z* e i& d ƒ Z+ e i& d  ƒ Z, e i& d! ƒ Z- e i& d" ƒ Z. g  Z/ e d# ƒ D] Z0 e/ e0 i1 qï[/ Z2 e2 i3 d$ „  e d% ƒ Dƒ ƒ e2 i4 d& ƒ d' e f d( „  ƒ  YZ5 d) e6 f d* „  ƒ  YZ7 d+ e8 f d, „  ƒ  YZ9 e9 ƒ  Z: d- „  Z; d. „  Z< d/ „  Z= d0 „  Z> d1 „  Z? d2 „  Z@ d3 „  ZA d S(4   st   
$Rev: 622 $
$LastChangedBy: jlukerobi@gmail.com $
$LastChangedDate: 2012-03-05 13:12:07 -0500 (Mon, 05 Mar 2012) $
iÿÿÿÿ(   t   shuffleN(   t   registerServerCommand(   t   unregisterServerCommand(   t   delayed(   t	   getPlayer(   t   getPlayerList(   t   getWeaponList(   t	   AddonInfo(   t   LoadedAddons(   t   PriorityAddon(   t   GG_Start(   t   hudhint(   t   msg(   t   Player(   t   Repeat(   t   get_level_weapont   gg_warmup_rounds   GG Warmup Rounds   GG Dev Teams   5.1.%ss   $Rev: 622 $s   $Rev: i   i    t   mp_freezetimet   gg_warmup_timert   gg_warmup_weapont   gg_warmup_start_filet   gg_warmup_end_filet   gg_warmup_round_min_playerst   gg_warmup_round_max_extensionst   gg_warmup_round_players_reacheds   #primaryc         c   s   x |  ] } | i  Vq Wd  S(   N(   t   basename(   t   .0t   weapon(    (    st   /home/saberrider/srcds/css/cstrike/addons/eventscripts/gungame51/scripts/included/gg_warmup_round/gg_warmup_round.pys	   <genexpr>I   s    s
   #secondaryt	   hegrenadet   WarmupRoundRepeatc           B   s    e  Z d  Z d „  Z d „  Z RS(   sC   Class that extends the Repeat functionality for use by Warmup Roundc         C   s   |  i  t t ƒ ƒ d S(   s   Extends the Warmup timerN(   t   extendt   intt   warmup_timer(   t   self(    (    st   /home/saberrider/srcds/css/cstrike/addons/eventscripts/gungame51/scripts/included/gg_warmup_round/gg_warmup_round.pyt   extend_warmup_timeS   s    c         C   s   |  i  } |  i | d ƒ d S(   s!   Ends the Warmup timer in 1 secondi   N(   t   timeleftt   reduce(   R!   t	   remaining(    (    st   /home/saberrider/srcds/css/cstrike/addons/eventscripts/gungame51/scripts/included/gg_warmup_round/gg_warmup_round.pyt   end_warmup_timeY   s    	(   t   __name__t
   __module__t   __doc__R"   R&   (    (    (    st   /home/saberrider/srcds/css/cstrike/addons/eventscripts/gungame51/scripts/included/gg_warmup_round/gg_warmup_round.pyR   P   s   	t
   Prioritiesc           B   s    e  Z d  Z d „  Z d „  Z RS(   s-   Set to manager Priority Addons used in Warmupc         C   s8   | t  j o' t  i | ƒ t t |  ƒ i | ƒ n d S(   s<   Overriding method that also adds all addons to PriorityAddonN(   R	   t   addt   superR*   (   R!   t   addon(    (    st   /home/saberrider/srcds/css/cstrike/addons/eventscripts/gungame51/scripts/included/gg_warmup_round/gg_warmup_round.pyR+   f   s    c         C   s5   x |  D] } t  i | ƒ q Wt t |  ƒ i ƒ  d S(   s=   Overriding method that also removes addons from PriorityAddonN(   R	   t   discardR,   R*   t   clear(   R!   R-   (    (    st   /home/saberrider/srcds/css/cstrike/addons/eventscripts/gungame51/scripts/included/gg_warmup_round/gg_warmup_round.pyR/   r   s     (   R'   R(   R)   R+   R/   (    (    (    st   /home/saberrider/srcds/css/cstrike/addons/eventscripts/gungame51/scripts/included/gg_warmup_round/gg_warmup_round.pyR*   c   s   	t   WarmupRoundc           B   s¡   e  Z d  Z d „  Z d „  Z d „  Z d „  Z d „  Z d „  Z d „  Z	 d „  Z
 d	 „  Z d
 „  Z d „  Z d „  Z d „  Z e d „  ƒ Z e d „  ƒ Z RS(   s!   Class used to manage Warmup Roundc         C   s‘   t  ƒ  |  _ t d |  i ƒ |  _ t |  _ t |  _ d |  _ d |  _
 t d |  i d ƒ g  |  _ |  i ƒ  t |  _ t d |  i d t f ƒ d S(   s"   Called when Warmup Round is loadedR   i    t   gg_end_warmups"   Server Command to end Warmup Roundi   t   set_on_loadN(   R*   t
   prioritiesR   t
   count_downt   repeatt   FalseR2   t   godmodet
   extensionst   NoneR   R   t   end_warmup_cmdt   list_of_weaponst   start_warmupt   TrueR   t   __setattr__(   R!   (    (    st   /home/saberrider/srcds/css/cstrike/addons/eventscripts/gungame51/scripts/included/gg_warmup_round/gg_warmup_round.pyt
   first_load‚   s    					
	c         C   s   d |  _  |  i ƒ  d S(   s(   Callback for command to end Warmup Roundt   Warmup_End_ForcedN(   t   messaget
   end_warmup(   R!   t   args(    (    st   /home/saberrider/srcds/css/cstrike/addons/eventscripts/gungame51/scripts/included/gg_warmup_round/gg_warmup_round.pyR:   ©   s    	c         C   s.   |  i  i ƒ  t d ƒ d |  _ |  i ƒ  d S(   s   Unloads Warmup RoundR1   R@   N(   R5   t   deleteR   RA   RB   (   R!   (    (    st   /home/saberrider/srcds/css/cstrike/addons/eventscripts/gungame51/scripts/included/gg_warmup_round/gg_warmup_round.pyt   unload_warmup²   s    
	c         C   s²   |  i  i t i ƒ d |  _ t t ƒ |  _ t i d ƒ t	 i
 d t t ƒ ƒ |  i ƒ  |  _ |  i i d t t ƒ ƒ x$ t d ƒ D] } |  i | i ƒ q„ Wt d |  i ƒ d S(   s'   Called when Warmup Round needs to startt   Timer_Endedi    s
   gungame51/i   s   #alivegš™™™™™¹?N(   R3   R+   t   infot   nameRA   R   R   t
   freezetimet   sett   est   mexect   strt   warmup_start_filet   set_warmup_weaponR   R5   t   startR    R   t   give_warmup_weapont   useridR   t   add_priority_addons(   R!   t   player(    (    st   /home/saberrider/srcds/css/cstrike/addons/eventscripts/gungame51/scripts/included/gg_warmup_round/gg_warmup_round.pyR<   Á   s    	 c         C   s%   x t  D] } |  i i | ƒ q Wd S(   s"   Adds all Loader Addons to PriorityN(   R   R3   R+   (   R!   R-   (    (    st   /home/saberrider/srcds/css/cstrike/addons/eventscripts/gungame51/scripts/included/gg_warmup_round/gg_warmup_round.pyRS   â   s     c         C   s<  |  i  i } | d j o |  i ƒ  d Sn |  i } | t t ƒ j oR t t ƒ } | d j p |  i o+ | d j o d |  _ |  i  i	 ƒ  d Sq™ n | d j oX |  i t t
 ƒ j  o1 |  i d 7_ t d d ƒ |  i  i ƒ  d Sn t d d ƒ n  t d d	 h  t | ƒ d
 <ƒ | d j o |  i ƒ  n d S(   s¸   
            Finds how many seconds are left and how many
            human players are active, then determines whether
            to extend, end, or continue the count down.
        i    Ni   i   t   Players_Reacheds   #humant   Timer_Extendedt   Timer_Singulart   Timer_Pluralt   timei   (   R5   R#   RB   t   get_human_playersR   t   warmup_round_min_playerst   warmup_round_players_reachedR8   RA   R&   t   warmup_round_max_extensionsR   R"   t	   play_beep(   R!   R%   t   playerst   players_reached(    (    st   /home/saberrider/srcds/css/cstrike/addons/eventscripts/gungame51/scripts/included/gg_warmup_round/gg_warmup_round.pyR4   ë   s,    
		c         C   sæ   |  i  o |  i Sn t t ƒ t j o t t ƒ Sn t |  i ƒ o |  i i d ƒ Sn t t ƒ d j o0 t t ƒ |  _ t	 |  i ƒ |  i i d ƒ Sn d t t ƒ j o, t t ƒ i
 d ƒ |  _ |  i i d ƒ Sn t d ƒ S(   s   Used to set the Warmup Weaponi    s   #randomt   ,i   (   R2   R   RM   t   warmup_weapont   possible_weaponst   lenR;   t   popt   listR    t   splitR   (   R!   (    (    st   /home/saberrider/srcds/css/cstrike/addons/eventscripts/gungame51/scripts/included/gg_warmup_round/gg_warmup_round.pyRO   6  s    
c         C   s£   t  i t j o d Sn |  i i ƒ  t d |  i ƒ |  i i ƒ  d |  _	 t
 i |  i ƒ t i d t t ƒ ƒ t i i d ƒ |  i t ƒ t d |  i ƒ d S(   s   Ends the current Warmup RoundNs   #humani    s
   gungame51/s   mp_restartgame 1i   (   RG   RH   R	   R5   t   stopR   RA   R3   R/   R8   R   RJ   RI   RK   RL   RM   t   warmup_end_filet   servert   queuecmdt   set_all_players_godmodeR=   R   t   clean_up(   R!   (    (    st   /home/saberrider/srcds/css/cstrike/addons/eventscripts/gungame51/scripts/included/gg_warmup_round/gg_warmup_round.pyRB   c  s    	c         C   s-   | |  _  x t d ƒ D] } | | _  q Wd S(   s+   Sets all players GodMode to the given values   #aliveN(   R7   R   (   R!   t   valueRT   (    (    st   /home/saberrider/srcds/css/cstrike/addons/eventscripts/gungame51/scripts/included/gg_warmup_round/gg_warmup_round.pyRl   ‡  s    	 c         C   s   |  i  t ƒ t ƒ  i ƒ  d S(   sL   Cleans up any residuals at the time that GunGame round should start
        N(   Rl   R6   R
   t   fire(   R!   (    (    st   /home/saberrider/srcds/css/cstrike/addons/eventscripts/gungame51/scripts/included/gg_warmup_round/gg_warmup_round.pyRm   “  s    c         C   sB   t  i t j o |  i | ƒ n |  i o t t | ƒ _ n d  S(   N(   RG   RH   R	   RQ   R7   R=   R   (   R!   RR   (    (    st   /home/saberrider/srcds/css/cstrike/addons/eventscripts/gungame51/scripts/included/gg_warmup_round/gg_warmup_round.pyt   player_spawnŸ  s    
c         C   sÀ   t  i d | ƒ p d Sn t  i | ƒ d j  o d Sn t | ƒ i o d Sn t | ƒ } d } t  i | ƒ o | d 7} n t | | i t	 t
 g f ƒ t | | i |  i t	 t	 f ƒ d S(   s"   Gives the player the warmup weaponRR   Ni   gš™™™™™©?gš™™™™™É?(   RK   t   existst   getplayerteamR   t   isdeadR   t   isbotR   t   stripR=   Rb   t   giveR   (   R!   RR   t   ggPlayert   delay(    (    st   /home/saberrider/srcds/css/cstrike/addons/eventscripts/gungame51/scripts/included/gg_warmup_round/gg_warmup_round.pyRQ   ¬  s    c         C   s·   t  i t j o d Sn |  i d j o d Sn t | d ƒ } t i d | ƒ o | d j o d Sn t | d ƒ d j  o d Sn t | ƒ i o d Sn t	 | ƒ i
 d ƒ d S(   s<   Checks to see if a player needs to recieve another hegrenadeNR   RR   i    t   es_userteami   (   RG   RH   R	   R   R   RK   Rq   R   Rs   R   Rv   (   R!   t	   event_varRR   (    (    st   /home/saberrider/srcds/css/cstrike/addons/eventscripts/gungame51/scripts/included/gg_warmup_round/gg_warmup_round.pyt   give_hegrenadeÓ  s    !c          C   s1   x* t  d ƒ D] }  t |  i ƒ i d ƒ q Wd S(   s!   Plays a beep sound to all playerss   #humant   countDownBeepN(   R   R   RR   t	   playsound(   RT   (    (    st   /home/saberrider/srcds/css/cstrike/addons/eventscripts/gungame51/scripts/included/gg_warmup_round/gg_warmup_round.pyR^   ú  s     c         C   s   t  t d ƒ ƒ S(   s-   Returns the number of human players on a teams   #human,!spec,!un(   Rd   R   (   R!   (    (    st   /home/saberrider/srcds/css/cstrike/addons/eventscripts/gungame51/scripts/included/gg_warmup_round/gg_warmup_round.pyRZ     s    (   R'   R(   R)   R?   R:   RE   R<   RS   R4   RO   RB   Rl   Rm   Rp   RQ   R{   t   staticmethodR^   t   propertyRZ   (    (    (    st   /home/saberrider/srcds/css/cstrike/addons/eventscripts/gungame51/scripts/included/gg_warmup_round/gg_warmup_round.pyR0      s    	'				!			K	-	$				'	'
c           C   s   t  i ƒ  d  S(   N(   t   warmupR?   (    (    (    st   /home/saberrider/srcds/css/cstrike/addons/eventscripts/gungame51/scripts/included/gg_warmup_round/gg_warmup_round.pyt   load  s    c           C   s   t  i ƒ  d  S(   N(   R€   RE   (    (    (    st   /home/saberrider/srcds/css/cstrike/addons/eventscripts/gungame51/scripts/included/gg_warmup_round/gg_warmup_round.pyt   unload  s    c         C   s   t  i ƒ  d  S(   N(   R€   R<   (   Rz   (    (    st   /home/saberrider/srcds/css/cstrike/addons/eventscripts/gungame51/scripts/included/gg_warmup_round/gg_warmup_round.pyt   es_map_start  s    c         C   s   t  i |  d ƒ d  S(   NRR   (   R€   Rp   (   Rz   (    (    st   /home/saberrider/srcds/css/cstrike/addons/eventscripts/gungame51/scripts/included/gg_warmup_round/gg_warmup_round.pyRp   !  s    c         C   s   t  i |  ƒ d  S(   N(   R€   R{   (   Rz   (    (    st   /home/saberrider/srcds/css/cstrike/addons/eventscripts/gungame51/scripts/included/gg_warmup_round/gg_warmup_round.pyt   hegrenade_detonate%  s    c         C   s   t  i i ƒ  d  S(   N(   R€   R5   Rh   (   Rz   (    (    st   /home/saberrider/srcds/css/cstrike/addons/eventscripts/gungame51/scripts/included/gg_warmup_round/gg_warmup_round.pyt   cs_win_panel_match)  s    c           C   s   t  i S(   N(   R€   R   (    (    (    st   /home/saberrider/srcds/css/cstrike/addons/eventscripts/gungame51/scripts/included/gg_warmup_round/gg_warmup_round.pyt   get_warmup_weapon0  s    (B   R)   t   randomR    RK   t   cmdlibR   R   t
   gamethreadR   t	   playerlibR   R   t	   weaponlibR   t   gungame51.core.addons.infoR   t   gungame51.core.addons.loadedR   t   gungame51.core.addons.priorityR	   t   gungame51.core.eventsR
   t"   gungame51.core.messaging.shortcutsR   R   t    gungame51.core.players.shortcutsR   t   gungame51.core.repeatR   t    gungame51.core.weapons.shortcutsR   RG   RH   t   titlet   authorRg   t   versiont   translationst	   ServerVarR   R    Rb   RN   Ri   R[   R]   R\   t   _[1]R   R   Rc   R   t   appendR   RJ   R*   t   objectR0   R€   R   R‚   Rƒ   Rp   R„   R…   R†   (    (    (    st   /home/saberrider/srcds/css/cstrike/addons/eventscripts/gungame51/scripts/included/gg_warmup_round/gg_warmup_round.pys   <module>   s^   				$*ÿ Ž							