def isConditionOk(self, condition): getter = game_vars.getItemStateGetter(condition.getBaseState()) if getter: varID = condition.getID() value = self._tutorial.getVars().get(varID, default=varID) try: result = getter(value) except Exception as e: LOG_ERROR('Can not resolve condition', varID, e.message) return False if condition.isPositiveState(): return result return not result LOG_ERROR('State of item can not be resolved', condition) return False
def isConditionOk(self, condition): getter = game_vars.getItemStateGetter(condition.getBaseState()) if getter: varID = condition.getID() value = self._tutorial.getVars().get(varID, default=varID) try: result = getter(value) except Exception as e: LOG_ERROR('Can not resolve condition', varID, e.message) return False if condition.isPositiveState(): return result else: return not result else: LOG_ERROR('State of item can not be resolved', condition) return False