1.1.0 #352
@ -60,13 +60,20 @@ class AchievementService:
|
||||
self._operators = {
|
||||
"==": lambda value, expected_value: value == expected_value,
|
||||
"!=": lambda value, expected_value: value != expected_value,
|
||||
"<=": lambda value, expected_value: value <= expected_value,
|
||||
">=": lambda value, expected_value: value >= expected_value,
|
||||
"<": lambda value, expected_value: value < expected_value,
|
||||
">": lambda value, expected_value: value > expected_value,
|
||||
"<=": lambda value, expected_value: self._num(value) <= self._num(expected_value),
|
||||
">=": lambda value, expected_value: self._num(value) >= self._num(expected_value),
|
||||
"<": lambda value, expected_value: self._num(value) < self._num(expected_value),
|
||||
">": lambda value, expected_value: self._num(value) > self._num(expected_value),
|
||||
"contains": lambda value, expected_value: expected_value in value,
|
||||
}
|
||||
|
||||
@staticmethod
|
||||
def _num(s: str):
|
||||
try:
|
||||
return int(s)
|
||||
except ValueError:
|
||||
return float(s)
|
||||
|
||||
def add_achievement_attribute(self, atr: AchievementAttribute):
|
||||
self._attributes.add(atr)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user