From ad24338f4d85573b08e5abd09ffb53f76d16c7a9 Mon Sep 17 00:00:00 2001 From: Eriks K Date: Tue, 29 Sep 2020 17:38:26 +0300 Subject: [PATCH] wheeloffortune bugfix --- erepublik/citizen.py | 9 ++++----- erepublik/classes.py | 23 ++++++++++++----------- 2 files changed, 16 insertions(+), 16 deletions(-) diff --git a/erepublik/citizen.py b/erepublik/citizen.py index 5efccb3..b8df5c3 100644 --- a/erepublik/citizen.py +++ b/erepublik/citizen.py @@ -683,9 +683,8 @@ class CitizenAnniversary(BaseCitizen): _write_spin_data(current_cost, r.get('account'), base.get('prizes').get('prizes').get(str(r.get('result'))).get('tooltip')) else: - is_cost: Callable[[], bool] = lambda: (max_cost != current_cost if max_cost else True) - is_count: Callable[[], bool] = lambda: (spin_count != current_count if spin_count else True) - while is_cost() or is_count(): + while max_cost >= current_cost if max_cost else spin_count >= current_count if spin_count else False: + return r = self._spin_wheel_of_loosing(current_cost) current_count += 1 current_cost = r.get('cost') @@ -694,8 +693,8 @@ class CitizenAnniversary(BaseCitizen): def _spin_wheel_of_loosing(self, current_cost: int) -> Dict[str, Any]: r = self._post_main_wheel_of_fortune_spin(current_cost).json() - self.details.cc = r.get('account') - return r.get('result') + self.details.cc = float(Decimal(r.get('account'))) + return r class CitizenTravel(BaseCitizen): diff --git a/erepublik/classes.py b/erepublik/classes.py index 6f33bb0..d89c295 100644 --- a/erepublik/classes.py +++ b/erepublik/classes.py @@ -451,24 +451,25 @@ class Energy: class Details: - xp = 0 - cc = 0 - pp = 0 - pin = None - gold = 0 + xp: int = 0 + cc: float = 0 + pp: int = 0 + pin: str = None + gold: float = 0 next_pp: List[int] = None - citizen_id = 0 + citizen_id: int = 0 citizenship: constants.Country - current_region = 0 + current_region: int = 0 current_country: constants.Country - residence_region = 0 + residence_region: int = 0 residence_country: constants.Country - daily_task_done = False - daily_task_reward = False - mayhem_skills = {1: 0, 2: 0, 3: 0, 4: 0, 5: 0, 6: 0, 7: 0, 8: 0, 9: 0, 10: 0, 11: 0, 12: 0, 13: 0, 14: 0, } + daily_task_done: bool = False + daily_task_reward: bool = False + mayhem_skills: Dict[int, int] def __init__(self): self.next_pp = [] + self.mayhem_skills = {1: 0, 2: 0, 3: 0, 4: 0, 5: 0, 6: 0, 7: 0, 8: 0, 9: 0, 10: 0, 11: 0, 12: 0, 13: 0, 14: 0} @property def xp_till_level_up(self):