Ñò
ØóµPc        !   @   s  d  d k  l Z d  d k l Z l Z l Z d  d k l Z d  d k l	 Z	 d  d k
 Z
 d  d k Z d  d k l Z l Z d  d k Z d  d k Z d  d k l Z d  d k Td  d	 k l Z l Z l Z l Z l Z l Z d  d
 k l Z e p e o d  d k l Z l Z n e p e p e o  d  d k Z d  d k l Z n e o$ d  d k l  Z  d  d k l! Z! n e o d  d k" Tn e# d d d d d f ƒ Z$ e# d d d d d d f ƒ Z% d Z& d Z' h d d 6d d 6d d  6Z( d! f  d" „  ƒ  YZ) d# Z* d$ Z+ d% Z, e- a. e- a/ e d& Z0 d' d( Z1 d) Z2 d* Z3 e d+ d, d- d. d/ d0 d1 d2 d3 d4 d5 d6 d7 d8 g ƒ Z4 e4 d d e- d9 e5 e5 e5 e5 e5 d d9 d9 e5 ƒ Z6 d: „  Z7 d; „  Z8 d< e9 f d= „  ƒ  YZ: d> e9 f d? „  ƒ  YZ; d@ e9 f dA „  ƒ  YZ< dB e9 f dC „  ƒ  YZ= dD „  Z> dE „  Z? dF „  Z@ dG „  ZA h	 dH „  dI 6dJ „  dK 6dL „  dM 6dN „  dO 6dP „  dQ 6dR „  dS 6dT „  dU 6dV „  dW 6dX „  dY 6ZB dZ „  ZC d[ „  ZD d\ „  ZE d] „  ZF d^ „  ZG e- d_ „ ZH d` „  ZI da „  ZJ e- db „ ZK dc „  ZL dd „  ZM de „  ZN h f  df 6f  dg 6ZO e- e- dh „ ZP e- e- di „ ZQ e- e- dj „ ZR e- e- dk „ ZS e- e- dl „ ZT e- dm „ ZU e- e- dn „ ZV do „  ZW dp „  ZX dq „  ZY dr „  ZZ ds „  Z[ dt du dv dw dx f Z\ dy „  Z] e- dz „ Z^ d{ „  Z_ d| „  Z` d} „  Za d0 d1 d2 d3 d4 d8 f Zb d~ „  Zc d „  Zd d€ ee d� „ Zf d‚ „  Zg dƒ „  Zh d„ „  Zi d… „  Zj d† „  Zk d‡ „  Zl h d d 6dW d 6dQ d 6dO d 6dS d 6dY dˆ 6dU d 6Zm d‰ „  Zn dŠ „  Zo e5 d‹ „ Zp dŒ „  Zq d� „  Zr dŽ „  Zs d� „  Zt d� „  Zu d‘ „  Zv d’ „  Zw d“ „  Zx d” „  Zy d• „  Zz d– „  Z{ d— „  Z| d˜ „  Z} d™ „  Z~ dš „  Z d› „  Z€ dœ „  Z� d� „  Z‚ dž „  Zƒ dŸ „  Z„ e- d  „ Z… e ob e† d¡ d¢ d£ d¤ g g  Z‡ e D] Zˆ e‡ d¥ eˆ q’[‡ g  Z‰ e D] Zˆ e‰ d¦ eˆ qµ[‰ ƒ ZŠ n d§ „  Z‹ d¨ „  ZŒ d© „  Z� dª „  ZŽ d« „  Z� d¬ „  Z� d­ „  Z‘ d® „  Z’ d¯ „  Z“ d° „  Z” d± „  Z• e i– d Z— e i– dW Z˜ e i– dQ Z™ e i– dO Zš e i– dS Z› e i– dY Zœ e i– dU Z� e i– d² Zž e i– dM ZŸ e i– dI Z  e i– dK Z¡ e- e3 d d f Z¢ e¢ e¢ e¢ e¢ f Z£ e- e3 d f Z¤ e¤ e¤ e¤ f Z¥ d S(³   iÿÿÿÿ(   t
   namedtuple(   t   radianst   cost   pi(   t   partial(   t   IntTypeN(   t   Vector2t   Vector3(   t   _xml(   t   *(   t   IS_DEVELOPMENTt	   IS_CLIENTt
   IS_CELLAPPt
   IS_BASEAPPt   IS_WEBt   ITEM_DEFS_PATH(   t#   DEFAULT_GUN_PITCH_LIMITS_TRANSITION(   t   ModelHitTestert   VehicleHitTester(   t   EFFECT_MATERIALS(   t   i18n(   t   EffectsListt	   lightTankt
   mediumTankt	   heavyTankt   SPGs   AT-SPGt   vehiclet   gunt   turrett   enginet   chassist   radioi   i    t   winteri   t   summeri   t   desertt   HORN_COOLDOWNc           B   s   e  Z d  Z d Z d Z RS(   g      9@g      @i   (   t   __name__t
   __module__t   WINDOWt   CLIENT_WINDOW_EXPANSIONt   MAX_SIGNALS(    (    (    s    scripts/common/items/vehicles.pyR#   ,   s   i   g‚çÞÃ%ÇÑ?g     ü†@s	   vehicles/gìQ¸…ë±?g…ëQ¸ž#@gffffff¶?i �åMt   MaterialInfot   kindt   armort   extrat   vehicleDamageFactort   useArmorHomogenizationt   useHitAnglet   useAntifragmentationLiningt   mayRicochett   collideOnceOnlyt
   damageKindt   chanceToHitByProjectilet   chanceToHitByExplosiont   continueTraceIfNoHitg        c         C   sÊ   t  p t o d d  k } n t ƒ  a t ƒ  a t }  |  o‰ t i ƒ  t i	 ƒ  t i
 ƒ  t i ƒ  x^ t t t i ƒ ƒ D]C } t i | ƒ x- t i | ƒ i ƒ  D] } t i | | ƒ q¤ Wq{ Wn d  S(   Niÿÿÿÿ(   R   R   t   vehicle_extrast   VehicleListt   g_listt   Cachet   g_cachet   Truet   optionalDevicest
   equipmentst   hornst   playerEmblemst   xranget   lent   nationst   NAMESt   customizationt   getListt   iterkeysR   (   t   preloadEverythingR7   t   nationIDt   vehicleTypeID(    (    s    scripts/common/items/vehicles.pyt   initv   s     		



  c          C   sT   d d  k  }  |  i ƒ  d d k l } d d  k } | i | t i ƒ t t ƒ d  S(   Niÿÿÿÿ(   t   modules(   R7   t   reloadt   sysRL   t   __builtin__R%   RK   t   False(   R7   RL   RO   (    (    s    scripts/common/items/vehicles.pyRM   ’   s    
t   VehicleDescrc           B   s|  e  Z d# d# d# d  „ Z d „  Z e d „  e ƒ Z d „  Z e d „  e ƒ Z d „  Z	 d „  Z
 e e	 e
 ƒ Z d „  Z e d „  e ƒ Z d	 „  Z d
 „  Z d „  Z d d „ Z d d „ Z d d „ Z d d „ Z d 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" d „  Z# d  „  Z$ d! „  Z% d" „  Z& RS($   c   	      C   s  | d  j o | d  j	 o | \ } } n* | d  j	 p t ‚ t i | ƒ \ } } t i | | ƒ } | i d d } t i d | d >} t	 i
 d | | | i d d d | i d d d | i d d d | i d d d | d d | d d d d d ƒ
 } n |  i | ƒ d  S(   Ni    R   i   s   <2B6HBt   idi   t   guns(   t   Nonet   AssertionErrorR9   t   getIDsByNameR;   R   t   turretst   itemst   ITEM_TYPE_INDICESt   structt   packR   t   enginest	   fuelTankst   radiost#   _VehicleDescr__initFromCompactDescr(	   t   selft   compactDescrt   typeIDt   typeNameRI   RJ   t   typet   turretDescrt   header(    (    s    scripts/common/items/vehicles.pyt   __init__=  s$    c         C   s/   |  i  | \ |  _ |  _ | |  _ d |  _ d  S(   Ni    (   RW   R   R   t   _VehicleDescr__activeTurretPost   activeGunShotIndex(   R`   t   turretPosition(    (    s    scripts/common/items/vehicles.pyt   __set_activeTurretPosW  s    	c         C   s   |  i  S(    (   Rh   (   R`   (    (    s    scripts/common/items/vehicles.pyt   <lambda>\  s    c         C   s!   |  i  d | |  _ | |  _ d  S(   Nt   shots(   R   t   shott   _VehicleDescr__activeGunShotIdx(   R`   t	   shotIndex(    (    s    scripts/common/items/vehicles.pyt   __set_activeGunShotIndex`  s    c         C   s   |  i  S(    (   Ro   (   R`   (    (    s    scripts/common/items/vehicles.pyRl   d  s    c         C   s.   x' |  i  D] } | d d  j	 o | Sq
 Wd  S(   Ni    (   t   camouflagesRT   (   R`   t   v(    (    s    scripts/common/items/vehicles.pyt   __get_camouflagei  s
    
 	c   	      C   s@  t  } | d  j o | |  _ d  S| \ } } } t | d ƒ d } t | ƒ } t i |  i i d ƒ d | } |  i i } | | d j o t	 d ‚ n | d o | | d j o t	 d ‚ n | t
 j  o t	 d ‚ n d | j o
 d j n p t	 d	 ‚ n | d
 } | |  | | | f f | | d |  _ d  S(   Ni<   i    Rr   t   denys'   camouflage is incompatible with vehiclet   allows   wrong camouflage start timeiÿ   s   wrong camouflage durationR*   i   (   t   _EMPTY_CAMOUFLAGESRT   Rr   t   intR;   RE   Rd   RR   Ra   t	   Exceptiont   _CUSTOMIZATION_EPOCH(	   R`   t   ct   pRR   t	   startTimet   durationDayst   descrt   cdt   position(    (    s    scripts/common/items/vehicles.pyt   __set_camouflageo  s&    	!
c         C   sU   | d  j	 o; t i ƒ  | } |  i i i | d ƒ p t d ‚ qH n | |  _ d  S(   Nt   vehicleTagss!   horn is incompatible with vehicle(   RT   R;   R?   Rd   t   tagst   intersectionRy   t   _VehicleDescr__hornID(   R`   RR   R   (    (    s    scripts/common/items/vehicles.pyt   __set_hornID�  s
    c         C   s   |  i  S(    (   R†   (   R`   (    (    s    scripts/common/items/vehicles.pyRl   —  s    c         C   sm  |  i  } | d  j o t } d } | | nt i |  i i d ƒ d | } | d  j o | d } n | | d j o t d ‚ n |  i i } | | d j o t d ‚ n | d o | | d j o t d ‚ n t	 | d ƒ d } | t j  o t d	 ‚ n t	 | ƒ } d | j o
 d
 j n p t d ‚ n | |  | | | f f | | d |  _  d  S(   Ni    Rr   R*   s   wrong camouflage kindRu   s'   camouflage is incompatible with vehicleRv   i<   s   wrong camouflage start timeiÿ   s   wrong camouflage durationi   (
   Rr   RT   Rz   R;   RE   Rd   RR   Ry   Ra   Rx   (   R`   R�   t   camouflageIDR}   R~   R|   R   R€   (    (    s    scripts/common/items/vehicles.pyt   setCamouflage£  s,    	!c         C   sñ   |  i  } | | |  i i } | d  j p | | j o | } t } d } nx t i  ƒ  d | t | d ƒ d } | t j  o t d ‚ n t | ƒ } d | j o
 d j n p t d ‚ n | |  | | | f f | | d |  _  d  S(   Ni    i   i<   s   wrong emblem start timeiÿ   s   wrong emblem duration(   R@   Rd   t   defaultPlayerEmblemIDRT   Rz   R;   Rx   Ry   (   R`   R�   t   emblemIDR}   R~   R|   t   defEmblemID(    (    s    scripts/common/items/vehicles.pyt   setPlayerEmblemÎ  s    	
c         C   s  |  i  } | | | d  j o t } d } d } n¨ | d  j	 o5 t i |  i i d ƒ } | d | | d | n t | d ƒ d } | t j  o t d ‚ n t | ƒ } d | j o
 d j n p t d ‚ n | |  | | | | f f | | d |  _  d  S(	   Ni    t   inscriptionst   inscriptionColorsi<   s   wrong inscription start timeiÿ   s   wrong inscription durationi   (	   t   playerInscriptionsRT   Rz   R;   RE   Rd   RR   Rx   Ry   (   R`   R�   t   inscriptionIDR}   R~   t   colorR|   RE   (    (    s    scripts/common/items/vehicles.pyt   setPlayerInscriptionï  s"    	
i    c         C   sò   | d j o |  i  |  i i  f S| d j o |  i |  i i f S| d j o |  i |  i i f S| d j o |  i |  i i f S| d j o  |  i | d |  i i | f S| d j o" |  i | \ } } | | d f St	 p t
 ‚ d  S(	   Nt   vehicleChassist   vehicleEnginet   vehicleRadiot   vehicleFuelTankt   vehicleTurreti    t
   vehicleGunRS   (   R   Rd   R   R\   R   R^   t   fuelTankR]   RW   RP   RU   (   R`   t   itemTypeNamet   positionIndexRe   t   gunDescr(    (    s    scripts/common/items/vehicles.pyt   getComponentsByType  s     c         C   sï  t  | ƒ \ } } } t i | d j o t d f S| |  i i d j o t d f S| d j o |  i | d d d } nW t  | ƒ \ } } } t i | d j o t d f S| |  i i d j o t d f St |  i i | | ƒ } | d  j o t d f St | d	 | ƒ }	 |	 d  j o) | |  i i	 j o t d f St d
 f St
 |  i i | | |	 f ƒ }
 t
 |  i i | |  i | ƒ } zM |
 ƒ  |  i ƒ  o t d
 f S|  i ƒ  \ } } | | j o t d f SWd  | ƒ  Xt d  f S(   NR˜   s   wrong item typei    s   wrong nationi   RR   R™   s   not for this vehicle typeRS   s   not for current vehicles	   too heavy(   t   parseIntCompactDescrRX   t   ITEM_TYPE_NAMESRP   Rd   RR   RW   t   _findDescrByIDRT   t   installableComponentsR   t   __setitem__t.   _VehicleDescr__haveIncompatibleOptionalDevicest   _VehicleDescr__computeWeightR<   (   R`   t   turretCompactDescrt   gunCompactDescrRœ   t
   itemTypeIDRI   t   turretIDt   gunIDt   newTurretDescrt   newGunDescrt   settert   restorert   weightt	   maxWeight(    (    s    scripts/common/items/vehicles.pyt   mayInstallTurret1  s>    c         C   sö   t  | ƒ d } | d j o |  i | d d d } n t  | ƒ d } |  i | \ } } t |  i i | | ƒ } t | d | ƒ }	 | |	 f |  i | <|  i ƒ  |  i | j o | |  _ n | d g }
 | d j o |
 i | d ƒ n |
 S(   Ni   i    i   RR   RS   Ra   (   RŸ   RW   t
   _descrByIDRd   t   _VehicleDescr__updateAttributesRh   t   activeTurretPositiont   append(   R`   R¦   R§   Rœ   R©   Rª   t   prevTurretDescrt   prevGunDescrR«   R¬   t   removed(    (    s    scripts/common/items/vehicles.pyt   installTurreth  s    
c         C   s  t  | ƒ \ } } } t i | } | |  i i d j o t d f S| d j oÎ |  i | d } t | d | ƒ } | d  j o\ | |  i	 d d j oD xA |  i i | D]+ } t | d | ƒ } | d  j	 o Pq« q« Wn t
 |  i i | | | f ƒ }	 t
 |  i i | |  i | ƒ }
 nW| d j oF t |  i i | ƒ } t
 t |  d | ƒ }	 t
 t |  d |  i ƒ }
 n| d	 j oF t |  i i | ƒ } t
 t |  d
 | ƒ }	 t
 t |  d
 |  i ƒ }
 n± | d j oF t |  i i | ƒ } t
 t |  d | ƒ }	 t
 t |  d |  i ƒ }
 n^ | d j oF t |  i i | ƒ } t
 t |  d | ƒ }	 t
 t |  d |  i ƒ }
 n t d f S| d  j o) | |  i i j o t d f St d f SzM |	 ƒ  |  i ƒ  o t d f S|  i ƒ  \ } } | | j o t d f SWd  |
 ƒ  Xt d  f S(   Ni    s   wrong nationR™   RS   t   fakeTurretst   lobbyR”   R   R•   R   R–   R   R—   Rš   s   wrong item types   not for this vehicle types   not for current vehicles	   too heavy(   RŸ   RX   R    Rd   RR   RP   RW   R¡   RT   t   hullR   R£   R   t   setattrR\   R   R^   R   R]   Rš   R¢   R¤   R¥   R<   (   R`   Ra   Rœ   R¨   RI   t   compIDR›   Re   t   newDescrR­   R®   R¯   R°   (    (    s    scripts/common/items/vehicles.pyt   mayInstallComponent‹  sZ    % #
c         C   sA  t  | ƒ \ } } } t i | } | |  i i d j o t d ‚ n | d j o |  i | | ƒ S| d j o d } |  i i } nx | d j o d } |  i i } nU | d j o d	 } |  i i	 } n2 | d
 j o d } |  i i
 } n t p t ‚ t |  | ƒ }	 t | | ƒ }
 t |  | |
 ƒ |  i ƒ  |	 d f S(   Ni    s    incompatible nation of componentR™   R”   R   R•   R   R–   R   R—   Rš   Ra   (   RŸ   RX   R    Rd   RR   Ry   t   _VehicleDescr__installGunR   R\   R^   R]   RP   RU   t   getattrR²   R½   R³   (   R`   Ra   Rœ   R¨   RI   R¾   R›   t   attrNamet   compListt	   prevDescrR¿   (    (    s    scripts/common/items/vehicles.pyt   installComponentÎ  s0    
c         C   s
  t  | ƒ \ } } } t i | d j o t d f St i ƒ  | } |  i } | | j o t d f St | ƒ } | |  _ zy d  | | <| i |  ƒ }	 |	 d p |	 S| | | <|  i	 ƒ  o t d f S|  i
 ƒ  \ }
 } |
 | j o t d f SWd  | |  _ Xt d  f S(   Nt   optionalDevices   wrong item types   already installedi    s   not for current vehicles	   too heavy(   RŸ   RX   R    RP   R;   R=   t   listRT   t   checkCompatibilityWithVehicleR¤   R¥   R<   (   R`   Ra   t   slotIdxR¨   t   _t   deviceIDt   devicet   prevDevicest   devicest   resR¯   R°   (    (    s    scripts/common/items/vehicles.pyt   mayInstallOptionalDeviceü  s,    		


c         C   s…   t  i ƒ  t | ƒ d } |  i } | | } | | | <|  i ƒ  | d  j o d d f S| d o | i f d f Sd | i f f S(   Ni   t	   removable(    (    (    (    (   R;   R=   RŸ   R³   RT   Ra   (   R`   Ra   RÊ   RÍ   RÏ   t
   prevDevice(    (    s    scripts/common/items/vehicles.pyt   installOptionalDevice'  s    	


c         C   s…   |  i  } t | ƒ } | |  _  zP d  | | <|  i ƒ  o t d f S|  i ƒ  \ } } | | j o t d f SWd  | |  _  Xt d  f S(   Ns   not for current vehicles	   too heavy(   R=   RÈ   RT   R¤   RP   R¥   R<   (   R`   RÊ   RÎ   RÏ   R¯   R°   (    (    s    scripts/common/items/vehicles.pyt   mayRemoveOptionalDevice>  s    		

c         C   sh   |  i  | } d  |  i  | <|  i ƒ  | d  j o d d f S| d o | i f d f Sd | i f f S(   NRÒ   (    (    (    (    (   R=   RT   R³   Ra   (   R`   RÊ   RÍ   (    (    s    scripts/common/items/vehicles.pyt   removeOptionalDeviceZ  s    
c         C   sf  |  i  } t i } t i d | i d d >} | i d } |  i d d } |  i d d } |  i d d } |  i	 d d } | d | | | | | | ƒ }	 xV t
 t | i ƒ ƒ D]? }
 |  i |
 \ } } |	 | d | d d | d d ƒ 7}	 q³ Wd } d } t |  i ƒ t j p t ‚ xP |  i D]E } | d K} | d  j	 o( | d	 | i d ƒ | } | d O} q)q)Wd } d } xd t |  i ƒ D]S \ } } | d d  j	 o6 | d | i j o" | d | >O} | t | Œ  7} qŽqŽWxt t |  i ƒ D]c \ } } | d d  j	 oF | d | d >O} | t | d | d | d
 ƒ t | d ƒ 7} qõqõWd } x6 |  i D]+ } | d d  j	 o | t | Œ  7} qlqlWd } | | O} | o | d O} n |  i d  j	 o | d O} n | o | d O} n |	 t | ƒ | 7}	 | o |	 t | ƒ | 7}	 n |  i d  j	 o |	 t |  i ƒ 7}	 n | o |	 | 7}	 n |	 S(   NR   i    i   i   RR   s   <2B4Hs   <2Ht    s   <Hi   i   i   i   i   i    i@   i€   (   Rd   RZ   R[   RX   RY   RR   R   R   Rš   R   RA   RB   RW   R=   t   NUM_OPTIONAL_DEVICE_SLOTSRU   RT   t	   enumerateR@   RŠ   t   _packIDAndDurationR�   t   chrRr   R†   (   R`   Rd   R[   Rf   RJ   t	   chassisIDt   engineIDt
   fuelTankIDt   radioIDR€   t   nRe   R�   R=   t   optionalDevicesMaskRÍ   t   emblemPositionst   emblemst   idxt   itemRr   t   flags(    (    s    scripts/common/items/vehicles.pyt   makeCompactDescri  sn    :		 *
 
 % 8
 
c         C   sZ  |  i  } | i } xw t t |  i ƒ ƒ D]` } |  i | \ } } t | | d | i | d d ƒ } t | | d | d d d ƒ } q( Wt | |  i d | i d d ƒ } t | |  i d | i d d ƒ } t | |  i	 d | i
 d d ƒ } t | |  i d | i d d ƒ } x7 |  i D], } | d  j	 o t | | i d ƒ } q&q&W| S(   Nt   pricei    RS   (   i    i    (   Rd   Rè   RA   RB   RW   t   _summPriceDiffR   R   R\   Rš   R]   R   R^   R=   RT   (   R`   Rd   t   costRä   Re   R�   RÍ   (    (    s    scripts/common/items/vehicles.pyt   getCostí  s     		 %&$$$$
 c         C   s²   |  i  } |  i | i } xC |  i D]8 \ } } | t | ƒ t | d ƒ t | d ƒ 7} q# W| t |  i d ƒ t |  i ƒ d t |  i ƒ t |  i ƒ t |  i	 ƒ 7} | S(   Nt   turretRotatorHealtht   surveyingDeviceHealtht   ammoBayHealthi   (
   Rd   t	   maxHealtht
   repairCostRW   t   _getMaxCompRepairCostR¼   R   R   Rš   R   (   R`   Rd   Rê   Re   R�   (    (    s    scripts/common/items/vehicles.pyt   getMaxRepairCost  s    	
 -Lc   	      C   s‰  g  } g  } |  i  } | i |  i d ƒ | i | i d d ƒ | i |  i d ƒ | i | i d d ƒ | i |  i d ƒ | i | i d d ƒ | i |  i d ƒ | i | i d d ƒ xy t	 |  i
 | i
 ƒ D]b \ \ } } } | i | d ƒ | i | d d ƒ | i | d ƒ | i | d d d ƒ qÛ Wg  } x2 |  i D]' } | d  j	 o | i | i ƒ qQqQW| | | f S(   NRa   i    RS   (   Rd   Rµ   R   R   R\   Rš   R]   R   R^   t   zipRW   R=   RT   Ra   (	   R`   t   defCompst	   instCompsRd   Re   R�   RW   t
   optDevicesRÍ   (    (    s    scripts/common/items/vehicles.pyt
   getDevices"  s.    	 
 c         C   sZ   |  i  d |  i d g } x9 |  i D]. \ } } | i | d ƒ | i | d ƒ q$ W| S(   Nt	   hitTester(   R   R¼   RW   Rµ   (   R`   t
   hitTestersRe   R�   (    (    s    scripts/common/items/vehicles.pyt   getHitTestersD  s    
 c         C   sl  t  ƒ  } xR |  i i i ƒ  D]> } x5 | D]- \ } } } | p | i | i ƒ  ƒ q) q) Wq W|  i d d  j	 o¬ |  i d d d  j	 o< |  i d d \ } } | p | i |  i | ƒ ƒ qÆ n |  i d d d  j	 o< |  i d d \ } } | p | i |  i | ƒ ƒ qqn x¹|  i	 D]®\ } } xT d D]L } | | d  j	 o5 | | \ } } } | p | i | i ƒ  ƒ q‡q;q;WxH| d D]<}	 t
 i |	 d d }
 |
 d p|
 d	 \ } } } | i | ƒ | i | ƒ | i | i ƒ  ƒ x- t D]% } | i |
 | d
 d i ƒ  ƒ qW| i |
 d d i ƒ  ƒ | i |
 d d i ƒ  ƒ | i |
 d d i ƒ  ƒ | i |
 d d i ƒ  ƒ | i |
 d d i ƒ  ƒ | i |
 d d i ƒ  ƒ q–q–Wq(W|  i i d  j ou xG |  i d D]8 } | i d ƒ d j o | i |  i d | ƒ qûqûWx( |  i D] } | i | i ƒ  ƒ qAWn t | ƒ S(   Nt   effectst   dustt   mudt
   groundWaveRm   t   shellt   effectsIndext   prereqst
   projectilet   Hiti   t   shallowWaterHitt   deepWaterHitt   armorResistedt   armorRicochett   armorHitt   armorCriticalHitt   exhaustt   pixieiÿÿÿÿ(   s   effectsRþ   (   t   setRd   Rû   t   valuest   updatet   prerequisitesR   RT   t$   _VehicleDescr__getChassisEffectNamesRW   R;   t   shotEffectst   addR   t   _prereqsR¼   t   findt   extrasRÈ   (   R`   R  t   effGroupt   stagesRû   t   readyPrereqsRË   R�   t   tagNamet	   shotDescrt   effectsDescrt   projectileModelt   projectileOwnShotModelt   materialNamet   keyR,   (    (    s    scripts/common/items/vehicles.pyR  O  sd    	  "
    #'  
 c         C   sÍ  | p d  Sx[ |  i  i i ƒ  D]G } x> | D]6 \ } } } | p  | i t | | i ƒ  ƒ ƒ q, q, Wq W|  i d d  j	 o¾ |  i d d d  j	 oE |  i d d \ } } | p# | i t | |  i | ƒ ƒ ƒ qÛ n |  i d d d  j	 oE |  i d d \ } } | p# | i t | |  i | ƒ ƒ ƒ q8q<n xì|  i	 D]á\ } } | d \ } } } | p  | i t | | i ƒ  ƒ ƒ n x˜| d D]Œ} t
 i | d d }	 |	 d } | p`|	 d \ }
 } } | i t | |
 | f ƒ ƒ | i t | | i ƒ  ƒ ƒ x6 t D]. } | i t | |	 | d	 d
 i ƒ  ƒ ƒ qW| i t | |	 d d
 i ƒ  ƒ ƒ | i t | |	 d d
 i ƒ  ƒ ƒ | i t | |	 d d
 i ƒ  ƒ ƒ | i t | |	 d d
 i ƒ  ƒ ƒ | i t | |	 d d
 i ƒ  ƒ ƒ | i t | |	 d d
 i ƒ  ƒ ƒ q—q—WqFW|  i  i d  j o‹ g  } |  i d i ƒ  D]- \ } } | i d ƒ d j o | | qVqV~ } x! |  i D] } | | i ƒ  7} q–Wt | | ƒ |  i  _ n d  S(   NRû   Rü   Rý   Rm   Rÿ   R   R  R  R  i   R  R  R  R  R  R	  R
  R  iÿÿÿÿ(   Rd   Rû   R  R  t   _extractNeededPrereqsR  R   RT   R  RW   R;   R  R   R  R¼   RX   R  R  (   R`   R  R  R  Rû   R  RË   R�   R  R  R  R  R  t   _[1]R  t   valuet   resourceNamesR,   (    (    s    scripts/common/items/vehicles.pyt   keepPrereqsŒ  sl      (!%
   
 	#						'N
 c         C   s`   g  } xS | i  ƒ  D]E } t | t ƒ o" x, | D] } | i | ƒ q0 Wq | i | ƒ q W| S(   N(   R  t
   isinstanceRÈ   Rµ   (   R`   t   effectGroupt   retRs   t   s(    (    s    scripts/common/items/vehicles.pyt   __getChassisEffectNamesÎ  s      c         C   së   |  i  | \ } } t | d | ƒ } | d  j o\ | |  i d d j oD xA |  i i  | D]+ } t | d | ƒ } | d  j	 o Pq\ q\ Wn | d  j o
 t ‚ n | | f |  i  | <|  i ƒ  |  i | j o | |  _ n | d f S(   NRS   Rº   R»   Ra   (	   RW   R¡   RT   R¼   Rd   t   KeyErrorR³   Rh   R´   (   R`   Rª   Rj   Re   R·   R¬   (    (    s    scripts/common/items/vehicles.pyt   __installGunÙ  s    % 

c         C   sv  | } t  i } y=| d | d  ƒ \ } } } } } }	 | d @t i d j p t ‚ | d } | d ?d @}
 t i |
 | ƒ } t i |
 ƒ } | |  _ | i	 |  _	 | i
 |  _
 t p t o | i |  _ | i |  _ n | i |  _ t | i | ƒ |  _ t | i | ƒ |  _ t | i | ƒ |  _ t | i |	 ƒ |  _ g  } xv t t | i ƒ ƒ D]_ } | d | d  ƒ \ } } | d } t | i | | ƒ } | i | t | d | ƒ f ƒ qVW| |  _ d |  _ t | d ƒ } | d	 } | d @} g  } t t ƒ D] } | d  q ~ |  _  t d	 } xa | oY | d	 @o6 t i  ƒ  | d
 | d  ƒ d |  i  | <| d } n | d	 L} | d	 8} q&W| d @p | i! |  _" t# |  _$ nŽt | d ƒ } | d	 } | d @p | i! |  _" n‘ d  d  d  d  g } xl t% d ƒ D]^ } | d	 | >@o< t& | d  ƒ | | <t i" ƒ  d	 | | d | d } qÿ| i' | | <qÿWt( | ƒ |  _" | d @p t# |  _$ n± d  d  d  d  g } xŒ t% d ƒ D]~ } | d	 | d >@o[ t& | d  ƒ t | d ƒ f | | <| d | | d | d | | d | d } q§t) | | <q§Wt( | ƒ |  _$ | d @p d  |  _* n/ t | d ƒ |  _* | d	 } t i+ ƒ  |  i* | d @p t, |  _- | p t ‚ n� t. t, ƒ } x~ | ov t& | d  ƒ } | d } | d | d d } | | d d  j	 o# t/ d |
 | d | | d ƒ n | | | <q´Wt( | ƒ |  _- |  i0 ƒ  Wn# t1 j
 o t2 d | ƒ ‚  n Xd  S(   Ns   <2B4Hi
   i   R   i   s   <2HRS   i    i   s   <Hi   i   i   ið   RŽ   R�   i   i   Rr   R*   s   Second camouflage of same kinds%   (compact descriptor to XML mismatch?)i    i@   i€   (3   RZ   t   unpackRX   RY   RU   R;   R   RE   Rd   t   namet   levelR   R   R  t
   extrasDictR¼   R²   R   R\   R   R]   Rš   R^   R   RA   RB   RW   Rµ   R´   t   ordRØ   RT   R=   t   _defEmblemsR@   t   _EMPTY_INSCRIPTIONSR�   t   ranget   _unpackIDAndDurationt
   _defEmblemt   tuplet   _EMPTY_INSCRIPTIONR†   R?   Rw   Rr   RÈ   t   LOG_WARNINGR³   Ry   t	   LOG_ERROR(   R`   Ra   R€   R,  Rf   RJ   RÜ   RÝ   RÞ   Rß   RI   Rd   RE   RW   Rä   R©   Rª   R   Ræ   Rá   R!  t	   positionst   slotsRå   (    (    s    scripts/common/items/vehicles.pyt   __initFromCompactDescrï  s¶    	%
	 
$		

*
 (

  %
	 
#c         C   só   |  i  d } |  i d |  i  d |  i d |  i d |  i d } x- |  i D]" \ } } | | d | d 7} qP Wd } d } xX |  i D]M } | d  j	 o: | i |  ƒ \ } }	 }
 | | 7} | |	 7} | |
 7} qŒ qŒ W| d | | | f S(   Nt   maxLoadR¯   g        g      ð?(	   R   R¼   R   Rš   R   RW   R=   RT   t   weightOnVehicle(   R`   R°   R¯   Re   R�   t   vehWeightFractiont   vehWeightAdditionRÍ   t   fractiont   additiont   maxWeightChange(    (    s    scripts/common/items/vehicles.pyt   __computeWeightl  s    9
 
 

c         C   s?   x8 |  i  D]- } | d  j	 o | i |  ƒ d o t Sq
 Wt S(   Ni    (   R=   RT   RÉ   R<   RP   (   R`   RÍ   (    (    s    scripts/common/items/vehicles.pyt!   __haveIncompatibleOptionalDevices�  s
    
 "	c   #      C   s  d  |  _ d  |  _ |  i } |  i } |  i d |  _ x* |  i D] \ } } |  i | d 7_ q> Wt p t	 p t
 oÜ | i } t i d } t i d i |  i i d  ƒ } | o | n | |  i | d } | | |  i d | d | |  i d | d | |  i d | d | | d | d	 | |  i d | d
 | i |  _ n t p t o( t | d |  i d | d ƒ |  _ n t p t p t
 o|  i ƒ  \ }	 }
 | d d } h |	 d 6|  i d d 6| d d 6| d d 6| d 6| d d 6|  i i d 6| d d 6| d d 6| d d 6| d d 6|  _ h |
 d 6d d 6d d 6d d 6d d  6d d! 6d d" 6d d# 6d d$ 6d d% 6d d& 6d d' 6|  _ x/ |  i D]$ } | d  j	 o | i |  ƒ q£q£W|  i } | i d | d | i d d | i d d | i  d d } x7 | i D], } | | d d | d d( d d 7} q W| d d } | i d d |	 | | d) | } | d | | d d } | d p? | | |	 | d | 8} | d* j o t! d+ | i ‚ qçn | d, d  j	 o t" | | d, ƒ } n | | d, <| | d- <t p t# ol | i$ \ } } x5 |  i D]* \ } } | d. } | | 9} | | 9} qKWt" | d ƒ t" | d ƒ f |  _$ q¢n t of|  i d } |  i d i% \ } } } |  i d/ d } t& | i' | i' |  i d i% d0 i' ƒ } | |  i d1 } | i' | i' d2 } t( d* | | i) ƒ } t( d* | | i) ƒ } | i) | i) d2 }  t( | i* | i' |  ƒ }! t( | i* | i' |  ƒ }" t( d* | i' | d* ƒ | | | | | | | |! | |" f |  _+ t( d | i' | d ƒ |  _, |  i d1 |  _- n d  S(3   NRï   t   balanceModulesWeightMultiplierst   balanceByVehicleModuleR   R.  R   R   R   R   R   Rø   t   hullPositiont   topRightCarryingPointi    R¯   t   powert   enginePowert   specificFrictiont   minPlaneNormalYt   trackCenterOffsett   rotationIsAroundCentert   speedLimitst   navmeshGirtht   carryingTrianglest
   brakeForcet   terrainResistanceR°   g      ð?t   repairSpeedFactort   additiveShotDispersionFactort   antifragmentationLiningFactort   circularVisionRadiusFactort   gunReloadTimeFactort   gunAimingTimeFactort   ammoBayHealthFactort   engineHealthFactort   chassisHealthFactort   fuelTankHealthFactort   crewLevelIncreaseRS   t   rotationSpeedg        s    wrong parameters of rotation of t   rotationSpeedLimitt   rotationEnergyt   invisibilityFactort   turretPositionsi   t   gunPositiong       @(.   RT   t	   miscAttrst   physicsRd   R   R¼   Rï   RW   R   R   R   t   balanceByComponentLevelsR;   t   commonConfigt   getR-  R.  R   R   R   R   t   balanceByClasst   balanceWeightR   R   Rø   R¥   RP  R=   t   updateVehicleDescrAttrsR\   R]   R^   Ry   t   minR
   t   invisibilityt   bboxt   maxt   yR   t   zt   xt   visibilityCheckPointst   observerPosOnChassist   observerPosOnTurret(#   R`   Rd   R   Re   R�   t   bplt   modMult   vmwt   vehicleBalanceR¯   R°   RN  RÍ   Rg  t	   defWeightt
   turretListt   defResistanceRb  Ra  t   invisibility1t   invisibility2t   factort   hullPost   hullBboxMint   hullBboxMaxRË   t   turretPosOnHullt   turretLocalTopYt   gunPosOnHullt   hullLocalCenterYt   hullLocalPt1t   hullLocalPt2t   hullLocalCenterZt   hullLocalPt3t   hullLocalPt4(    (    s    scripts/common/items/vehicles.pyt   __updateAttributesŠ  sÄ    				
 	#\%
 	B
 *%


 

)!N('   R$   R%   RT   Rg   t"   _VehicleDescr__set_activeTurretPost   propertyR´   t%   _VehicleDescr__set_activeGunShotIndexRi   t   _VehicleDescr__get_camouflaget   _VehicleDescr__set_camouflaget
   camouflaget   _VehicleDescr__set_hornIDt   hornIDR‰   R�   R“   Rž   R±   R¹   RÀ   RÆ   RÑ   RÔ   RÕ   RÖ   Rç   Rë   Rò   R÷   Rú   R  R$  R  RÁ   R_   R¥   R¤   R³   (    (    (    s    scripts/common/items/vehicles.pyRQ   0  sF   						+	!	 "7#C.	+				„			"		=	B			}			t   VehicleTypec           B   s#   e  Z d  „  Z d „  Z d „  Z RS(   c         C   s9  | d |  _  | | d f |  _ | d |  _ t i | } t i | ƒ } | d  j o t i	 d  | d ƒ n d  | f } | d |  _
 | d |  _ t t i | | d ƒ t t i | | d ƒ f |  _ t i | | d	 ƒ |  _ t p t o² t i | | d
 ƒ |  _ t i | | d ƒ |  _ t i | | d ƒ |  _ t i | | d ƒ |  _ t i | | d ƒ |  _ t |  _ t i | | d ƒ t i | | d ƒ f |  _ n t | | d ƒ |  _ t p t o | d |  _  | d |  _! n t" i# } t p t$ oC | d |  _% | d |  _& | d |  _' t( |  i |  i& ƒ |  _) n t p t p t o9 t* t+ |  i
 @ƒ d } | d | |  _, | d |  _- n t p t o+ | d |  _. | d |  _/ | d |  _0 n t oÌ | d d |  _1 | d d }	 h |	 d  d! d  6|	 d" d! d" 6|	 d# d! d# 6|  _2 t3 | | d$ | d% ƒ |  _4 t5 | | d& t6 ƒ \ |  _7 |  _8 t9 | | d' ƒ |  _: t i | | d( ƒ |  _; d  |  _< n t$ p t oH | d d }	 h |	 d  d d  6|	 d" d d" 6|	 d# d d# 6|  _= n t i> | | d) ƒ }
 t" i? ƒ  d* i@ |
 ƒ |  _A |  iA d  j o t i	 | d) d+ |
 ƒ n |  iA tB d f |  _C |  iC |  iC |  iC |  iC f |  _D t i | | d, ƒ |  _E tF | | d- ƒ \ |  _G |  _H |  _I g  } tJ | | d. | ƒ |  _K tL | d  f t iM | | d  ƒ ƒ |  _N tO | | d/ | tP tQ t" iR | ƒ t" iS | ƒ | ƒ	 |  _R tO | | d0 | tT tQ t" iU | ƒ t" iV | ƒ | ƒ	 |  _U tO | | d1 | tW tQ t" iX | ƒ t" iY | ƒ | ƒ	 |  _X tO | | d2 | tZ tQ t" i[ | ƒ t" i\ | ƒ | ƒ	 |  _[ g  } xn t] t^ |  iN d3 ƒ ƒ D]S } tO | | d4 t_ | ƒ | t` ta t" ib | ƒ t" ic | ƒ | ƒ	 } | id | ƒ qWt* | ƒ |  _b te ƒ  } tf | |  iR ƒ tf | |  iU ƒ tf | |  iX ƒ tf | |  i[ ƒ x@ |  ib D]5 } tf | | ƒ x | D] } tf | | d5 ƒ qÖWq¼W| |  _g |  ih | ƒ |  _i |  ij ƒ  |  _k d  } t il | t6 ƒ d  S(6   NR-  RR   Ra   s   can not open or readR„   R.  s   speedLimits/forwards   speedLimits/backwardRð   t   xpFactort   freeXpFactort   crewXpFactort   creditsFactort   healthBurnPerSecs   invisibility/movings   invisibility/stillt   crewRè   t
   showInShopR  R/  RÏ   i    t   balanceByVehicleClassesRh  t
   userStringt   shortUserStringt   descriptiont
   miscParamst   damageStickersLodDistt   collisionEffectVelocitiesR¼   i   t   trackt   waterContactRû   t   defaultVehicleEffectsR”  s   emblems/lodDists   emblems/alphas   emblems/defaulti   s   unknown emblem '%s's   camouflage/priceFactorR?   t   unlocksR   R\   R]   R^   Rd  RW   RS   (m   R-  RR   Ra   RC   RD   t   ResMgrt   openSectionRT   R   t   raiseWrongXmlR„   R.  t	   KMH_TO_MSt   readPositiveFloatRP  t   readNonNegativeFloatRð   R   R
   R˜  R™  Rš  R›  Rœ  t*   _DEFAULT_HEALTH_BURN_PER_SEC_LOSS_FRACTIONt   healthBurnPerSecLossFractiont   readFractionRo  t	   _readCrewt	   crewRolesR   R   Rè   Rž  R;   Ri  R   R  R/  RÏ   t   _selectCrewExtrast   tankmenR6  t   VEHICLE_CLASS_TAGSRk  Rh  R   R¡  R¢  R¤  t   heavyCollisionEffectVelocitiest   _readVehicleEffectsRû   t   _readCamouflageTilingAndMaskR<   t   camouflageTilingt   camouflageExclusionMaskt   _readLodDistt   emblemsLodDistt   emblemsAlphaR  R¥  t   readNonEmptyStringR@   Rj  RŠ   Rz   R5  R1  t   camouflagePriceFactort   _readVehicleHornst   hornPriceFactort   hornDistanceFactort   hornVolumeFactort   _readUnlocksR©  t	   _readHullt   getSubsectionR¼   t   _readInstallableComponentst   _readChassist   _defaultLocalReaderR   t
   chassisIDst   _readEngineR\   t	   engineIDst   _readFuelTankR]   t   fuelTankIDst
   _readRadioR^   t   radioIDsRA   RB   t   reprt   _readTurrett   _readTurretLocalsRW   t	   turretIDsRµ   R  t   _collectComponentsR¢   t-   _VehicleType__convertAndValidateUnlocksDescrst   unlocksDescrst#   _VehicleType__collectDefaultUnlockst   autounlockedItemst   purge(   R`   RI   t	   basicInfot   xmlPatht   nationt   sectiont   xmlCtxRi  t   classTagt   collisionVelCfgt   defEmblemNameRÙ  t   turretsListRà   RW   t   compactDescrsR   (    (    s    scripts/common/items/vehicles.pyRg   ¸  sò    		!!$'				 		
  	c      
   C   s�  |  i  d } g  } h  } xê| D]â} | d } | d } d  } y| d j o& t i t i | d | ƒ d } n | d j o t i | ƒ | } n | d j o t i | ƒ | } n | d j o t i	 | ƒ | } n | d	 j o t i
 | ƒ | } n | d
 j o t i | ƒ | } n | d j o t i | ƒ | } n Wn0 t j
 o$ t ƒ  t d | |  i f ‚ n Xt | | | ƒ }	 | d j o* |	 |  i j o t d | |  i f ‚ n | i |	 t ƒ  ƒ i | d ƒ | i | d |	 f ƒ q  WxM | i ƒ  D]? } x6 t | ƒ D]( }	 t | t | i |	 d ƒ ƒ | ƒ q&WqWx@ t t | ƒ ƒ D], }
 | |
 } | t | | d ƒ | |
 <qiW| S(   Ni    i   i   R   t   :R”   R˜   R™   R•   R—   R–   s$   wrong name '%s' in <unlocks> of '%s's+   component '%s' in <unlocks> is not for '%s'i   (    (   RR   RT   R9   RV   RC   RD   R;   RÌ  RÖ  t   gunIDsRÎ  RÐ  RÒ  Ry   t   LOG_CURRENT_EXCEPTIONR-  t   makeIntCompactDescrByIDR¢   t
   setdefaultR  R  Rµ   t
   itervaluesR6  t   _collectReqItemsRecursivelyRj  RA   RB   (   R`   t   srcListRI   t   destListt   reqItemsR   R›   t   itemNamet   itemIDRa   Rä   (    (    s    scripts/common/items/vehicles.pyt!   __convertAndValidateUnlocksDescrsm  sR     

&   * 
 c         C   s   g  } | i  |  i d d ƒ | i  |  i d d ƒ | i  |  i d d ƒ | i  |  i d d ƒ x“ t |  i ƒ D]‚ \ } } | d } | i  | d ƒ | i  | d d d ƒ | |  i d d j o* x' | d D] } | i  | d ƒ qÙ Wqv qv W| S(   Ni    Ra   RS   Rº   R»   i   (   Rµ   R   R\   R]   R^   RÙ   RW   R¼   (   R`   t   autounlockst   posIndexRW   R   (    (    s    scripts/common/items/vehicles.pyt   __collectDefaultUnlocks   s     
 (   R$   R%   Rg   RØ  RÚ  (    (    (    s    scripts/common/items/vehicles.pyR—  ³  s   	µ	3R:   c           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 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  e d „  ƒ Z! e d „  ƒ Z" e d  „  ƒ Z# e d! „  ƒ Z$ e d" „  ƒ Z% d# „  Z& d$ „  Z' d% „  Z( RS(&   c          C   sß  h  |  _  d  |  _ g  } t i D] } | d  q  ~ |  _ g  } t i D] } | d  qG ~ |  _ g  } t i D] } | d  qn ~ |  _ g  } t i D] } | d  q• ~ |  _ g  } t i D] } | d  q¼ ~ |  _	 g  } t i D] } | d  qã ~ |  _
 g  } t i D] } | d  q
~ |  _ d  |  _ d  |  _ d  |  _ d  |  _ g  }	 t i D] } |	 d  qU~	 |  _ g  }
 t i D] } |
 d  q|~
 |  _ g  } t i D] } | d  q£~ |  _ g  } t i D] } | d  qÊ~ |  _ g  } t i D] } | d  qñ~ |  _ g  } t i D] } | d  q~ |  _ g  } t i D] } | d  q?~ |  _ g  } t i D] } | d  qf~ |  _ d  |  _ d  |  _ d  |  _ d  |  _ d  |  _ d  |  _ t o d  |  _ d  |  _  d  |  _! n d  S(   N("   t   _Cache__vehiclesRT   t   _Cache__commonConfigRC   RD   t   _Cache__chassist   _Cache__enginest   _Cache__fuelTankst   _Cache__radiost   _Cache__turretst   _Cache__gunst   _Cache__shellst   _Cache__optionalDevicest   _Cache__optionalDeviceIDst   _Cache__equipmentst   _Cache__equipmentIDst   _Cache__chassisIDst   _Cache__engineIDst   _Cache__fuelTankIDst   _Cache__radioIDst   _Cache__turretIDst   _Cache__gunIDst   _Cache__shellIDst   _Cache__customizationt   _Cache__hornst   _Cache__playerEmblemst   _Cache__playerIscriptionst   _Cache__shotEffectst   _Cache__shotEffectsIndexest   _Cache__damageStickersR   t   _Cache__vehicleEffectst   _Cache__gunEffectst   _Cache__chassisEffects(   R`   R!  t   it   _[2]t   _[3]t   _[4]t   _[5]t   _[6]t   _[7]t   _[8]t   _[9]t   _[10]t   _[11]t   _[12]t   _[13]t   _[14]t   _[15](    (    s    scripts/common/items/vehicles.pyRg   ¸  s>    		'''''''				''''''''								c         C   s   d  S(   N(    (   R`   (    (    s    scripts/common/items/vehicles.pyt   clearPrereqsò  s    c      
   C   sõ  h  } | i  d h  ƒ } x+ |  i i ƒ  D] \ } } | d | | <q( W| i  d h  ƒ } xTt t t i ƒ ƒ D]=} | i  | h  ƒ } | i  t h  t ƒ  f ƒ \ } }	 x{ t	 i
 | ƒ i ƒ  D]d \ }
 } t | d ƒ } | d d | d d | i | i f | |
 <| d p |	 i |
 ƒ q½ q½ Wh |  i | ƒ t 6|  i | ƒ t 6|  i | ƒ t 6|  i | ƒ t 6|  i | ƒ t 6|  i | ƒ t 6|  i | ƒ t 6} |  i | | ƒ qn W| i  t i h  ƒ } h |  i  ƒ  t! 6|  i" ƒ  t# 6} |  i | | ƒ | i  d	 h  ƒ } x’ t t t i ƒ ƒ D]{ } | i  | h  ƒ } | i  d
 h  ƒ } |  i$ | i% d
 ƒ o: x7 |  i$ | d
 i ƒ  D] \ } } | d | | <quWqqW| i  d h  ƒ } | i  d h  ƒ } x/ |  i& d i ƒ  D] \ } } | d | | <qÓW| S(   Nt   hornCostt   goldRX   Ra   Rè   i    i   Rž  RE   Rr   t   priceFactorR@   t   groupsi   ('   Rë  R  RX   RA   RB   RC   RD   t   _VEHICLER  R9   RF   t	   iteritemst   getVehicleTypeRÁ  RÃ  R  R   t   _CHASSISRW   t   _TURRETRS   t   _GUNR\   t   _ENGINER]   t
   _FUEL_TANKR^   t   _RADIOt   shellst   _SHELLt    _Cache__addItemListsToNationShopt
   NONE_INDEXR>   t
   _EQUIPMENTR=   t   _OPTIONALDEVICER  t   has_keyR  (   R`   t   cacheR?   R–  R   t   shopt	   nationIdxt
   nationShopt	   vehPricest   vehNotShownt   innationIdxt   vehDescrt   vehTypet	   itemListsRE   t   nationCustomizationRr   RR   R”  Rã   R(  t	   groupNamet	   groupInfo(    (    s    scripts/common/items/vehicles.pyt   getPriceCache  s\      !    c         C   s«   x¤ | i  ƒ  D]– \ } } | i | h  t ƒ  f ƒ \ } } xf | i ƒ  D]X } | i d d ƒ d j o qG n | d | | d <| d p | i | d ƒ qG qG Wq Wd  S(   Nt   statusR×   t   emptyRè   Ra   Rž  (   R*  Rë  R  Rì  Rj  R  (   R`   RB  R<  t   itemTypeIdxt   descriptionst
   itemPricest   itemNotShownR   (    (    s    scripts/common/items/vehicles.pyt   __addItemListsToNationShopU  s     ! c          C   s'  | d } x+ | i  ƒ  D] \ } } | |  i | d <q W| d } xg| i  ƒ  D]Y\ } } t d | ƒ | t i j o1 h |  i t 6|  i t 6} |  i	 | | ƒ qO n t d t
 | t d ƒ ƒ t i | }	 | t \ }
 } xô |
 i  ƒ  D]æ \ } } |	 | } t | d ƒ } | | j o t n t } | d | d | d	 f j p9 | d
 | j p( | i | d j p | i | d j oN | d | d	 f | d <| _ | | d
 <| _ | d | _ | d | _ qî qî Wd } xB | i  ƒ  D]4 \ } } | | t j o t
 | d ƒ n d 7} qëWt d | ƒ h |  i | t 6|  i | t 6|  i | t 6|  i | t 6|  i | t 6|  i | t  6|  i! | t" 6} |  i	 | | ƒ qO W| i# d h  ƒ } x• | d i$ ƒ  D]ƒ \ } } |  i% | i& d d  ƒ } | d  j o qÏn xG | d i$ ƒ  D]5 \ } } | | } | d | j o | | d <qqWqÏW| i# d h  ƒ } | i# d h  ƒ } x¦ | i$ ƒ  D]˜ \ } } |  i( d i& | d  ƒ } | d  j o q‡n | d | j oN t d | | d | f ƒ | \ } } } } | | | | f |  i( d | <q‡q‡Wd  S(   NR%  R&  RX   s   Updating nation s   Start updating vehicles, count=i    Ra   Rè   i   Rž  i   i   s   Start updating items, count=RE   Rr   R'  R@   R(  s5   Group of emblems updated: name=%s, priceFactor:%s->%s()   RX   R  t   LOG_DZRC   R5  R  R6  R   R7  t%   _Cache__updateItemListsFromNationShopRB   R)  R9   t   _VehicleList__nationsR+  RP   R<   RÁ  RÃ  Rè   Rž  Rù  R,  Rý  R-  Rþ  R.  Rú  R/  Rû  R0  Rü  R1  Rÿ  R3  Rë  R*  R  Rj  RT   R  (    R`   R9  R?   R–  Rè   R:  R;  R<  RB  t   vehListR=  R>  t   inNationIdxt   vehInfoRA  Rž  t   countt   itemTypeRX   RE   RC  Rr   RR   R'  R”  Rã   R(  RD  RE  t	   emblemIDsRË   R   (    (    s    scripts/common/items/vehicles.pyt   setPriceCachec  s„    
 
 
 
