|
|
@ -348,7 +348,7 @@ class BaseCitizen(access_points.CitizenAPI):
|
|
|
|
_item_data = dict(kind=kind, quality=item_data.get('quality', 0), amount=item_data.get('amount', 0),
|
|
|
|
_item_data = dict(kind=kind, quality=item_data.get('quality', 0), amount=item_data.get('amount', 0),
|
|
|
|
durability=item_data.get('duration', 0), icon=icon, name=name)
|
|
|
|
durability=item_data.get('duration', 0), icon=icon, name=name)
|
|
|
|
if item_data.get('type') in ('damageBoosters', "aircraftDamageBoosters"):
|
|
|
|
if item_data.get('type') in ('damageBoosters', "aircraftDamageBoosters"):
|
|
|
|
_item_data = {_item_data['durability']: item_data}
|
|
|
|
_item_data = {_item_data['durability']: _item_data}
|
|
|
|
else:
|
|
|
|
else:
|
|
|
|
if item_data.get('type') == 'bomb':
|
|
|
|
if item_data.get('type') == 'bomb':
|
|
|
|
firepower = 0
|
|
|
|
firepower = 0
|
|
|
@ -983,7 +983,7 @@ class CitizenEconomy(CitizenTravel):
|
|
|
|
def check_house_durability(self) -> Dict[int, datetime]:
|
|
|
|
def check_house_durability(self) -> Dict[int, datetime]:
|
|
|
|
ret = {}
|
|
|
|
ret = {}
|
|
|
|
inv = self.get_inventory()
|
|
|
|
inv = self.get_inventory()
|
|
|
|
for house_quality, active_house in inv['active'].get('house', {}).items():
|
|
|
|
for house_quality, active_house in inv['active'].get('House', {}).items():
|
|
|
|
till = utils.good_timedelta(self.now, timedelta(seconds=active_house['time_left']))
|
|
|
|
till = utils.good_timedelta(self.now, timedelta(seconds=active_house['time_left']))
|
|
|
|
ret.update({house_quality: till})
|
|
|
|
ret.update({house_quality: till})
|
|
|
|
return ret
|
|
|
|
return ret
|
|
|
@ -996,10 +996,10 @@ class CitizenEconomy(CitizenTravel):
|
|
|
|
countries = [self.details.citizenship, ]
|
|
|
|
countries = [self.details.citizenship, ]
|
|
|
|
if self.details.current_country != self.details.citizenship:
|
|
|
|
if self.details.current_country != self.details.citizenship:
|
|
|
|
countries.append(self.details.current_country)
|
|
|
|
countries.append(self.details.current_country)
|
|
|
|
offers = [self.get_market_offers("house", q, country)[f"q{q}"] for country in countries]
|
|
|
|
offers = [self.get_market_offers("House", q, country)[f"q{q}"] for country in countries]
|
|
|
|
local_cheapest = sorted(offers, key=lambda o: o.price)[0]
|
|
|
|
local_cheapest = sorted(offers, key=lambda o: o.price)[0]
|
|
|
|
|
|
|
|
|
|
|
|
global_cheapest = self.get_market_offers("house", q)[f"q{q}"]
|
|
|
|
global_cheapest = self.get_market_offers("House", q)[f"q{q}"]
|
|
|
|
if global_cheapest.price + 200 < local_cheapest.price:
|
|
|
|
if global_cheapest.price + 200 < local_cheapest.price:
|
|
|
|
if self.travel_to_country(global_cheapest.country):
|
|
|
|
if self.travel_to_country(global_cheapest.country):
|
|
|
|
buy = self.buy_from_market(global_cheapest.offer_id, 1)
|
|
|
|
buy = self.buy_from_market(global_cheapest.offer_id, 1)
|
|
|
@ -1036,7 +1036,7 @@ class CitizenEconomy(CitizenTravel):
|
|
|
|
r: Dict[str, Any] = self._post_economy_activate_house(quality).json()
|
|
|
|
r: Dict[str, Any] = self._post_economy_activate_house(quality).json()
|
|
|
|
self._update_inventory_data(r)
|
|
|
|
self._update_inventory_data(r)
|
|
|
|
if r.get("status") and not r.get("error"):
|
|
|
|
if r.get("status") and not r.get("error"):
|
|
|
|
house: Dict[str, Union[int, str]] = self.get_inventory()['active']['house'][quality]
|
|
|
|
house: Dict[str, Union[int, str]] = self.get_inventory()['active']['House'][quality]
|
|
|
|
time_left = timedelta(seconds=house["time_left"])
|
|
|
|
time_left = timedelta(seconds=house["time_left"])
|
|
|
|
active_until = utils.good_timedelta(self.now, time_left)
|
|
|
|
active_until = utils.good_timedelta(self.now, time_left)
|
|
|
|
self._report_action(
|
|
|
|
self._report_action(
|
|
|
@ -1167,7 +1167,7 @@ class CitizenEconomy(CitizenTravel):
|
|
|
|
if quality:
|
|
|
|
if quality:
|
|
|
|
offers[f"q{quality}"] = classes.OfferItem()
|
|
|
|
offers[f"q{quality}"] = classes.OfferItem()
|
|
|
|
else:
|
|
|
|
else:
|
|
|
|
max_quality = 1 if product_name in q1_industries else 5 if product_name == 'house' else 7
|
|
|
|
max_quality = 1 if product_name in q1_industries else 5 if product_name.lower() == 'house' else 7
|
|
|
|
for q in range(max_quality):
|
|
|
|
for q in range(max_quality):
|
|
|
|
offers[f"q{q + 1}"] = classes.OfferItem()
|
|
|
|
offers[f"q{q + 1}"] = classes.OfferItem()
|
|
|
|
|
|
|
|
|
|
|
|