@@ -84,21 +84,33 @@ def __init__(self):
8484 self ._tags .update (self [name ].tags )
8585
8686 def __getitem__ (self , item ):
87- """Return the WeaponClass instance for the given weapon."""
88- # Format the weapon's name
89- name = self ._format_name (item )
87+ """Return the :class:`weapons.instance.WeaponClass` for the weapon.
9088
91- # Return the weapon's instance
92- return self .get (name , None )
89+ :param str item: The weapon to retrieve the instance of.
90+ :rtype: WeaponClass
91+ """
92+ name = self ._format_name (item )
93+ return super ().__getitem__ (name )
9394
9495 def __contains__ (self , item ):
95- """Format the given name."""
96- # Format the weapon's name
97- name = self ._format_name (item )
96+ """Return whether the weapon is in the manager.
9897
99- # Return whether the weapon is in the dictionary
98+ :param str item: The weapon to retrieve the instance of.
99+ :rtype: WeaponClass
100+ """
101+ name = self ._format_name (item )
100102 return super ().__contains__ (name )
101103
104+ def get (self , item , default = None ):
105+ """Return the :class:`weapons.instance.WeaponClass` for the weapon.
106+
107+ :param str item: The weapon to retrieve the instance of.
108+ :param default: The value to return if the item is not found.
109+ :rtype: WeaponClass
110+ """
111+ name = self ._format_name (item )
112+ return super ().get (name , default )
113+
102114 def _format_name (self , item ):
103115 """Format the name to include the game's weapon prefix."""
104116 # Set the weapon to lower-case
0 commit comments