From fa3881bf100c7bac597ba55f0afcb2f61e6aefec Mon Sep 17 00:00:00 2001 From: Eriks K Date: Wed, 2 Dec 2020 18:40:33 +0200 Subject: [PATCH] Updated classes.OfferItem default price to be higher considerably higher than max price for cheapest most expensive items on sale (Q5 houses), Updated house renewal --- erepublik/citizen.py | 9 +++++---- erepublik/classes.py | 2 +- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/erepublik/citizen.py b/erepublik/citizen.py index b8677f3..90ae9e9 100644 --- a/erepublik/citizen.py +++ b/erepublik/citizen.py @@ -1026,7 +1026,6 @@ class CitizenEconomy(CitizenTravel): ret.update({house_quality: till}) return ret - @utils.wait_for_lock def buy_and_activate_house(self, q: int) -> Optional[Dict[int, datetime]]: original_region = self.details.current_country, self.details.current_region ok_to_activate = False @@ -1041,12 +1040,14 @@ class CitizenEconomy(CitizenTravel): global_cheapest = self.get_market_offers("House", q)[f"q{q}"] if global_cheapest.price + 200 < local_cheapest.price: if self.travel_to_country(global_cheapest.country): - buy = self.buy_from_market(global_cheapest.offer_id, 1) + buy = self.buy_market_offer(global_cheapest, 1) else: buy = {'error': True, 'message': 'Unable to travel!'} else: - buy = self.buy_from_market(local_cheapest.offer_id, 1) - if buy["error"]: + buy = self.buy_market_offer(local_cheapest, 1) + if buy is None: + pass + elif buy["error"]: msg = f"Unable to buy q{q} house! \n{buy['message']}" self.write_log(msg) else: diff --git a/erepublik/classes.py b/erepublik/classes.py index e38943a..b35c7fd 100644 --- a/erepublik/classes.py +++ b/erepublik/classes.py @@ -1016,7 +1016,7 @@ class TelegramBot: class OfferItem(NamedTuple): - price: float = 99_999. + price: float = 999_999_999. country: constants.Country = constants.Country(0, "", "", "") amount: int = 0 offer_id: int = 0