³ò
šõÜNc           @   s„   d  Z  d d k l Z d d k l Z d d k l Z d d k l Z d d k	 l
 Z
 d d „ Z d „  Z d	 „  Z d d
 „ Z d S(   sj   
$Rev: 592 $
$LastChangedBy: satoon101 $
$LastChangedDate: 2011-11-22 16:20:03 -0500 (Tue, 22 Nov 2011) $
iÿÿÿÿ(   t	   AddonInfo(   t   AddonInstances(   t   LoadedAddons(   t   AddonManager(   t   ValidAddonsc         C   sB   |  o! t  t |  ƒ i ƒ  } | i Sn t t d „  t Dƒ ƒ ƒ S(   sQ  
    Returns the stored AddonInfo() instance of the named addon from the
    AddonStorage() container class (returns a dictionary of the named addon's
    attributes).

    USAGE:
        from core.addons.shortcuts import get_addon_info

        myAddon = getAddon('example_addon')

        # Print the title of this addon
        es.msg(myAddon.title)

        # Set the title of this addon using the attribute method
        myAddon.title = 'Example Addon'

        # Set the title of this addon using the dictionary method
        myAddon['title'] = 'Example Addon'

        # Set the title of this addon in one line using the attribute method
        getAddon('example_addon').title = 'Example Addon'

        # Set the title of this addon in one line using the dictionary method
        getAddon('example_addon')['title'] = 'Example Addon'
    c         s   s&   x |  ] } | t  | i f Vq Wd  S(   N(   R   t   info(   t   .0t   addon(    (    sY   /home/saberrider/srcds/css/cstrike/addons/eventscripts/gungame51/core/addons/shortcuts.pys	   <genexpr>>   s    (   R   t   strt   lowerR   t   dictt   zipR   (   t   nameR   (    (    sY   /home/saberrider/srcds/css/cstrike/addons/eventscripts/gungame51/core/addons/shortcuts.pyt   get_addon_info   s
    c         C   s   t  i t |  ƒ i ƒ  ƒ S(   sW   
    Returns a string value of the addon type:
        "custom"
        "included"
    (   R   t   get_addon_typeR   R	   (   R   (    (    sY   /home/saberrider/srcds/css/cstrike/addons/eventscripts/gungame51/core/addons/shortcuts.pyR   A   s    c         C   s   t  |  ƒ i ƒ  t i j S(   sp  
    Returns an int (bool) value depending on a GunGame addon's existance.
        0 = False (addon does not exist)
        1 = True (addon does exist)

    NOTE:
        This function only searches for addons that are to be included
        with GunGame 5.1+. It searches for the "addon_name.py" in the
        directories:
            "../<MOD>/addons/eventscripts/gungame51/scripts/included"
            "../<MOD>/addons/eventscripts/gungame51/scripts/custom"

        If the "addon_name.py" of the script does not exist, 0 will be
        returned.

    USAGE:
        from core.addons.shortcuts import addon_exists
    (   R   R	   R   t   all(   R   (    (    sY   /home/saberrider/srcds/css/cstrike/addons/eventscripts/gungame51/core/addons/shortcuts.pyt   addon_existsL   s    c         C   sR   |  d j o; g  } t  D]% } t  | i |  j o | | q q ~ Sn t t  ƒ S(   s2   Returns a list of loaded addons for the given typet   customt   included(   s   customs   included(   R   t
   addon_typet   list(   R   t   _[1]R   (    (    sY   /home/saberrider/srcds/css/cstrike/addons/eventscripts/gungame51/core/addons/shortcuts.pyt   get_loaded_addon_listd   s    *N(   t   __doc__R   R    t   instanceR   t   loadedR   t   managerR   t   validR   t   NoneR   R   R   R   (    (    (    sY   /home/saberrider/srcds/css/cstrike/addons/eventscripts/gungame51/core/addons/shortcuts.pys   <module>   s   )		