Compare commits
7 Commits
Author | SHA1 | Date | |
---|---|---|---|
72b12a5ca2 | |||
1831ddfb49 | |||
f9d2ad85c2 | |||
66a05bb202 | |||
273e98c8d1 | |||
03c435bf7e | |||
112150cce6 |
@ -4,7 +4,7 @@
|
||||
|
||||
__author__ = """Eriks Karls"""
|
||||
__email__ = "eriks@72.lv"
|
||||
__version__ = "0.29.2"
|
||||
__version__ = "0.29.2.3"
|
||||
|
||||
from erepublik.citizen import Citizen
|
||||
|
||||
|
@ -1961,7 +1961,7 @@ class CitizenTasks(CitizenEconomy):
|
||||
else:
|
||||
self.reporter.report_action("WORK", json_val=js)
|
||||
else:
|
||||
seconds = self.now.timestamp() % 360
|
||||
seconds = 360 - self.now.timestamp() % 360
|
||||
self.write_warning(f"I don't have energy to work. Will sleep for {seconds}s")
|
||||
self.sleep(seconds)
|
||||
self.work()
|
||||
@ -2007,7 +2007,7 @@ class CitizenTasks(CitizenEconomy):
|
||||
self.buy_food(120)
|
||||
self.reporter.report_action("WORK_OT", r.json())
|
||||
elif self.energy.food_fights < 1 and self.ot_points >= 24:
|
||||
seconds = self.now.timestamp() % 360
|
||||
seconds = 360 - self.now.timestamp() % 360
|
||||
self.write_warning(f"I don't have energy to work OT. Will sleep for {seconds}s")
|
||||
self.sleep(seconds)
|
||||
self.work_ot()
|
||||
@ -2349,7 +2349,7 @@ class _Citizen(
|
||||
self.update_citizen_info()
|
||||
self.update_companies()
|
||||
wam_holdings: List[classes.Holding] = [
|
||||
holding for holding in self.my_companies.holdings.values() if holding.wam_count
|
||||
holding for holding in self.my_companies.get_wam_holdings() if holding.wam_count
|
||||
]
|
||||
|
||||
# Check for current region
|
||||
@ -2361,10 +2361,9 @@ class _Citizen(
|
||||
holding for holding in wam_holdings if not holding.region == self.details.current_region
|
||||
]
|
||||
|
||||
wam_holdings.sort(key=lambda h: -len(h.get_wam_companies(False)))
|
||||
for holding in wam_holdings:
|
||||
# Don't travel if not enough energy
|
||||
if self.energy.energy < 2 * self.energy.interval * 10 < holding.wam_count:
|
||||
# Don't travel if not enough energy (either work in all holding factories or 2h energy worth)
|
||||
if self.energy.energy < 2 * self.energy.interval * 10 < holding.wam_count * 10:
|
||||
break
|
||||
raw_usage = holding.get_wam_raw_usage()
|
||||
free_storage = self.inventory.total - self.inventory.used
|
||||
@ -2376,9 +2375,6 @@ class _Citizen(
|
||||
self.update_companies()
|
||||
|
||||
wam_count = self.my_companies.get_total_wam_count()
|
||||
# if wam_count:
|
||||
# self.logger.debug(f"Wam ff lockdown is now {wam_count}, was {self.my_companies.ff_lockdown}")
|
||||
# self.my_companies.ff_lockdown = wam_count
|
||||
self.travel_to_residence()
|
||||
return bool(wam_count)
|
||||
|
||||
|
@ -411,6 +411,12 @@ class MyCompanies:
|
||||
def companies(self) -> Generator[Company, None, None]:
|
||||
return (c for c in self._companies)
|
||||
|
||||
def get_wam_holdings(self) -> Generator[Holding, None, None]:
|
||||
for holding in sorted(
|
||||
self.holdings.values(), key=lambda h: (-len(h.get_wam_companies(False)), -len(h.get_wam_companies()))
|
||||
):
|
||||
yield holding
|
||||
|
||||
def __str__(self):
|
||||
return f"MyCompanies: {sum(1 for _ in self.companies)} companies in {len(self.holdings)} holdings"
|
||||
|
||||
|
@ -1,16 +1,16 @@
|
||||
-r requirements.txt
|
||||
-r requirements-tests.txt
|
||||
bump2version==1.0.1
|
||||
coverage==6.3
|
||||
coverage==6.3.2
|
||||
edx-sphinx-theme==3.0.0
|
||||
flake8==4.0.1
|
||||
ipython>=8.0.1
|
||||
ipython>=8.1.1
|
||||
jedi!=0.18.0
|
||||
isort==5.10.1
|
||||
pre-commit==2.17.0
|
||||
pur==6.0.1
|
||||
responses==0.17.0
|
||||
responses==0.18.0
|
||||
Sphinx==4.4.0
|
||||
twine==3.7.1
|
||||
twine==3.8.0
|
||||
wheel==0.37.1
|
||||
black==22.1.0
|
||||
|
@ -1,2 +1,2 @@
|
||||
-r requirements.txt
|
||||
pytest==6.2.5
|
||||
pytest==7.0.1
|
||||
|
@ -1,5 +1,5 @@
|
||||
[bumpversion]
|
||||
current_version = 0.29.2
|
||||
current_version = 0.29.2.3
|
||||
commit = True
|
||||
tag = True
|
||||
parse = (?P<major>\d+)\.(?P<minor>\d+)\.(?P<patch>\d+)\.?(?P<dev>\d+)?
|
||||
|
Loading…
x
Reference in New Issue
Block a user