0( ,  
 %c         C   s  x| i  ƒ  D]ÿ \ } } | d  j o q n | | \ } } xÌ | i ƒ  D]¾ \ } } | d }	 | i |	 d  ƒ }
 |
 d  j o qJ n |	 | j o t n t } | d |
 j p | d | j oF | t j p | t j o | i |
 | ƒ q|
 | d <| | d <qJ qJ Wq Wd  S(   NRa   Rè   Rž  (	   R*  RT   RX   Rj  RP   R<   R6  R7  t   updatePrice(   R`   R<  RB  RI  RX   RK  RL  RR  Rå   t	   compDescrRè   Rž  (    (    s    scripts/common/items/vehicles.pyt   __updateItemListsFromNationShop´  s"      
"
c   	      C   sš   | | f } |  i  i | ƒ } | o | St i | } t i | ƒ | } | d i d ƒ d } t | d | d } t | | | ƒ } | |  i  | <| S(   NR-  Rç  i   t   /s   .xml(	   R÷  Rj  RC   RD   R9   RF   t   splitt   _VEHICLE_TYPE_XML_PATHR—  (	   R`   RI   RJ   RR   t   vtRß  RÝ  t   xmlNameRÞ  (    (    s    scripts/common/items/vehicles.pyR   Í  s    c         C   s   |  i  | d ƒ S(   NR   (   t   _Cache__getList(   R`   RI   (    (    s    scripts/common/items/vehicles.pyR   ß  s    c         C   s   |  i  | d ƒ S(   NRÌ  (   R`  (   R`   RI   (    (    s    scripts/common/items/vehicles.pyRÌ  ä  s    c         C   s   |  i  | d ƒ S(   NR\   (   R`  (   R`   RI   (    (    s    scripts/common/items/vehicles.pyR\   é  s    c         C   s   |  i  | d ƒ S(   NRÎ  (   R`  (   R`   RI   (    (    s    scripts/common/items/vehicles.pyRÎ  î  s    c         C   s   |  i  | d ƒ S(   NR]   (   R`  (   R`   RI   (    (    s    scripts/common/items/vehicles.pyR]   ó  s    c         C   s   |  i  | d ƒ S(   NRÐ  (   R`  (   R`   RI   (    (    s    scripts/common/items/vehicles.pyRÐ  ø  s    c         C   s   |  i  | d ƒ S(   NR^   (   R`  (   R`   RI   (    (    s    scripts/common/items/vehicles.pyR^   ý  s    c         C   s   |  i  | d ƒ S(   NRÒ  (   R`  (   R`   RI   (    (    s    scripts/common/items/vehicles.pyRÒ  	  s    c         C   s   |  i  | d ƒ S(   NRW   (   R`  (   R`   RI   (    (    s    scripts/common/items/vehicles.pyRW   	  s    c         C   s   |  i  | d ƒ S(   NRÖ  (   R`  (   R`   RI   (    (    s    scripts/common/items/vehicles.pyRÖ  	  s    c         C   s   |  i  | d ƒ S(   NRS   (   R`  (   R`   RI   (    (    s    scripts/common/items/vehicles.pyRS   	  s    c         C   s   |  i  | d ƒ S(   NRè  (   R`  (   R`   RI   (    (    s    scripts/common/items/vehicles.pyRè  	  s    c         C   s   |  i  | d ƒ S(   NR2  (   R`  (   R`   RI   (    (    s    scripts/common/items/vehicles.pyR2  	  s    c         C   s   |  i  | d ƒ S(   Nt   shellIDs(   R`  (   R`   RI   (    (    s    scripts/common/items/vehicles.pyRa   	  s    c         C   sm   |  i  | } | d  j oO t i | } | t i j o
 h  } n t t | d | ƒ } | |  i  | <n | S(   Ns   /customization.xml(   R  RT   RC   RD   t   AVAILABLE_NAMESt   _readCustomizationR]  (   R`   RI   R   t
   nationName(    (    s    scripts/common/items/vehicles.pyRE   K	  s    
	c         C   s.   |  i  d  j o t t d ƒ |  _  n |  i  S(   Ns   common/horns.xml(   R  RT   t
   _readHornsR]  (   R`   (    (    s    scripts/common/items/vehicles.pyR?   e	  s    c         C   s.   |  i  d  j o t t d ƒ |  _  n |  i  S(   Ns   common/player_emblems.xml(   R  RT   t   _readPlayerEmblemsR]  (   R`   (    (    s    scripts/common/items/vehicles.pyR@   z	  s    c         C   sG   |  i  d  j o0 d d k l } t t d ƒ \ |  _  |  _ n |  i  S(   Niÿÿÿÿ(   t	   artefactss   common/optional_devices.xml(   R   RT   RX   Rg  t   _readArtefactsR]  R  (   R`   Rg  (    (    s    scripts/common/items/vehicles.pyR=   ‚	  s
    c         C   sG   |  i  d  j o0 d d k l } t t d ƒ \ |  _ |  _  n |  i  S(   Niÿÿÿÿ(   Rg  s   common/optional_devices.xml(   R  RT   RX   Rg  Rh  R]  R   (   R`   Rg  (    (    s    scripts/common/items/vehicles.pyt   optionalDeviceIDs‹	  s
    c         C   sG   |  i  d  j o0 d d k l } t t d ƒ \ |  _  |  _ n |  i  S(   Niÿÿÿÿ(   Rg  s   common/equipments.xml(   R  RT   RX   Rg  Rh  R]  R  (   R`   Rg  (    (    s    scripts/common/items/vehicles.pyR>   ”	  s
    c         C   sG   |  i  d  j o0 d d k l } t t d ƒ \ |  _ |  _  n |  i  S(   Niÿÿÿÿ(   Rg  s   common/equipments.xml(   R  RT   RX   Rg  Rh  R]  R  (   R`   Rg  (    (    s    scripts/common/items/vehicles.pyt   equipmentIDs�	  s
    c         C   s7   |  i  d  j o  t t d ƒ \ |  _ |  _  n |  i  S(   Ns   common/shot_effects.xml(   R  RT   t   _readShotEffectGroupsR]  R  (   R`   (    (    s    scripts/common/items/vehicles.pyR  »	  s    c         C   s7   |  i  d  j o  t t d ƒ \ |  _ |  _  n |  i S(   Ns   common/shot_effects.xml(   R  RT   Rk  R]  R  (   R`   (    (    s    scripts/common/items/vehicles.pyt   shotEffectsIndexesÆ	  s    c         C   s.   |  i  d  j o t t d ƒ |  _  n |  i  S(   Ns   common/damage_stickers.xml(   R  RT   t   _readDamageStickersR]  (   R`   (    (    s    scripts/common/items/vehicles.pyt   damageStickersÙ	  s    c         C   s¾   |  i  d  j o§ t d } t i | ƒ } | d  j o t i d  | d ƒ n t d  | f | ƒ |  _  |  i  d d } | d t _	 | d t _
 | d t _ d  } t i | t ƒ n |  i  S(   Ns   common/vehicle.xmls   can not open or readR£  t   hornCooldownt   windowt   clientWindowExpansiont
   maxSignals(   Rø  RT   R]  Rª  R«  R   R¬  t   _readCommonConfigR#   R&   R'   R(   RÜ  R<   (   R`   t   commonXmlPatht	   commonXmlt   hornCooldownParams(    (    s    scripts/common/items/vehicles.pyRi  ÿ	  s    
c         C   s1   |  i  d  j o t t d t ƒ |  _  n |  i  S(   Ns   common/vehicle_effects.xml(   R  RT   t   _readEffectGroupsR]  R<   (   R`   (    (    s    scripts/common/items/vehicles.pyt   _vehicleEffects
  s    c         C   s.   |  i  d  j o t t d ƒ |  _  n |  i  S(   Ns   common/gun_effects.xml(   R  RT   Rw  R]  (   R`   (    (    s    scripts/common/items/vehicles.pyt   _gunEffects#
  s    c         C   s.   |  i  d  j o t t d ƒ |  _  n |  i  S(   Ns   common/chassis_effects.xml(   R  RT   t   _readChassisEffectGroupsR]  (   R`   (    (    s    scripts/common/items/vehicles.pyt   _chassisEffects-
  s    c         C   s=   t  |  d | ƒ } | | d  j o |  i | ƒ n | | S(   Nt   _Cache__(   RÂ   RT   t   _Cache__readNation(   R`   RI   t   listNameRC   (    (    s    scripts/common/items/vehicles.pyt	   __getList5
  s    c         C   s,  t  i | } | t  i j oÈ h  } | | |  i | <|  i | <| | |  i | <|  i | <| | |  i | <|  i | <| | |  i	 | <|  i
 | <| | |  i | <|  i | <| | |  i | <|  i | <| | |  i | <|  i | <d  St | d } t | d t | d ƒ \ |  i | <|  i | <t | d t | d ƒ \ |  i | <|  i | <t | d t | d ƒ \ |  i | <|  i | <t | d t | d	 ƒ \ |  i	 | <|  i
 | <t | d
 | ƒ \ |  i | <|  i | <t | d t | d ƒ \ |  i | <|  i | <t | d t | d ƒ \ |  i | <|  i | <d  S(   Ns   /components/s   chassis.xmlR”   s   engines.xmlR•   s   fuelTanks.xmlR—   s
   radios.xmlR–   s
   shells.xmls   guns.xmlR™   s   turrets.xmlR˜   (   RC   RD   Rb  Rù  R  Rú  R  Rû  R  Rü  R  Rý  R  Rþ  R	  Rÿ  R
  R]  t   _readComponentsRÊ  RÍ  RÏ  RÑ  t   _readShellst   _readGunRÔ  (   R`   RI   Rd  t	   emptyDictt   compsXmlPath(    (    s    scripts/common/items/vehicles.pyt   __readNation=
  s&    ----'-c         C   s   t  d „  | i ƒ  Dƒ ƒ S(   Nc         s   s'   x  |  ] } | d  | d f Vq Wd S(   R-  RR   N(    (   t   .0t   d(    (    s    scripts/common/items/vehicles.pys	   <genexpr>_
  s   	 (   t   dictRì  (   R`   t   descrs(    (    s    scripts/common/items/vehicles.pyt   __idsFromNames^
  s    ()   R$   R%   Rg   R$  RF  R4  RW  RO  R   R   RÌ  R\   RÎ  R]   RÐ  R^   RÒ  RW   RÖ  RS   Rè  R2  Ra  RE   R?   R@   R=   Ri  R>   Rj  R�  R  Rl  Rn  Ri  Rx  Ry  R{  R`  R}  t   _Cache__idsFromNames(    (    (    s    scripts/common/items/vehicles.pyR:   ¶  sL   	:	&	=		Q																+										&
		!R8   c           B   s,   e  Z d  „  Z d „  Z d „  Z d „  Z RS(   c            s  h  |  _  g  } xá t i D]Ö } | t i j o | i h  ƒ q n t | d } t i | ƒ } | d  j o t	 i
 d  | d ƒ n |  i | | | ƒ } | i | ƒ t i | ‰  |  i  i t ‡  f d †  | i ƒ  Dƒ ƒ ƒ t i | t ƒ q Wt | ƒ |  _ d  S(   Ns	   /list.xmls   can not open or readc         3   s-   x& |  ] } | d  ˆ  | d f f Vq Wd S(   R-  RR   N(    (   R†  R‡  (   RI   (    s    scripts/common/items/vehicles.pys	   <genexpr>
  s   	 (   t   _VehicleList__idsRC   RD   Rb  Rµ   R]  Rª  R«  RT   R   R¬  t   _VehicleList__readVehicleListt   INDICESR  Rˆ  Rì  RÜ  R<   R6  RP  (   R`   RÈ   Rß  RÞ  Rà  R‰  (    (   RI   s    scripts/common/items/vehicles.pyRg   j
  s$    	
 	#c         C   s   |  i  | S(   N(   RP  (   R`   RI   (    (    s    scripts/common/items/vehicles.pyRF   “
  s    c         C   s4   |  i  i | ƒ } | d  j o t d | ‚ n | S(   Ns   unknown vehicle type name '%s'(   RŒ  Rj  RT   Ry   (   R`   R-  t   ids(    (    s    scripts/common/items/vehicles.pyRV   ˜
  s    c         C   s]  h  } h  } xJ| i  ƒ  D]<\ } } d  | d | f } | | j o t i | d d ƒ n t i | | d d d ƒ }	 |	 | j o t i | d d ƒ n |	 | | <h | d | d	 6|	 d 6t d
 t i | |	 ƒ d 6t | | ƒ d 6| |	 <t	 | | d d
 ƒ }
 d t
 |
 t @ƒ j o t i | d d ƒ n |
 | |	 d <t p t o� t i | i d ƒ ƒ | |	 d <t i | i d ƒ ƒ | |	 d <t i | i d ƒ ƒ | |	 d <| |	 d p | |	 d | |	 d <qÜn t i | | d ƒ } | d o | |	 d c t d ƒ O<n t p t o- | | |	 d <| i d t ƒ | |	 d <q q W| S(   NR[  R×   s   vehicle type name is not uniqueRR   i    iÿ   s   is not uniqueRç  R-  R   Ra   R.  R„   i   s+   vehicle class tag is missing or is multipleR   R¢  R¡  Rè   t   premiumt	   notInShopRž  (   R�  (   RX   RT   R   R¬  t   readIntRê  RC   RŽ  t
   _readLevelt	   _readTagsRB   R·  R   R   R   t
   makeStringt
   readStringt	   readPricet	   frozensetR   t   readBoolRP   (   R`   Rß  Rà  RÞ  RÐ   R�  t   vnamet   vsectiont   ctxRR   R„   Rè   (    (    s    scripts/common/items/vehicles.pyt   __readVehicleListŸ
  sB     
   #(   R$   R%   Rg   RF   RV   R�  (    (    (    s    scripts/common/items/vehicles.pyR8   f
  s   	)		c         C   s!   t  i |  | d >} | d >| S(   Ni   i   (   RX   RY   (   R›   RI   Rò  Rf   (    (    s    scripts/common/items/vehicles.pyRê  Ø
  s    c         C   s!   |  d @|  d ?d @|  d ?d @f S(   Ni   i   i   iÿÿ  (    (   Ra   (    (    s    scripts/common/items/vehicles.pyRŸ   ä
  s    c         C   s1   t  i d |  d d !ƒ \ } } | d ?d @| f S(   Nt   2Bi    i   i   i   (   RZ   R,  (   Ra   Rf   RJ   (    (    s    scripts/common/items/vehicles.pyt   parseVehicleCompactDescrð
  s    c         C   sy   yH |  d @} |  d ?d @} |  d ?d @} t  i | } t | | | ƒ SWn* t j
 o t ƒ  t d |  ƒ ‚  n Xd  S(   Ni   i   i   iÿÿ  s&   (compact description to XML mismatch?)(   RX   R    t   _dictDescrGettersRy   Ré  R9  (   Ra   R¨   RI   t
   compTypeIDR›   (    (    s    scripts/common/items/vehicles.pyt   getDictDescrú
  s    
c         C   s   t  i |  ƒ | S(    (   R;   R2  (   RI   R¡  (    (    s    scripts/common/items/vehicles.pyRl     s    Rÿ   c         C   s   t  i ƒ  | S(    (   R;   R>   (   RI   R¡  (    (    s    scripts/common/items/vehicles.pyRl     s    t	   equipmentc         C   s   t  i ƒ  | S(    (   R;   R=   (   RI   R¡  (    (    s    scripts/common/items/vehicles.pyRl     s    RÇ   c         C   s   t  i |  ƒ | S(    (   R;   RS   (   RI   R¡  (    (    s    scripts/common/items/vehicles.pyRl     s    R™   c         C   s   t  i |  ƒ | S(    (   R;   RW   (   RI   R¡  (    (    s    scripts/common/items/vehicles.pyRl     s    R˜   c         C   s   t  i |  ƒ | S(    (   R;   R\   (   RI   R¡  (    (    s    scripts/common/items/vehicles.pyRl     s    R•   c         C   s   t  i |  ƒ | S(    (   R;   R^   (   RI   R¡  (    (    s    scripts/common/items/vehicles.pyRl     s    R–   c         C   s   t  i |  ƒ | S(    (   R;   R   (   RI   R¡  (    (    s    scripts/common/items/vehicles.pyRl     s    R”   c         C   s   t  i |  ƒ | S(    (   R;   R]   (   RI   R¡  (    (    s    scripts/common/items/vehicles.pyRl     s    R—   c         C   sp   t  |  ƒ t j o  |  d ?d @} |  d ?d @} n. t i d |  d d !ƒ \ } } | d ?d @} t i | | ƒ S(   Ni   i   i   iÿÿ  Rž  i    i   (   Rd   R   RZ   R,  R;   R   (   Ra   RI   RJ   Rf   (    (    s    scripts/common/items/vehicles.pyR+    s    c         C   so   t  |  ƒ \ } } } | t i d j p t ‚ | | f } x, | d D]  } | d d | j o t SqG Wt S(   NRÿ   Rm   RR   (   RŸ   RX   RY   RU   R<   RP   (   t   shellCompactDescrR�   R¨   RI   t   shellTypeIDt   shellIDR  (    (    s    scripts/common/items/vehicles.pyt   isShellSuitableForGun,  s     	c         C   sv   g  } x4 |  d D]( } | i  | d d ƒ | i  d ƒ q W| p. | i  |  d d d d ƒ | i  d ƒ n | S(   NRm   Rÿ   Ra   i    (   Rµ   (   R�   t   ammoRn   (    (    s    scripts/common/items/vehicles.pyt   getEmptyAmmoForGun:  s     c         C   s   t  |  d  ƒ S(   N(   t   _getAmmoForGunRT   (   R�   (    (    s    scripts/common/items/vehicles.pyt   getDefaultAmmoForGunK  s    c         C   s5   t  |  d ƒ } | o d | n d } t |  | ƒ S(   NRm   g      ð?(   RB   Rª  (   R�   Rm   t   defaultPortion(    (    s    scripts/common/items/vehicles.pyt   getUniformAmmoForGunR  s    c   	      C   sú   g  } |  d } |  d d } d } xš |  d D]Ž } | d  j o | d } n | } t | | | d ƒ | } | | | j o | | } n | | 7} | i | d d ƒ | i | ƒ q/ W| p. | i |  d d d d ƒ | i | ƒ n | S(	   Nt   maxAmmot   clipi    Rm   R¬  g      à?Rÿ   Ra   (   RT   Rx   Rµ   (	   R�   R¬  R¨  t   maxCountt   clipSizet	   currCountRn   t   portiont	   shotCount(    (    s    scripts/common/items/vehicles.pyRª  X  s&    
 
c          C   s–   h  }  x‰ t  t t i ƒ ƒ D]r } xi t i | ƒ i ƒ  D]R } t i | | ƒ } x7 | i	 D], } | d } |  i
 | t ƒ  ƒ i | ƒ qZ Wq8 Wq W|  S(   Ni   (   RA   RB   RC   RD   R9   RF   RG   R;   R   RÙ  Rë  R  R  (   RÐ   RI   RJ   t   vehicleTypeR   R€   (    (    s    scripts/common/items/vehicles.pyt   getUnlocksSourcesw  s      
 
(c      	   C   sú  t  i |  ƒ } | d  j o t i d  |  d ƒ n d  |  f } h  } h  } xÂ t i | | d ƒ i ƒ  D]¥ } t | ƒ } t i | | d | d d ƒ }	 | i	 |	 ƒ o t i | d | d ƒ n |	 | | <h | d 6| d 6| |	 f d	 6t
 | | |	 ƒ d
 6d d 6| |	 <qg WxÁ t i | | d ƒ D]ª \ } }
 | d f } | i | ƒ }	 |	 d  j o t i | | d ƒ n | |	 } | d d j o t i | | d ƒ n | i | | | f |
 | d
 ƒ ƒ d | d <q&Wd  } d  }
 t  i |  t ƒ | | f S(   Ns   can not open or readR�  s   ids/i    iÿÿ  s   name or ID is not uniqueR›   R-  RR   Ra   RH  RG  t   shareds   unknown names   already defined(   Rª  R«  RT   R   R¬  RÈ  t   keyst   internR’  R8  Rê  t   getChildrenRj  R  RÜ  R<   (   RÞ  t   readerRI   R›   Rà  Rá  R‰  R�  R-  RR   t
   subsectionRœ  R   (    (    s    scripts/common/items/vehicles.pyR€  �  sD     
 
#c
         C   sb  g  }
 x1t  i |  | | ƒ D]\ } } |  | d | f } | i | ƒ } | d  j o t  i | d d ƒ n | | } | i d j oK | d d j o t  i | | d ƒ n |
 i | | | | | |	 ƒ ƒ q | d d j o t  i | d d ƒ n | i | | | | d	 | |	 ƒ ƒ d
 | d <|
 i | ƒ q W|
 p t  i |  | d ƒ n t |
 ƒ S(   NR[  R×   s   unknown nameR·  RG  s   the component is not sharedRH  s*   the component is already defined somewhereRa   t   locals!   should be at least one subsection(	   R   Rº  Rj  RT   R¬  t   asStringRµ   R  R6  (   Rá  Rà  t   subsectionNameRI   R»  t   localReadert   cachedDescrst	   cachedIDsRÙ  t
   parentItemRÐ   t   snameR¼  Rœ  RR   R   (    (    s    scripts/common/items/vehicles.pyRÉ  Ê  s(     
##
c         C   s�   t  i |  | | ƒ i ƒ  } t ƒ  } t i | ƒ d } xI | D]A } | | j o t  i |  | d | ƒ n | i t | ƒ ƒ q> Wt	 | ƒ S(   NR„   s   unknown tag '%s'(
   R   R–  R\  R  RX   t   getTypeInfoByNameR¬  R  R¹  R˜  (   Rá  Rà  R¿  R›   t   tagNamesRÐ   t   allowedTagNamesR  (    (    s    scripts/common/items/vehicles.pyR”  ð  s    	 c         C   sH   | i  d d ƒ } d | j o
 d j n p t i |  d ƒ n | S(   NR.  i   i
   (   R’  R   t   raiseWrongSection(   Rá  Rà  R.  (    (    s    scripts/common/items/vehicles.pyR“  ÿ  s    c   
   	   C   sú  h t  |  | d ƒ d 6t |  | d ƒ d 6t i |  | d ƒ d 6t i |  | d d ƒ d 6t |  | d t ƒ d 6} t p t o t i	 |  | d ƒ | d <n g  } xE t i
 |  | d	 ƒ i ƒ  D]( } | i t i |  d	 f | d
 ƒ ƒ q¿ W| p t i |  d	 ƒ n t | ƒ | d	 <| i d ƒ p t | d <nG t | d	 ƒ } h t |  | d | ƒ d 6t |  | d | ƒ d 6| d <t oFt |  | d ƒ | d <t |  | d ƒ | d <h t |  | d ƒ d 6t i |  | d ƒ d 6t i |  | d d ƒ d 6t i |  | d d ƒ d 6| d <t i |  | d ƒ } | } | } | d }	 |	 d  j	 o( |	 i d | ƒ } |	 i d  | ƒ } n h | d! 6| d" 6d+ t i |  | d$ d% ƒ d& 6t i |  | d' ƒ i ƒ  d( 6| d) <n t p t o! t |  | d* | d ƒ | d* <n | S(,   NRø   R+   t	   materialsR¯   Rï   i   Rî   t   armorHomogenizationRd  R×   Rº   s   fakeTurrets/lobbyR»   s   fakeTurrets/battlet   battlet   emblemSlotst   modelss   swinging/lodDistt   lodDists   swinging/sensitivityToImpulset   sensitivityToImpulses   swinging/pitchParamsi   t   pitchParamss   swinging/rollParamsi   t
   rollParamst   swingings   exhaust/pixies   exhaust/tagst   dieselt   gasolines   pixie/diesels   pixie/gasolineg        s   exhaust/ratesi   t   ratess   exhaust/nodest   nodesR
  t   primaryArmor(   g        (   t   _readHitTestert
   _readArmorR   R¯  R’  t   _readDeviceHealthParamsRP   R   R
   R®  RÈ  R  Rµ   t   readVector3RÈ  R6  R8  t   _defFakeTurretsRB   t   _readFakeTurretIndicest   _readEmblemSlotst   _readModelsR½  t   readTupleOfFloatsRÀ  RT   R–  R\  R   t   _readPrimaryArmor(
   Rá  Rà  RÐ   Rs   R(  t
   numTurretst   defaultPixiet   dieselPixiet   gasolinePixiet   exhaustTagsSection(    (    s    scripts/common/items/vehicles.pyRÇ  /  sZ     & 
'!R»   RË  c      
   C   s9  h t  |  | d d ƒ d 6t |  | ƒ d 6t i |  | d ƒ d 6t |  | d ƒ d 6t i |  | d ƒ d 6t i |  | d ƒ d 6t t t i |  | d ƒ ƒ ƒ d	 6t	 |  | d
 ƒ d 6t i |  | d ƒ d 6t i |  | d ƒ d 6t
 d 6t t i |  | d ƒ ƒ d 6t i |  | d ƒ d 6} | i d ƒ o# t t i |  | d ƒ ƒ | d <n d  | d <t i |  | d ƒ t t i |  | d ƒ t d ƒ f | d <t i |  | d ƒ d | d <t i |  | d ƒ i ƒ  } d | d j  o | d j o | d j n p t i |  d ƒ n | | d <t p t o' d | d <t i |  | d ƒ | d <n | i t |  | ƒ ƒ t p t p t o˜ | d } t | i | i ƒ } t | i | i ƒ } t | i | i ƒ }	 t | i | i ƒ }
 | | d |	 |
 f |	 |
 d | | f f | d  <n t p t og  } g  } xt i |  | d! ƒ D]ü \ } } | d" j o} |  d# f } t i | | d$ ƒ t i | | d% ƒ t i | | d& d ƒ | i d' d ƒ t i | | d( ƒ f } | i | ƒ qI| d) j oY |  d* f } t i | | d$ ƒ t i | | d+ ƒ t i | | d( ƒ f } | i | ƒ qIqIW| i d, ƒ i  ƒ  } t! | ƒ d j o t i |  d, ƒ n d  } d  } x‡ | D]l \ } } } | | d j o | d- } n | | d j o | d- } n | d  j	 o | d  j	 o Pq˜q˜Wt i" |  d, d. ƒ | | f | d/ <n t i# |  | d0 ƒ } t$ p t o% | | d0 <| i d1 t% ƒ | d2 <n t p t o t& | | ƒ n t o|t' |  | d3 ƒ | d3 <h t( |  | d4 ƒ d5 6t i |  | d6 ƒ d7 6t i |  | d8 ƒ d9 6| d d d: 6t i |  | d; ƒ d< 6| d= <h t( |  | d> ƒ d5 6t i |  | d? ƒ d@ 6t i |  | dA ƒ dB 6t i) |  | dC ƒ dD 6| dE <h t( |  | dF ƒ d5 6| d! <h t( |  | dG ƒ d5 6t* |  | dH ƒ dI 6t* |  | dJ ƒ dK 6| dL <t i |  | dM ƒ | dM <| | d! dN <| | d! d! <n t+ |  | dO | | ƒ | dO <| S(P   NR„   R”   R.  RH  Rø   RI  RQ  t   maxClimbAngleRM  R+   RÉ  R¯   R=  RL  R`  RO  Ra  s%   shotDispersionFactors/vehicleMovements%   shotDispersionFactors/vehicleRotationg      ð?t   shotDispersionFactorsRS  g…ëQ¸ž#@RT  g        i    i   i   RÊ  t   bulkHealthFactorg       @RR  t   wheelst   groups   wheels/groupt   isLeftt   templateRT  t
   startIndext   radiust   wheels   wheels/wheelR-  t   drivingWheelsgš™™™™™@s   unknown wheel name(s)t   drivingWheelsSizesRè   R‘  Rž  RÍ  s   traces/lodDistRÎ  s   traces/bufferPrefst   bufferPrefss   traces/textureSett
   textureSett   centerOffsets   traces/sizet   sizet   tracess   tracks/lodDists   tracks/leftMaterialt   leftMaterials   tracks/rightMaterialt   rightMaterials   tracks/textureScalet   textureScalet   trackss   wheels/lodDists   effects/lodDists   effects/dustRü   s   effects/mudRý   Rû   t   soundR(  R©  (,   R”  R“  R   RÛ  RØ  t   readPositiveVector2R®  R   R   RÙ  t   _DEFAULT_SPECIFIC_FRICTIONR™  R8  RT   R¯  R­  R6  RÈ  R   R
   R  RÚ  R   R   R   Rt  Rr  Rº  RÀ  R’  Rµ   R–  R\  RB   R¬  R—  R   RP   t   _readUserTextRß  R½  t	   readFloatt   _readChassisEffectsRÆ  (   Rá  Rà  Ra   RÙ  RÃ  RÐ   Rs   t   topLeftt
   bottomLeftt   topRightt   bottomRightt   wheelGroupsRê  RÄ  R¼  Rœ  t   drivingWheelNamest   frontWheelSizet   rearWheelSizeRË   t	   wheelNamet   wheelRadius(    (    s    scripts/common/items/vehicles.pyRÊ  ¸  sÈ    "#
&6


"  	
c         C   sE  h t  |  | d d ƒ d 6t |  | ƒ d 6t i |  | d ƒ t d 6t i |  | d ƒ d 6t i |  | d ƒ d 6t i d d d 6} t i |  | d	 ƒ } t	 p t
 o% | | d	 <| i d
 t ƒ | d <n t p t
 o t | | ƒ n t o t i |  | d ƒ | d <n | i t |  | ƒ ƒ t |  | d | | ƒ | d <| S(   NR„   R•   R.  RJ  R¯   t   fireStartingChanceR£  t   minFireStartingDamageRè   R‘  Rž  Rü  R©  (   R”  R“  R   R®  t   HP_TO_WATTSR²  R;   Ri  R—  R   R   R™  RP   R   Rÿ  RÀ  R  RÚ  RÆ  (   Rá  Rà  Ra   RÙ  RÃ  RÐ   Rs   (    (    s    scripts/common/items/vehicles.pyRÍ  g  s$    
c         C   så   h t  |  | d d ƒ d 6t |  | ƒ d 6t i |  | d ƒ d 6} t i |  | d ƒ } t p t o% | | d <| i d t ƒ | d <n t	 p t o t
 | | ƒ n | i t |  | d t ƒ ƒ t |  | d	 | | ƒ | d	 <| S(
   NR„   R•   R.  R¯   Rè   R‘  Rž  R×   R©  (   R”  R“  R   R®  R—  R   R   R™  RP   R   Rÿ  R  RÚ  RÆ  (   Rá  Rà  Ra   RÙ  RÃ  RÐ   Rs   (    (    s    scripts/common/items/vehicles.pyRÏ  œ  s    
c         C   sõ   h t  |  | d d ƒ d 6t |  | ƒ d 6t i |  | d ƒ d 6t i |  | d ƒ d 6} t i |  | d ƒ } t p t o% | | d <| i d t ƒ | d <n t	 p t o t
 | | ƒ n | i t |  | ƒ ƒ t |  | d	 | | ƒ | d	 <| S(
   NR„   R•   R.  R¯   t   distanceRè   R‘  Rž  R©  (   R”  R“  R   R¯  R—  R   R   R™  RP   R   Rÿ  R  RÚ  RÆ  (   Rá  Rà  Ra   RÙ  RÃ  RÐ   Rs   (    (    s    scripts/common/items/vehicles.pyRÑ  Í  s    
c         C   sa  h
 t  |  | d d ƒ d 6t |  | ƒ d 6t |  | d ƒ d 6t i |  | d ƒ d 6t |  | d ƒ d 6t i |  | d ƒ d 6t i |  | d	 d
 ƒ d	 6t t i	 |  | d ƒ ƒ d 6t
 |  | d ƒ d 6t
 |  | d ƒ d 6} t p t oT t i	 |  | d ƒ | d <| i d ƒ o t i |  | d ƒ | d <q<d | d <n t i |  | d ƒ } t p t o% | | d <| i d t ƒ | d <n t p t o. t | | ƒ t |  | d | d ƒ | d <n t o} t |  | d ƒ | d <| i d t ƒ | d <t |  | d ƒ | d <| i d ƒ o' t |  | d t ƒ \ | d <| d <qDn t i |  | d ƒ } | | d <t i |  | d ƒ } | d | d
 j o t i |  d ƒ n | d d j p | d
 d j  o! t | d ƒ t | d
 ƒ f n d  } | | d <t | ƒ d
 } t |  | d  | t t t i  | ƒ t i! | ƒ | | ƒ
 | d  <t" |  | d! | | ƒ | d! <| S("   NR„   R˜   R.  Rø   Re  R+   RÉ  R¯   Rï   i   R`  Rì   Rí   RÊ  Rc  g      ð?Rè   R‘  Rž  R×  RÍ  t   showEmblemsOnGunRÌ  R”  R»  R¼  t   circularVisionRadiust	   yawLimitsi    g     `fÀg     `f@RS   R©  (#   R”  R“  RØ  R   RÛ  RÙ  R¯  R’  R   R®  RÚ  R   R
   R8  R—  R   R   R™  RP   Rÿ  Rá  Rß  RÞ  Rº  t   readVector2RÈ  RT   RŸ   RÉ  R‚  t   _readGunLocalsR;   RS   Rè  RÆ  (   Rá  Rà  Ra   RÙ  RÃ  RÐ   Rs   RI   (    (    s    scripts/common/items/vehicles.pyRÔ  "  s\    
!+
I
	c         C   sš  t  } | d d } | i d ƒ p | d } nŽ t } t i |  | d ƒ } | d | d j o t i |  d ƒ n | d d j p | d d j  o! t | d ƒ t | d ƒ f n d  } | i d ƒ p | d }	 nD t } t |  | d | t	 t
 t i | ƒ t i | ƒ | | d ƒ
 }	 | i d	 ƒ p | d	 }
 n# t } t |  | d	 | | d ƒ }
 | p | S| i ƒ  } | | d <|	 | d <|
 | d	 <| S(
   NRR   i    R  i   g     `fÀg     `f@RS   Ra   R©  (   RP   R8  R<   R   R  RÈ  R   RT   RÉ  R‚  R  R;   RS   Rè  RÆ  t   copy(   Rá  Rà  t   sharedDescrRÙ  RÃ  t   hasOverrideRI   R  Rs   RS   R©  R   (    (    s    scripts/common/items/vehicles.pyRÕ  k  s@    I	


c      
   C   sJ  h t  |  | d d ƒ d 6t |  | ƒ d 6t t i |  | d ƒ ƒ d 6t i |  | d ƒ d 6t i |  | d ƒ d 6t i |  | d ƒ d 6t i |  | d d	 ƒ d 6} t p t o' t i |  | d
 ƒ | d
 <d | d <n t i	 |  | d ƒ } t
 p t o% | | d <| i d t ƒ | d <n t p t o t | | ƒ n t o±| i d ƒ o t |  | d ƒ | d <n d  | d <t i |  | d ƒ } t i i | ƒ } | d  j o t i |  d d | ƒ n | | d <| i d d ƒ }	 |	 d j o d  | d <nE t i i |	 ƒ } | d  j o t i |  d d |	 ƒ n | | d <t i |  | d ƒ | d <h t |  | d ƒ d 6t i |  | d ƒ d 6t i |  | d ƒ d 6t i |  | d ƒ d 6| d <| i d ƒ o' t |  | d t ƒ \ | d  <| d! <qøn | i d" ƒ o t |  | d" ƒ | d" <n d  | d" <| i d# ƒ o t |  | d# ƒ | d$ <n d  | d$ <| i d% ƒ p t i |  d% ƒ n« t i |  | d% ƒ } | d& | d	 j o t i |  d% ƒ n t | d& ƒ t | d	 ƒ f }
 h |
 d' 6|
 d( 6} | i d) ƒ o t |  d) f | d) t ƒ n | | d% <| i  t! |  | ƒ ƒ t i |  | d* ƒ d+ | d, <t" |  | d- ƒ | d- <| i d. ƒ p d= | d. <n t# |  | d. ƒ | d. <| i d0 ƒ p d> | d0 <n t# |  | d0 ƒ | d0 <| d. d& | d0 d& j o
 d	 j n o t i |  d. d1 ƒ n t$ | ƒ d	 } g  } t i% d2 d3 } xI t i& |  | d4 ƒ D]2 \ } } | i' t( |  d5 | f | | | ƒ ƒ qaW| p t i |  d4 d6 ƒ n t o^ | d. d& d	 j oI xF | D]: } | d7 d8 j o# t i |  d5 | d9 d: d; ƒ qØqØWn t) | ƒ | d4 <t* |  | d< | | ƒ | d< <| S(?   NR„   R™   R.  R`  R¯   t
   reloadTimet
   aimingTimeR®  i   t   invisibilityFactorAtShotg      ð?RÊ  Rè   R‘  Rž  RÍ  Rû   s   unknown effect '%s'Rþ   R×   t   impulses   recoil/lodDistRÎ  s   recoil/amplitudet	   amplitudes   recoil/backoffTimet   backoffTimes   recoil/returnTimet
   returnTimet   recoilR”  R»  R¼  Rø   R+   RÉ  t   pitchLimitsi    t   basict   absolutet   extraPitchLimitst   shotDispersionRadiusg      Y@t   shotDispersionAngleRè  t   burstg        R¯  s%   burst/count is larger than clip/countR£  t   projectileSpeedFactorRm   s   shots/s   no shots are specifiedt   maxDistancei�  Rÿ   R-  s1   maxDistance > 400m is not allowed for autocannonsR©  (   i   g        (   i   g        (+   R”  R“  R   R   R®  R’  R   R
   R¯  R—  R   R   R™  RP   Rÿ  R8  Rß  RT   RÀ  R;   Ry  Rj  R¬  R–  R½  Rº  RØ  RÙ  RÈ  R  t   _readGunPitchExtraLimitsR   R  RÚ  t   _readGunShotDispersionFactorst   _readGunClipBurstRŸ   Ri  Rº  Rµ   t	   _readShotR6  RÆ  (   Rá  Rà  Ra   RÙ  R¦   RÐ   Rs   t   effNamet   efft   groundWaveEffNamet   basicLimitst   plimsSecRI   t   projSpeedFactorRÄ  R¼  Rn   (    (    s    scripts/common/items/vehicles.pyR‚  Û  s®    



+

 
. * c         C   sP  t  } | i d ƒ o| t } t i |  | d ƒ } | d | d j o t i |  d ƒ n t | d ƒ t | d ƒ f } h | d 6| d 6} n t | d ƒ } | i d ƒ o$ t } t |  d f | d | ƒ n | i d ƒ p | d }	 n" t } t t i	 |  | d ƒ ƒ }	 | i d ƒ p | d }
 n t } t i	 |  | d ƒ }
 | i d	 ƒ p | d	 } n t } t i	 |  | d	 ƒ } | i d
 ƒ p | d
 } n t } t i
 |  | d
 d ƒ } | i d ƒ p | d } n  t } t i |  | d ƒ d } | i d ƒ p | d } n t } t |  | d ƒ } | i d ƒ p | d } n t } t |  | d ƒ } | i d ƒ p | d } n t } t |  | d ƒ } | d | d j o
 d j n o t i |  d d ƒ n t p t o= | i d ƒ p | d } q+t } t i |  | d ƒ } n t o!| i d ƒ p/ | d } | d  j o t i |  d ƒ q‰n t } t |  | d ƒ } | i d ƒ p | d } nV t } t i |  | d ƒ } t i i | ƒ } | d  j o t i |  d d | ƒ n | i d ƒ p" | i d ƒ } | i d ƒ } qSt } t |  | d t  ƒ \ } } n t o d  } d  } n¯ | i d ƒ p/ | d } | d  j o t i |  d ƒ qÁn t } t |  | d ƒ } | i d ƒ p/ | d } | d  j o t i |  d ƒ qn t } t |  | d ƒ } | i d ƒ p | d } n& t } t |  | d | | d | ƒ } | p | S| i ƒ  } | | d <|	 | d <|
 | d <| | d	 <| | d
 <| | d <| | d <| | d <| | d <| | d <| | d <| | d <t o= | | d <| | d <| d  j	 o | | d <| | d <q/n t p t o | | d <n | S(   NR   i    i   R!  R"  R#  R`  R  R  R®  R$  R%  g      Y@Rè  R&  R¯  s%   burst/count is larger than clip/countR  RÍ  Rû   s   unknown effect '%s'R”  R»  R¼  Rø   R+   RÉ  R©  Ra   (   RP   R8  R<   R   R  RÈ  R   Rˆ  R)  R®  R’  R¯  R*  R+  R¬  R   R
   RT   Rß  RÀ  R;   Ry  Rj  Rº  R   RØ  RÙ  RÆ  R  (   Rá  Rà  R  RÙ  R¦   R  Rs   R0  R   R`  R  R  R¨  t   shotDispAnglet   shotDispFactorsR&  R¯  R  RÍ  Rû   R-  t	   camTilingt   camExclMaskRø   RÉ  R©  R   (    (    s    scripts/common/items/vehicles.pyR  f  sê     &



	














c         C   sW   t  i |  | | d d ƒ } d t  i |  | | d ƒ } | | d j o | n d f S(   Ns   /counti   g      N@s   /rateg        (   R   R’  R®  (   Rá  Rà  Rd   RT  t   interval(    (    s    scripts/common/items/vehicles.pyR+    s    c         C   s+  t  } d } | i d ƒ o¶ t i |  | d ƒ } | d | d j o t i |  d ƒ n t d „  | Dƒ ƒ | d <t | d d | d d ƒ t | d d | d d ƒ f | d <| | d d 7} t } n | i d ƒ o¶ t i |  | d ƒ } | d | d j o t i |  d ƒ n t d	 „  | Dƒ ƒ | d <t | d d | d d ƒ t | d d | d d ƒ f | d <| | d d 7} t } n | i d
 ƒ oA t i	 |  | d
 ƒ } t
 | ƒ | d
 <| | d
 d 7} t } n | t d 7} | t d j o t i |  d |  d d ƒ n | S(   Ng        t   fronti    i   c         s   s   x |  ] } t  | ƒ Vq Wd  S(   N(   R   (   R†  t   ang(    (    s    scripts/common/items/vehicles.pys	   <genexpr>'  s   	 R"  i   t   backc         s   s   x |  ] } t  | ƒ Vq Wd  S(   N(   R   (   R†  R9  (    (    s    scripts/common/items/vehicles.pys	   <genexpr>2  s   	 t
   transitiong      @g       @s   overlapping sectors(   RP   R8  R   RÛ  RÈ  R6  Rn  Rq  R<   R   R   R   R   R¬  (   Rá  Rà  t   descToUpdatet   readSomethingt
   extraAngleRs   (    (    s    scripts/common/items/vehicles.pyR)    s:    &
&

c   
   
   C   sì  t  i |  ƒ } | d  j o t i d  |  d ƒ n h  } t p t o� x� t i d  |  f | d ƒ D]l \ } } t | ƒ } | i	 | ƒ o! t i d  |  d f | d ƒ n t i
 d  |  d f | d ƒ | | <qc Wn h  } h  } xà | i ƒ  D]Ò \ } } | d j o qð n d  |  d | f } t | ƒ } | i	 | ƒ o t i | d d ƒ n t i | | d d	 d
 ƒ }	 | i	 |	 ƒ o t i | d d ƒ n t | | | | |	 | ƒ | |	 <|	 | | <qð Wd  } d  } t  i |  t ƒ | | f S(   Ns   can not open or readt   iconss   /iconss   name is not uniqueR×   R[  s   shell type name is not uniqueRR   i    iÿÿ  s   shell type ID is not unique(   Rª  R«  RT   R   R¬  R   R   Rº  R¹  R8  t   readIconRX   R’  t
   _readShellRÜ  R<   (
   RÞ  RI   Rà  R?  R-  R¼  R‰  R�  Rá  RR   (    (    s    scripts/common/items/vehicles.pyR�  I  s<     !+ c   
      C   sê  h	 d d 6| d 6| | f d 6t  d | | ƒ d 6t i |  | d d ƒ d 6| i d t ƒ d 6t i |  | d	 ƒ t i |  | d
 ƒ f d 6d d 6d d 6} t p t o� t i	 | i
 d ƒ ƒ | d <t i	 | i
 d ƒ ƒ | d <t i |  | d ƒ } | i | ƒ | d <| d d  j o t i |  d d | ƒ q7n t i |  | d ƒ } t p t o% | | d <| i d t ƒ | d <n t t i |  | d ƒ ƒ } | t j o t i |  | d d | ƒ n | | d <| i d ƒ o[ t p t oH t t i |  | d ƒ ƒ | d <t t t i |  | d ƒ ƒ ƒ | d <q�nT | d j oF | i d ƒ | d <| d d j o | d | d d | d <q�n t i |  | d  ƒ }	 t i i |	 ƒ } | d  j o t i |  d  d! |	 ƒ n | | d" <| S(#   NRÿ   R›   R-  RR   Ra   t   caliberi   t   isTracers   damage/armors   damage/devicest   damageg      Ð?t   damageRandomizationt   piercingPowerRandomizationR   R¢  t   icons   unknown icon '%s'Rè   R‘  Rž  R*   s   unknown shell kind '%s't   ARMOR_PIERCINGt   normalizationAnglet   ricochetAnglet   ricochetAngleCost   HIGH_EXPLOSIVEt   explosionRadiusg        g     ³µ@Rû   s   unknown effect '%s'R   (   Rê  R   R’  R™  RP   R®  R   R   R   R•  R–  RÀ  Rj  RT   R¬  R—  R   R¹  t   _shellKindst
   startswithR
   R   R¯  R   R   R;   Rl  (
   Rá  Rà  R-  RI   R¥  R?  RÐ   Rs   R*   R-  (    (    s    scripts/common/items/vehicles.pyRA  ‰  sT    


'"
t   HOLLOW_CHARGERL  RH  t   ARMOR_PIERCING_HEt   ARMOR_PIERCING_CRc         C   sú   | i  } t i | ƒ i | ƒ } | d  j o t i |  d d ƒ n t i | ƒ | } h | d 6| i d ƒ p d n t i	 |  | d ƒ d 6t i
 |  | d ƒ d 6t i |  | d ƒ | d 6t i |  | d ƒ | d	 d 6t i |  | d
 ƒ d
 6} | S(   NR×   s   unknown shell type nameRÿ   R¬  g        t   piercingPowert   speedt   gravityi   R(  (   R-  R;   Ra  Rj  RT   R   R¬  R2  R8  R²  R  R®  R¯  (   Rá  Rà  RI   R'  t	   shellNameR¦  t
   shellDescrRÐ   (    (    s    scripts/common/items/vehicles.pyR,  È  s    	c         C   sE   | i  d ƒ p | S| i ƒ  } t |  | d | | d ƒ | d <| S(   NR©  Ra   (   R8  R  RÆ  (   Rá  Rà  R  RÙ  RÃ  R   (    (    s    scripts/common/items/vehicles.pyRË  Ý  s    c         C   sR   h t  i |  | | d ƒ d 6t  i |  | | d ƒ d 6t  i |  | | d ƒ d 6S(   Ns
   /undamagedt	   undamageds
   /destroyedt	   destroyeds	   /explodedt   exploded(   R   RÀ  (   Rá  Rà  R¿  (    (    s    scripts/common/items/vehicles.pyRß  è  s    c         C   s§   h t  i |  | | d ƒ t d ƒ d 6t  i |  | | d ƒ d 6t  i |  | | d ƒ d 6} | d } | i | ƒ o t  i |  | | ƒ | d	 <n | d | d	 <| S(
   Ns   /turretRotationg      ð?t   turretRotations
   /afterShott	   afterShots   /whileGunDamagedt   whileGunDamageds   /afterShotInBurstt   afterShotInBurst(   R   R¯  R   R8  (   Rá  Rà  R¿  RÐ   R-  (    (    s    scripts/common/items/vehicles.pyR*  ð  s    
c         C   sÇ  h  } t  o | St i d } t i d } t i } t i |  | | ƒ } |  | f }  xj| i ƒ  D]\\ } } | i | ƒ }	 |	 d  j o t i
 |  | d ƒ n | i |	 ƒ }
 |
 d  j o t i
 |  | d ƒ n |
 i ƒ  } t i |  | | ƒ | d <| d d  j	 } |	 | j o d  n | d } |  | f } xE| i ƒ  D]7} | t j o t i | | | ƒ | | <qA| d j o t i | | | ƒ | | <qA| o* | d j o t i | | | ƒ | | <qA| d j oŒ t i | | d ƒ } | d j o
 d } nB | d j o
 d } n+ | d j o
 d  } n t i
 | d d ƒ | d  j	 o | | d <qxqAt i
 | | d ƒ qAW| d  j o& | d o d n d } | | d <n t | �  | |	 <qc W| S(   NRÉ  t   autoDamageKindMaterialss   material kind name is unknowns'   material kind is not useable on vehicleR+   R,   R3   R-   R4   R5   i    RÍ   i   t   autos   wrong damage kind names   unknown parameter(   s   chanceToHitByProjectiles   chanceToHitByExplosion(   R   R;   Ri  t   material_kindst   IDS_BY_NAMESR   RÈ  RX   Rj  RT   R¬  t   _asdictR¯  R¸  t   _g_boolMatInfoParamsR™  R²  R–  R)   (   Rá  Rà  R¿  RÐ   t   defMaterialsR_  t   matKindIDsByNamest   matKindNamet   matKindSectiont   materialKindt
   defMatInfot   valst   isDeviceR3   Rœ  t	   paramNamet   damageKindName(    (    s    scripts/common/items/vehicles.pyRÙ    s\    	  


c   	      C   s  | i  | ƒ p; | i d t ƒ i | i d t ƒ i | i d t ƒ i f S| i | ƒ i ƒ  } t | ƒ d j o t i |  | ƒ n g  } t	 i
 } xa | D]Y } | i | ƒ } | d  j o t i |  | d | ƒ n | i | i | t ƒ i ƒ q� Wt | ƒ S(   Ni   i   i   s   unknown material kind name '%s'(   R8  Rj  t   _defMaterialInfoR+   R–  R\  RB   R   RÈ  Ra  Rb  RT   R¬  Rµ   R6  (	   Rá  Rà  R¿  RÉ  t
   armorNamesRÐ   Rf  Rg  Ri  (    (    s    scripts/common/items/vehicles.pyRá  H  s     	  c         C   s\   t  i |  | | ƒ } x@ | D]8 } d | j o
 | j  n p t  i |  | ƒ q q W| S(   Ni    (   R   t   readTupleOfIntsRÈ  (   Rá  Rà  R¿  Râ  RÐ   Rä   (    (    s    scripts/common/items/vehicles.pyRÝ  `  s     R×   c         C   sn  | o% t  i |  | | ƒ } |  | f }  n h t  i |  | d d ƒ d 6t  i |  | d ƒ d 6t  i |  | d d ƒ d 6} | d | d j o t  i |  d ƒ n t p t o¸ t  i |  | d ƒ | d <t  i |  | d ƒ | d <| i d ƒ p d  n t  i	 |  | d ƒ | d <| oK t  i |  | d	 d ƒ } | | d j o t  i |  d	 ƒ n | | d	 <qjn | S(
   NRï   i   Rð   t   maxRegenHealthi    t   healthRegenPerSecRœ  t   chanceToHitt   hysteresisHealth(
   R   RÈ  R’  R¯  RÈ  R   R
   R8  RT   R²  (   Rá  Rà  R¿  t   withHysteresisRÐ   Ru  (    (    s    scripts/common/items/vehicles.pyRÚ  i  s(    c         C   s�   t  p t o d  St i |  | | ƒ } y) t | ƒ } t o | i ƒ  n | SWn5 t j
 o) } t	 ƒ  t i
 |  | t | ƒ ƒ n Xd  S(   N(   R   R   RT   R   RÈ  R   R   t   loadBspModelRy   Ré  R¬  t   str(   Rá  Rà  R¿  R¼  Rø   Rt  (    (    s    scripts/common/items/vehicles.pyRØ  ˆ  s    c         C   sW   t  i |  | | ƒ } t i d i | ƒ } | d  j o t  i |  | d | ƒ n | S(   Nt	   lodLevelss   unknown lod level '%s'(   R   RÀ  R;   Ri  Rj  RT   R¬  (   Rá  Rà  R¿  R-  t   dist(    (    s    scripts/common/items/vehicles.pyR½  ˜  s
    c         C   sw   t  i } | | i d ƒ ƒ |  d <| | i d ƒ ƒ |  d <| i d ƒ } | o | | ƒ |  d <n |  d |  d <d  S(   NR   R¢  R¡  (   R   R•  R–  (   RÐ   Rà  R•  R(  (    (    s    scripts/common/items/vehicles.pyRÿ     s    	c   
      C   sº  t  i |  | | ƒ } |  | f }  d d k l } g  } h  } xù | i ƒ  D]ë \ } } t | ƒ } | | j o t  i |  | d ƒ n | f } xk | i i ƒ  D]Z }	 t |	 ƒ }	 |	 | j p |	 | d f j o t  i |  | d |	 ƒ n | |	 f } qŸ W| i	 | ƒ x( | D]  } | i
 | d ƒ d | | <qWqJ Wt | ƒ t | ƒ j o6 t  i |  d d	 t t | i | i ƒ  ƒ ƒ ƒ ƒ n | d d j o t  i |  d d
 ƒ n t | ƒ S(   Niÿÿÿÿ(   t   ROLESs   wrong skill namet	   commanders   wrong sub-skill name '%s'i    i   R×   s   missing crew roles: s   more than one commander in crew(   R   RÈ  t   items.tankmenR{  RX   R¹  R¬  R¾  R\  Rµ   Rj  RB   Rx  R6  t
   differenceR¸  (
   Rá  Rà  R¿  R{  RÐ   t   skillCountst	   skillNameR¼  t   skillst   subskillName(    (    s    scripts/common/items/vehicles.pyR³  ­  s8     	   "*c         C   s…   t  i |  | | ƒ } |  | f }  t  i |  | d ƒ } | d j o t  i |  d d ƒ n t  i |  | d ƒ t  i |  | d ƒ | f S(   Nt   volumeFactorg      ð?s&   volumeFactor should be in range (0, 1]R'  t   distanceFactor(   R   RÈ  R®  R¬  R¯  (   Rá  Rà  R¿  Rƒ  (    (    s    scripts/common/items/vehicles.pyRÂ  Õ  s    c         G   s  | d  j p t o g  S| | } | d  j o g  Sg  } xÍ | i ƒ  D]¿ } |  | d | i f } t i | i ƒ } | d  j o t i | d d ƒ n | i }	 |	 p t i | d d ƒ n t i	 | | d d ƒ }
 | i
 t | ƒ ƒ | i
 |
 | |	 f | ƒ qH W| S(   NR[  R×   s   unknown item types   item name is missingRê   i    (   RT   R   R  R-  t   _itemTypeNameMapRj  R   R¬  R¾  R’  Rµ   RB   (   Rá  Rà  R¿  RÙ  t   requiredItemsR(  t   idxsRœ  R›   Rñ  t   xpCost(    (    s    scripts/common/items/vehicles.pyRÆ  ç  s&    
 	Rš   c         C   sÛ   g  } xÎ t  i |  | | ƒ D]· \ } } | d j o t  i |  d | d ƒ n |  d | f } t  i | | d ƒ t  i | | d ƒ t  i | | d ƒ t  i | | d	 ƒ | i d
 t ƒ t | ƒ f } | i | ƒ q W| S(   Nt   playert   clant   inscriptions   emblemSlots/s*   expected 'player', 'clan' or 'inscription't   rayStartt   rayEndt   rayUpRö  t   hideIfDamaged(   R‰  RŠ  R‹  (	   R   Rº  R¬  RÛ  R®  R™  RP   R¹  Rµ   (   Rá  Rà  R¿  R;  RÄ  R¼  Rœ  R   (    (    s    scripts/common/items/vehicles.pyRÞ    s     c         C   sé   g  } xw t  i |  | d ƒ i ƒ  D]Z } | | j o t  i |  d | d ƒ n t  i |  | d | ƒ } | i | | f ƒ q" Wt  i |  | d ƒ } y t i | ƒ } Wn. t j
 o" } t  i |  d t | ƒ ƒ n X| | t	 ƒ  f S(   NR  s   stages/s   duplicated stageRû   (
   R   RÈ  R¸  R¬  R¯  Rµ   R   Ry   Rx  R  (   Rá  Rà  R  RÄ  t   durationR¼  Rû   Rt  (    (    s    scripts/common/items/vehicles.pyt   _readStagesAndEffects!  s      c   
      C   s<  h  } t  i |  ƒ } | d  j o t i d  |  d ƒ n d  |  f } | pL xÍ | i ƒ  D]7 \ } } t | ƒ } | | f } t | | ƒ | | <qY Wn… x� | i ƒ  D]s \ } } t | ƒ } g  | | <xH | i ƒ  D]: \ } }	 | | d | f } | | i t | |	 ƒ ƒ qÔ Wd  }	 q¥ Wd  } d  } t  i	 |  t
 ƒ | S(   Ns   can not open or readR[  (   Rª  R«  RT   R   R¬  RX   R¹  R‘  Rµ   RÜ  R<   (
   RÞ  t   withSubgroupsRÐ   Rà  Rá  RÄ  R¼  Rœ  t   subgroupNamet   subgroupSection(    (    s    scripts/common/items/vehicles.pyRw  6  s0      
 
c         C   sá  h  } t  i |  d ƒ } | d  j o t i d  |  d ƒ n d  |  f } xu| i ƒ  D]g\ } } t | ƒ } | | f } h  } x4| i ƒ  D]&\ } }	 t | ƒ } | d j o$ | t j o t i | | d ƒ nË t i | | f |	 d ƒ i	 ƒ  }
 |
 i
 ƒ  d j o q� n |
 i d ƒ d j oG |
 i d ƒ }
 x5 t d	 t |
 ƒ ƒ D] } |
 | i	 ƒ  |
 | <qLWn | d j o |
 | d <n t i | } |
 | | <| t ƒ  f | | <q� Wd  }	 qV Wd  } d  } t  i |  t ƒ | S(
   Ns
   /particless   can not open or readt   defaults   unknown material kindR×   t   nonet   |iÿÿÿÿi    (   Rª  R«  RT   R   R¬  RX   R¹  R   RÀ  t   stript   lowerR  R\  RA   RB   Ra  t    EFFECT_MATERIAL_INDEXES_BY_NAMESR  RÜ  R<   (   RÞ  RÐ   Rà  Rá  RÄ  R¼  Rœ  Rû   t   matkindNamet   matkindSectiont
   effectNameR  t   effectIndex(    (    s    scripts/common/items/vehicles.pyRz  W  sB      ! 

c   	      C   s
  h  g  f } t  i |  ƒ } | d  j o t i d  |  d ƒ n d  |  f } xœ | i ƒ  D]Ž \ } } t | ƒ } | | f } t | d ƒ } h | d 6} | i t	 | | ƒ ƒ t
 o t ƒ  | d <n | | d | <| d i | ƒ qX Wd  } d  } t  i |  t ƒ | S(   Ns   can not open or readi   t   indexR  i    (   Rª  R«  RT   R   R¬  RX   R¹  RB   R  t   _readShotEffectsR   R  Rµ   RÜ  R<   (	   RÞ  RÐ   Rà  Rá  RÄ  R¼  Rœ  RŸ  R   (    (    s    scripts/common/items/vehicles.pyRk  †  s(     c         C   sñ  h  } h  | d <| i  d ƒ } | p
 d  } n; t i d i | ƒ } | d  j o t i t d d ƒ n | | d d <| i  d ƒ } | p
 d  } n; t i d i | ƒ } | d  j o t i t d d ƒ n | | d d <t ot i	 |  | d ƒ } | i  d	 | ƒ } t i
 |  | d
 ƒ } y t i | ƒ } Wn. t j
 o" } t i |  d
 t | ƒ ƒ n X| | | f | d <t i |  | d ƒ | d <| i d ƒ p d | d <n/ t i |  | d ƒ t i |  | d ƒ f | d <t |  t i
 |  | d ƒ ƒ | d <t |  t i
 |  | d ƒ ƒ | d <t |  t i
 |  | d ƒ ƒ | d <| i d ƒ o& t |  t i
 |  | d ƒ ƒ | d <n | d | d <t d d }	 t |  t i
 |  | |	 ƒ ƒ | |	 <x` t d D]T }
 |
 d 7}
 | i |
 ƒ o& t |  t i
 |  | |
 ƒ ƒ | |
 <qÄ| |	 | |
 <qÄW| i d ƒ o& t |  t i
 |  | d ƒ ƒ | d <n | i d ƒ o& t |  t i
 |  | d ƒ ƒ | d <n | i d ƒ p/ | i d ƒ } | o | n | |	 | d <n | i d ƒ p | d | d <qín | S(   Nt   targetStickerss   targetStickers/armorResistedR�  s   unknown name of stickerR  s   targetStickers/armorHitR  s   projectile/models   projectile/modelOwnShots   projectile/effectsR  t   targetImpulset   waterParamsg       @g      @s   waterParams/shallowWaterDepths   waterParams/rippleDiameterR	  R  i    R  i   R  R  (   g       @g      @(   R–  RT   R;   Rn  Rj  R   R¬  Rœ  R   RÀ  RÈ  R   Ry   Rx  R¯  R8  R®  R‘  R   (   Rá  Rà  RÐ   Rs   t   modelt   modelOwnShotR¼  Rû   Rt  t   defSubEffNamet
   subEffName(    (    s    scripts/common/items/vehicles.pyR   ¥  s|    


 # 
### c         C   sÁ  t  i |  ƒ } | d  j o t i d  |  d ƒ n d  |  f } h  } g  } x?| i ƒ  D]1\ } } t | ƒ } | d j o qX n | i | ƒ o t i | | d ƒ n | | f } h  } t | ƒ }	 |	 | d <t i	 | | d d ƒ | d <t
 o| t i | | d ƒ }
 |
 | d <| d } | d  j o
 d	 }
 n
 | i }
 |
 | d <t i | | d
 ƒ } | i ƒ  | d
 <n |	 | | <| i | ƒ qX Wh | d 6| d 6} d  } d  } t  i |  t ƒ | S(   Ns   can not open or readt   textures   sticker name is not uniqueRR   t   priorityi   t   texNamet   bumpTexNameR×   t
   modelSizesR‰  R�  (   Rª  R«  RT   R   R¬  RX   R¹  R8  RB   R’  R   RÀ  R¾  Rý  R6  Rµ   RÜ  R<   (   RÞ  Rà  Rá  R�  R‰  RÄ  R¼  Rœ  R   t	   stickerIDR-  t   bumpSubsectionRs   RÐ   (    (    s    scripts/common/items/vehicles.pyRm    sF     



	

c   
      C   sv  h  } h t  i |  | d ƒ d 6t  i |  | d ƒ d 6t  i |  | d d ƒ d 6} h t  i |  | d ƒ d	 6| d
 6t  i |  | d ƒ d 6| d <t oè h  } x@ t  i |  | d ƒ i ƒ  D]# } t  i |  | d | ƒ | | <q· W| | d <t  i |  | d ƒ | d d <t  i |  | d ƒ } | d i | ƒ } | d  j o t  i
 |  d d | ƒ n | | d d <t |  | d ƒ | d <n t p t oÊ t |  | d ƒ \ | d <| d <t |  | d | d ƒ \ | d <| d <t |  | d | d ƒ | d <d } h t  i |  | | d ƒ d 6t  i |  | | d ƒ d 6t  i |  | | d ƒ d 6| d d <n/ t o' t |  | d d  ƒ \ | d <| d <n t p t p t o¯ t |  | ƒ | d  <d, t  i |  | d! d" ƒ | d# <h  | d$ <x/ t D]' } t  i |  | d% | ƒ | d$ | <qÜWh  | d& <x3 t D]' }	 t  i |  | d' |	 ƒ | d& |	 <qWn t o$ d- t  i |  | d) d* ƒ | d+ <n | S(.   Ns   miscParams/hornCooldown/windowRp  s-   miscParams/hornCooldown/clientWindowExpansionRq  s"   miscParams/hornCooldown/maxSignalsi   Rr  s    miscParams/projectileSpeedFactorR'  Ro  s    miscParams/minFireStartingDamageR  R£  Ry  s
   lodLevels/s   miscParams/damageStickerAlphat   damageStickerAlphas    miscParams/damageStickersLodDists   unknown lod level '%s'R¤  R¨  R  R/  RÉ  R_  RÏ   s%   miscParams/collisionEffectVelocities/R¼   R¦  R§  R¥  RG  s   balance/byComponentLevelsi
   Rh  RŸ  s   balance/byVehicleClasses/RF  s!   balance/modulesWeightMultipliers/g        s   balance/bySquadSizei   t   balanceBySquadSize(   N(   g        (   R   R¯  R’  R®  R   RÈ  R¸  RÀ  Rj  RT   R¬  R¹  R   t   _readExtrast   _readMaterialst   _readExtrasSetR  R   R   t   _readVehicleModulesWeightsRà  R·  R   t   VEHICLE_MODULE_TAGS(
   Rá  Rà  RÐ   Rv  Rs   t   lodNameR-  t   effectVelPathRâ  t	   moduleTag(    (    s    scripts/common/items/vehicles.pyRs  :  sn     !
 ')' 
 
 #$c         C   s€   h  } | i  d ƒ p | Sx^ t i |  | d ƒ D]G \ } } t i |  | d ƒ } t i | ƒ t i |  | d ƒ | | <q1 W| S(   Ns   balance/byVehicleModuleR×   R¯   (   R8  R   Rº  RÀ  R9   RV   R   (   t
   xmlContextRà  t   weightsR-  t   sectRc   (    (    s    scripts/common/items/vehicles.pyR´  �  s     c         C   sŒ  d d  k  } | i d d d d  ƒ } | g } h | | i 6} xt i |  | | ƒ D]\ } } t | ƒ } |  | d | f }	 | i | ƒ o t i |	 d d ƒ n | i	 i
 d ƒ \ }
 } } t o |
 n | i ƒ  } t | | d  ƒ } | d  j o$ t i |	 d d | | i f ƒ n | | t | ƒ |  d	 | ƒ } | i | ƒ | | | <qS Wt | ƒ d
 j o t i |  | d ƒ n | | f S(   Niÿÿÿÿt
   _NoneExtrai    R×   R[  s   name is not uniqueRç  s   class '%s' is not found in '%s'i   iÈ   s   too many extras(   R7   t	   NoneExtraRT   R-  R   Rº  R¹  R8  R¬  R¾  t	   partitionR   R˜  RÂ   R$   RB   Rµ   (   Rá  Rà  R¿  t   modt	   noneExtraR  R/  t	   extraNamet   extraSectionRœ  t
   clientNamet   sept
   serverNamet	   classNamet   classObjR,   (    (    s    scripts/common/items/vehicles.pyR±  �  s,    	 c         C   s¥  h  } t  ƒ  } x‰t i |  | | ƒ D]r\ } } |  | d | f } t i i | ƒ }	 |	 d  j o t i | d d ƒ n d  }
 | i d ƒ } | oO | d  j	 o | i | ƒ n | }
 |
 d  j o t i | d d | ƒ qæ n |
 d  j } d } | p~ t i | | d ƒ } | d j o
 d } q}| d	 j o
 d
 } q}| d j o d
 } | i	 |	 ƒ q}t i | d d ƒ n t
 d |	 d | o d  n d d |
 d t i | | d ƒ d t i | | d ƒ d t i | | d ƒ d t i | | d ƒ d t i | | d ƒ d t i | | d ƒ d | d | o d n t i | | d ƒ d | o d n t i | | d ƒ d | o t n t i | | d ƒ ƒ | |	 <q% W| | f S(   NR[  R×   s   material kind name is unknownR,   s   unknown extra '%s'i    R3   R+   RÍ   i   R`  s   wrong damage kind nameR*   R-   R.   R/   R0   R1   R2   R4   g      ð?R5   R6   (   R  R   Rº  Ra  Rb  Rj  RT   R¬  R–  R  R)   R²  R™  R<   (   Rá  Rà  R¿  R/  RÉ  R_  t   materialKindNameR¼  Rœ  Ri  R,   RÁ  t   extraIsNoneR3   Rn  (    (    s    scripts/common/items/vehicles.pyR²  Æ  sR    	 #

##.c         C   s}   t  ƒ  } xg t i |  | | ƒ i ƒ  D]J } | i | ƒ } | d  j o t i |  t d | ƒ n | i | ƒ q% Wt	 | ƒ S(   Ns   unknown extra's name '%s'(
   R  R   RÀ  R\  Rj  RT   R¬  t   subsectioNameR  R˜  (   Rá  Rà  R¿  R/  RÐ   R-  R,   (    (    s    scripts/common/items/vehicles.pyR³  þ  s    	 c         C   sŒ  d d  k  } t i |  ƒ } | d  j o t i d  |  d ƒ n d  |  f } h  } h  } x| i ƒ  D]þ \ } } | | f } t | ƒ } | | j o t i | | d ƒ n t i | | d ƒ }	 t	 | |	 d  ƒ }
 |
 d  j o$ t i | d d |	 | i
 f ƒ n |
 ƒ  } | i | | ƒ | i d } | | j o t i | d d ƒ n | | | <| | | <qd Wd  } d  } t i |  t ƒ | | f S(	   Niÿÿÿÿs   can not open or reads   name is not uniquet   scripts   class '%s' is not found in '%s'i   R×   s   id is not unique(   Rg  Rª  R«  RT   R   R¬  RX   R¹  RÀ  RÂ   R$   RK   RR   RÜ  R<   (   RÞ  Rg  Rà  Rá  t	   objsByIDst
   idsByNamesR-  R¼  Rœ  RÆ  RÇ  t   instObjRR   (    (    s    scripts/common/items/vehicles.pyRh    s:     	
c      	   C   sã  t  i |  ƒ } | d  j o t i d  |  d ƒ n d  |  f } h t | | d t ƒ d 6} t o t | | d ƒ | d <n t	 | | d ƒ \ | d <| d <h  } x¦ t i
 | | d ƒ D]� \ } } t | ƒ } | | j o t i | d | d ƒ n h g  d	 6} t p t o* t i | i d
 ƒ ƒ | d
 <t | d <n | | | <q¸ Wh  }	 x[ t i
 | | d ƒ D]D \ }
 } | d |
 f } t | | |	 | | ƒ \ } } | |	 | <qgW| | d <|	 | d <d  } d  } t  i |  t ƒ | S(   Ns   can not open or readR�   t
   armorColorRŽ   t   inscriptionGroupst   camouflageGroupss   camouflages/s#   camouflage group name is not uniqueR�  R   t   hasNewRr   (   Rª  R«  RT   R   R¬  t   _readColorst   NUM_INSCRIPTION_COLORSR   t
   _readColort   _readPlayerInscriptionsRº  R¹  R   R   R•  R–  RP   t   _readCamouflageRÜ  R<   (   RÞ  RI   Rà  Rá  RÐ   RÑ  RD  R¼  t
   groupDescrRr   t   camNameRœ  t   camIDt   camDescr(    (    s    scripts/common/items/vehicles.pyRc  9  sB      
 

c         C   s  t  i |  | d d d ƒ } | | j o t  i |  d d ƒ n t i | i d ƒ ƒ } | d  j o t  i |  d ƒ n t  i |  | d ƒ } | i | ƒ } | d  j o t  i |  d d | ƒ n h | d 6| d 6t  i	 |  | d	 ƒ d	 6t  i	 |  | d
 ƒ d
 6t
 |  | d | ƒ d 6t
 |  | d | ƒ d 6| i d t ƒ d 6}	 t }
 t p t o‡ | i d t ƒ }
 |
 |	 d <t i | i d ƒ ƒ |	 d <t  i |  | d ƒ |	 d <t |  | d d ƒ |	 d <t |  | d | ƒ |	 d <n | d i | ƒ |
 o t | d <n | |	 f S(   NRR   i   iÿÿ  s   camouflage ID is not uniqueR*   Rë  s"   unknown camouflage group name '%s'RD  R'  Rc  Rv   Ru   R‘  Rž  t   isNewR¢  R¨  t   colorsi   t   tilingR�  RÒ  (   R   R’  R¬  t   CAMOUFLAGE_KINDSRj  R–  RT   RÈ  RÀ  R¯  t   _readNationVehiclesByNamesR™  RP   R   R   R   R•  RÓ  t   _readCamouflageTilingsRµ   R<   (   Rá  Rà  R�  R(  RI   RR   R*   RD  RØ  R   RÜ  (    (    s    scripts/common/items/vehicles.pyR×  p  s<    
c         C   sÉ   g  } t  p7 x� t i |  | | ƒ D] \ } } | i d ƒ q# WnN xJ t i |  | | ƒ D]3 \ } } | i t |  | d | f | d ƒ ƒ qZ Wt | ƒ | j o t i |  | d | ƒ n t | ƒ S(   Ni    R[  R×   s"   wrong number of items; required %d(   R   R   Rº  Rµ   RÕ  RB   R¬  R6  (   Rá  Rà  t   sectionNamet   requiredSizeRÐ   RÄ  R¼  (    (    s    scripts/common/items/vehicles.pyRÓ  ›  s      +c         C   sŠ   t  i |  | | d ƒ } xC | D]; } d | j o
 d j  n p t  i t  d d ƒ q q W| d | d d >| d d	 >| d
 d >S(   Ni   i    i   R×   s(   color component is out of range [0, 255]i   i   i   i   i   i   (   R   Rq  R¬  (   Rá  Rà  Râ  t	   rgbaTupleR{   (    (    s    scripts/common/items/vehicles.pyRÕ  ¬  s     c         C   s¯   | p | i  | d ƒ ok t i |  | | d d ƒ } | d d j p | d d j o) | o t i |  | d ƒ q‚ d  } qŒ n d  } t i |  | | d ƒ } | | f S(   Ns   /tilingi   i    i   s   /exclusionMask(   R8  R   Rà  RÈ  RT   RÀ  (   Rá  Rà  Râ  t   tilingRequiredRÞ  t   mask(    (    s    scripts/common/items/vehicles.pyRº  ¼  s    "c   	   	   C   sÇ   | | } | d  j o t ƒ  S| i i ƒ  } | p t ƒ  St i | d } t ƒ  } xc | D][ } y t i | | ƒ d } Wn t	 i
 |  | d | ƒ n X| i t d | | ƒ ƒ q^ Wt | ƒ S(   NRç  i   s   unknown vehicle name '%s'R   (   RT   R˜  R¾  R\  RC   RD   R  R9   RV   R   R¬  R  Rê  (	   Rá  Rà  Râ  RI   t   namesRd  RÐ   R-  t   vehID(    (    s    scripts/common/items/vehicles.pyRà  Ð  s     
	   c   
   
   C   sú   | | } | d  j o h  St i | d } h  } |  | f } x´ | i ƒ  D]¦ } y t i | | ƒ d } Wn t i |  | d | ƒ n Xt i | | | d ƒ }	 |	 d d j p |	 d d j o t i	 | | ƒ n |	 | t
 d | | ƒ <qL W| S(   NRç  i   s   unknown vehicle name '%s'i   i    R   (   RT   RC   RD   R¸  R9   RV   R   R¬  Rà  RÈ  Rê  (
   Rá  Rà  Râ  RI   Rd  RÐ   Rœ  t   vehNameRè  RÞ  (    (    s    scripts/common/items/vehicles.pyRá  è  s"    
   "c   	      C   s  t  i |  ƒ } | d  j o t i d  |  d ƒ n d  |  f } h  } x§| i ƒ  D]™\ } } | | f } t i | | d d d ƒ } | | j o t i | d d ƒ n h t i | | d d ƒ d 6t i | | d ƒ d 6t | | d d	 ƒ d 6} t	 oæ t
 i | i d
 ƒ ƒ | d
 <t t i | | d ƒ ƒ | d <| d d j o d | d <t i | d ƒ n | d d j o2 t i | | d ƒ t i | | d ƒ f | d <n t i | | d ƒ f | d <t i | | d ƒ | d <n | | | <qR Wd  } d  } t  i |  t ƒ | S(   Ns   can not open or readRR   i   iÿ   s   horn ID is not uniqueR&  R  Rƒ   R   R   t   modet   oneshott
   continuoust	   twoSoundst   soundst   sound1t   sound2Rü  t   maxDuration(   Rë  Rì  Rí  (   N(   Rª  R«  RT   R   R¬  RX   R’  R®  R”  R   R   R•  R–  R¹  RÈ  RÀ  R¯  RÜ  R<   (	   RÞ  Rà  Rá  R‰  R-  R¼  Rœ  RR   R   (    (    s    scripts/common/items/vehicles.pyRe     s>     
 c         C   sz  t  i |  ƒ } | d  j o t i d  |  d ƒ n d  |  f } h  } h  } h  } xt i | | d ƒ D]\ } } | | f } | i | ƒ o t i | d d ƒ n t | ƒ }	 | i d t	 ƒ }
 t i
 | | d ƒ } t o | i d ƒ } n d  } g  } xPt i | | d ƒ D]9\ } } | | f } | i | ƒ o t i | d d ƒ n t i | | d	 d
 d ƒ } | i | ƒ o t i | d d ƒ n t o[ t i | i d ƒ ƒ } t i | | d ƒ } | d } | d  j o
 d } q| i } n d  } d } d } | i | ƒ |	 | | | f | | <| d j o | | t | ƒ <qqW| |
 | | f | |	 <qg W| | | f S(   Ns   can not open or readR×   s   emblem group name is not uniqueR‘  R'  R   Rã   s   emblem name is not uniqueRR   i   iÿÿ  s   emblem ID is not uniqueRª  R«  t   emblem(   Rª  R«  RT   R   R¬  Rº  R8  R¹  R™  RP   R®  R   R–  R’  R   R•  RÀ  R¾  Rµ   (   RÞ  Rà  Rá  R(  Rã   Rç  RÄ  R¼  t   groupCtxRD  Rž  R'  t   groupUserStringRV  Rœ  R‹   t   emblemUserStringRª  R®  R«  (    (    s    scripts/common/items/vehicles.pyRf  1  sV      

c         C   s8  t  i |  | | ƒ } |  | f }  h  } h  } xþt  i |  | d ƒ D]ç\ } } |  | f } | i | ƒ o t  i | d d ƒ n t | ƒ } | i d t ƒ }	 t  i | | d ƒ }
 t	 o t
 i | i d ƒ ƒ } n d  } g  } x,t  i | | d ƒ D]\ } } | | f } | d j o t  i | d d ƒ n t  i | | d	 d
 d ƒ } | i | ƒ o t  i | d d ƒ n t	 o[ t
 i | i d ƒ ƒ } t  i | | d ƒ } | d } | d  j o
 d } qí| i } n d  } d } d } | i | ƒ | | | | f | | <qû W| |	 |
 | f | | <qC W| | f S(   NR×   s$   inscription group name is not uniqueR‘  R'  R   RŽ   R‹  s   unknown subsectionRR   i   iÿÿ  s   inscription ID is not uniqueRª  R«  (   R   RÈ  Rº  R8  R¬  R¹  R™  RP   R®  R   R   R•  R–  RT   R’  RÀ  R¾  Rµ   (   Rá  Rà  R¿  R(  t   inscrsRÄ  R¼  Ró  RD  Rž  R'  Rô  t   inscrIDsRœ  t   inscrIDt   inscrUserStringRª  R®  R«  (    (    s    scripts/common/items/vehicles.pyRÖ  p  sL      

c   
      C   sÛ   h  } t  i |  | | ƒ } |  | f }  t i } x¤ t D]œ } | | } | d  j	 oC | i } t i i | ƒ }	 |	 d  j o t  i |  | d ƒ qÉ n3 | d  j	 o | | }	 n t  i |  d d | ƒ |	 | | <q7 W| S(   Ns   missing or wrong effect nameR×   s   subsection '%s' is missing(	   R   RÈ  R;   Rx  t   _vehicleEffectKindNamesRT   R¾  Rj  R¬  (
   Rá  Rà  R¿  t   defaultEffectsRÐ   t   effectsByNamest   effKindR¼  R-  R.  (    (    s    scripts/common/items/vehicles.pyR¹  ©  s"    	 
	t   destructiont	   explosiont   flamingt   collisionVehicles   %sCollisionLights   %sCollisionHeavyc         C   sS   t  i |  | | ƒ } t i i | ƒ } | d  j o t  i |  | d | ƒ n | S(   Ns   unknown effect '%s'(   R   RÀ  R;   R{  Rj  RT   R¬  (   Rá  Rà  R¿  R-  R.  (    (    s    scripts/common/items/vehicles.pyR  Ê  s
    c         C   s`   t  | ƒ } g  } xG | D]? } y | i |  | ƒ Wq t j
 o t d | ƒ q Xq W| S(   Ns   Resource is not found: %s(   R˜  Rµ   Ry   R8  (   R  R#  RÐ   R-  (    (    s    scripts/common/items/vehicles.pyR   Ô  s      c         C   s5   x( |  D]  } | d d | j o | Sq Wt  ‚ d  S(   NRR   i   (   R*  (   t	   descrListRR   R   (    (    s    scripts/common/items/vehicles.pyR²   à  s
     	c         C   s/   x( |  D]  } | d d | j o | Sq Wd  S(   NRR   i   (   RT   (   R  RR   R   (    (    s    scripts/common/items/vehicles.pyR¡   è  s
     	c         C   s0   |  i  g  } | D] } | | d q ~ ƒ d  S(   NRa   (   R  (   Ræ  RÄ   R!  Rt  (    (    s    scripts/common/items/vehicles.pyR×  ð  s    c         C   sU   xN | D]F } | |  j o3 |  i  | ƒ t |  t | i | d ƒ ƒ | ƒ q q Wd  S(   N(    (   R  Rí  R6  Rj  (   t   destSett   rootSetRð  Ra   (    (    s    scripts/common/items/vehicles.pyRí  ù  s
     c         C   s‡   g  } h  } xn |  D]f } | d } | d j o4 | i  | d ƒ } | d | | <| t | ƒ 7} n | i | | d ƒ q Wt | ƒ S(   Ni    R|  t   driveri   t   Health(   s	   commanderR  (   Rj  Rx  Rµ   R6  (   R´  R/  RÐ   t   idxsInRolest   rolet	   idxInRole(    (    s    scripts/common/items/vehicles.pyRµ    s     
c         C   s   |  d |  d |  d S(   NRï   Rr  Rð   (    (   R   (    (    s    scripts/common/items/vehicles.pyRñ     s    c         C   s2   |  d | d | d |  d | d | d f S(   Ni    i   (    (   Rè   t   priceAddt   priceSub(    (    s    scripts/common/items/vehicles.pyRé     s    c         C   s#   t  i d |  | t d | d >Bƒ S(   Ns   <HIi<   i   (   RZ   R[   Rz   (   RR   R}   R~   (    (    s    scripts/common/items/vehicles.pyRÚ   !  s    c         C   s5   t  i d |  ƒ \ } } | | d @d t | d ?f S(   Ns   <HIiÿÿÿ i<   i   (   RZ   R,  Rz   (   R€   RR   t   times(    (    s    scripts/common/items/vehicles.pyR4  '  s    t   tankman(¦   t   collectionsR    t   mathR   R   R   t	   functoolsR   t   typesR   RZ   Rª  t   MathR   R   RC   RX   R   t   debug_utilst	   constantsR
   R   R   R   R   R   R   R   R   Ra  R   t   helpersR   R   t	   web_stubsR˜  R·  Rµ  RØ   t   NUM_EQUIPMENT_SLOTSRß  R#   RÔ  R­  R  RT   R9   R;   R]  Rþ  R°  Rz   R)   RP   Ro  RK   RM   t   objectRQ   R—  R:   R8   Rê  RŸ   RŸ  R¢  R   R+  R§  R©  R«  R­  Rª  R¶  R€  RÉ  R”  R“  RÇ  RÜ  RÊ  RÍ  RÏ  RÑ  RÔ  RÕ  R‚  R  R+  R)  R�  RA  RN  R,  RË  Rß  R*  RÙ  Rd  Rá  RÝ  R<   RÚ  RØ  R½  Rÿ  R³  RÂ  RÆ  R…  RÞ  R‘  Rw  Rz  Rk  R   Rm  Rs  R´  R±  R²  R³  Rh  Rc  R×  RÓ  RÕ  Rº  Rà  Rá  Re  Rf  RÖ  R¹  R6  R!  R-  R  Rú  R  R   R²   R¡   R×  Rí  Rµ  Rñ   Ré   RÚ   R4  RY   R)  R,  R-  R.  R/  R0  R1  t   _TANKMANR7  R3  R6  R7  R2  t   _EMPTY_CAMOUFLAGERw   (    (    (    s    scripts/common/items/vehicles.pyt   <module>   sd  
.

0		žÿ ÿ ÿ ÿ ÿ ˆÿ ÿ ÿ ²r			
	







							A 		0	?J¯51UIp‹	¬		*	@	:				;							(				!	/		^	7	S		)	8		-	7	+						1	?	9_	
									
		
