MCPcopy Create free account
hub / github.com/pyfa-org/Pyfa / __generateHandler

Method __generateHandler

eos/gamedata.py:168–211  ·  view source on GitHub ↗

Grab the handler, type and runTime from the effect code if it exists, if it doesn't, set dummy values and add a dummy handler

(self)

Source from the content-addressed store, hash-verified

166 return self.type is not None and type in self.type
167
168 def __generateHandler(self):
169 """
170 Grab the handler, type and runTime from the effect code if it exists,
171 if it doesn't, set dummy values and add a dummy handler
172 """
173 try:
174 effectDefName = "Effect{}".format(self.ID)
175 pyfalog.debug("Loading {0} ({1})".format(self.name, effectDefName))
176 self.__effectDef = effectDef = getattr(eos.effects, effectDefName)
177 self.__handler = getattr(effectDef, "handler", eos.effects.BaseEffect.handler)
178 self.__runTime = getattr(effectDef, "runTime", "normal")
179 self.__activeByDefault = getattr(effectDef, "activeByDefault", True)
180 self.__dealsDamage = effectDef.dealsDamage
181 effectType = getattr(effectDef, "type", None)
182 effectType = effectType if isinstance(effectType, tuple) or effectType is None else (effectType,)
183 self.__type = effectType
184 except ImportError as e:
185 # Effect probably doesn't exist, so create a dummy effect and flag it with a warning.
186 self.__handler = eos.effects.DummyEffect.handler
187 self.__runTime = "normal"
188 self.__activeByDefault = True
189 self.__dealsDamage = False
190 self.__type = None
191 pyfalog.debug("ImportError generating handler: {0}", e)
192 except AttributeError as e:
193 # Effect probably exists but there is an issue with it. Turn it into a dummy effect so we can continue, but flag it with an error.
194 self.__handler = eos.effects.DummyEffect.handler
195 self.__runTime = "normal"
196 self.__activeByDefault = True
197 self.__dealsDamage = False
198 self.__type = None
199 pyfalog.error("AttributeError generating handler: {0}", e)
200 except (KeyboardInterrupt, SystemExit):
201 raise
202 except Exception as e:
203 self.__handler = eos.effects.DummyEffect.handler
204 self.__runTime = "normal"
205 self.__activeByDefault = True
206 self.__dealsDamage = False
207 self.__type = None
208 pyfalog.critical("Exception generating handler:")
209 pyfalog.critical(e)
210
211 self.__generated = True
212
213 def getattr(self, key):
214 if not self.__generated:

Callers 8

handlerMethod · 0.95
runTimeMethod · 0.95
activeByDefaultMethod · 0.95
typeMethod · 0.95
isImplementedMethod · 0.95
dealsDamageMethod · 0.95
isTypeMethod · 0.95
getattrMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected