Compare commits
No commits in common. "master" and "v0.29.2" have entirely different histories.
@ -4,7 +4,7 @@
|
|||||||
|
|
||||||
__author__ = """Eriks Karls"""
|
__author__ = """Eriks Karls"""
|
||||||
__email__ = "eriks@72.lv"
|
__email__ = "eriks@72.lv"
|
||||||
__version__ = "0.29.2.3"
|
__version__ = "0.29.2"
|
||||||
|
|
||||||
from erepublik.citizen import Citizen
|
from erepublik.citizen import Citizen
|
||||||
|
|
||||||
|
@ -1961,7 +1961,7 @@ class CitizenTasks(CitizenEconomy):
|
|||||||
else:
|
else:
|
||||||
self.reporter.report_action("WORK", json_val=js)
|
self.reporter.report_action("WORK", json_val=js)
|
||||||
else:
|
else:
|
||||||
seconds = 360 - self.now.timestamp() % 360
|
seconds = self.now.timestamp() % 360
|
||||||
self.write_warning(f"I don't have energy to work. Will sleep for {seconds}s")
|
self.write_warning(f"I don't have energy to work. Will sleep for {seconds}s")
|
||||||
self.sleep(seconds)
|
self.sleep(seconds)
|
||||||
self.work()
|
self.work()
|
||||||
@ -2007,7 +2007,7 @@ class CitizenTasks(CitizenEconomy):
|
|||||||
self.buy_food(120)
|
self.buy_food(120)
|
||||||
self.reporter.report_action("WORK_OT", r.json())
|
self.reporter.report_action("WORK_OT", r.json())
|
||||||
elif self.energy.food_fights < 1 and self.ot_points >= 24:
|
elif self.energy.food_fights < 1 and self.ot_points >= 24:
|
||||||
seconds = 360 - self.now.timestamp() % 360
|
seconds = self.now.timestamp() % 360
|
||||||
self.write_warning(f"I don't have energy to work OT. Will sleep for {seconds}s")
|
self.write_warning(f"I don't have energy to work OT. Will sleep for {seconds}s")
|
||||||
self.sleep(seconds)
|
self.sleep(seconds)
|
||||||
self.work_ot()
|
self.work_ot()
|
||||||
@ -2349,7 +2349,7 @@ class _Citizen(
|
|||||||
self.update_citizen_info()
|
self.update_citizen_info()
|
||||||
self.update_companies()
|
self.update_companies()
|
||||||
wam_holdings: List[classes.Holding] = [
|
wam_holdings: List[classes.Holding] = [
|
||||||
holding for holding in self.my_companies.get_wam_holdings() if holding.wam_count
|
holding for holding in self.my_companies.holdings.values() if holding.wam_count
|
||||||
]
|
]
|
||||||
|
|
||||||
# Check for current region
|
# Check for current region
|
||||||
@ -2361,9 +2361,10 @@ class _Citizen(
|
|||||||
holding for holding in wam_holdings if not holding.region == self.details.current_region
|
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:
|
for holding in wam_holdings:
|
||||||
# Don't travel if not enough energy (either work in all holding factories or 2h energy worth)
|
# Don't travel if not enough energy
|
||||||
if self.energy.energy < 2 * self.energy.interval * 10 < holding.wam_count * 10:
|
if self.energy.energy < 2 * self.energy.interval * 10 < holding.wam_count:
|
||||||
break
|
break
|
||||||
raw_usage = holding.get_wam_raw_usage()
|
raw_usage = holding.get_wam_raw_usage()
|
||||||
free_storage = self.inventory.total - self.inventory.used
|
free_storage = self.inventory.total - self.inventory.used
|
||||||
@ -2375,6 +2376,9 @@ class _Citizen(
|
|||||||
self.update_companies()
|
self.update_companies()
|
||||||
|
|
||||||
wam_count = self.my_companies.get_total_wam_count()
|
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()
|
self.travel_to_residence()
|
||||||
return bool(wam_count)
|
return bool(wam_count)
|
||||||
|
|
||||||
|
@ -411,12 +411,6 @@ class MyCompanies:
|
|||||||
def companies(self) -> Generator[Company, None, None]:
|
def companies(self) -> Generator[Company, None, None]:
|
||||||
return (c for c in self._companies)
|
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):
|
def __str__(self):
|
||||||
return f"MyCompanies: {sum(1 for _ in self.companies)} companies in {len(self.holdings)} holdings"
|
return f"MyCompanies: {sum(1 for _ in self.companies)} companies in {len(self.holdings)} holdings"
|
||||||
|
|
||||||
|
@ -1,16 +1,16 @@
|
|||||||
-r requirements.txt
|
-r requirements.txt
|
||||||
-r requirements-tests.txt
|
-r requirements-tests.txt
|
||||||
bump2version==1.0.1
|
bump2version==1.0.1
|
||||||
coverage==6.3.2
|
coverage==6.3
|
||||||
edx-sphinx-theme==3.0.0
|
edx-sphinx-theme==3.0.0
|
||||||
flake8==4.0.1
|
flake8==4.0.1
|
||||||
ipython>=8.1.1
|
ipython>=8.0.1
|
||||||
jedi!=0.18.0
|
jedi!=0.18.0
|
||||||
isort==5.10.1
|
isort==5.10.1
|
||||||
pre-commit==2.17.0
|
pre-commit==2.17.0
|
||||||
pur==6.0.1
|
pur==6.0.1
|
||||||
responses==0.18.0
|
responses==0.17.0
|
||||||
Sphinx==4.4.0
|
Sphinx==4.4.0
|
||||||
twine==3.8.0
|
twine==3.7.1
|
||||||
wheel==0.37.1
|
wheel==0.37.1
|
||||||
black==22.1.0
|
black==22.1.0
|
||||||
|
@ -1,2 +1,2 @@
|
|||||||
-r requirements.txt
|
-r requirements.txt
|
||||||
pytest==7.0.1
|
pytest==6.2.5
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
[bumpversion]
|
[bumpversion]
|
||||||
current_version = 0.29.2.3
|
current_version = 0.29.2
|
||||||
commit = True
|
commit = True
|
||||||
tag = True
|
tag = True
|
||||||
parse = (?P<major>\d+)\.(?P<minor>\d+)\.(?P<patch>\d+)\.?(?P<dev>\d+)?
|
parse = (?P<major>\d+)\.(?P<minor>\d+)\.(?P<patch>\d+)\.?(?P<dev>\d+)?
|
||||||
|
2
setup.py
2
setup.py
@ -49,6 +49,6 @@ setup(
|
|||||||
test_suite="tests",
|
test_suite="tests",
|
||||||
tests_require=test_requirements,
|
tests_require=test_requirements,
|
||||||
url="https://github.com/eeriks/erepublik/",
|
url="https://github.com/eeriks/erepublik/",
|
||||||
version="0.29.2.3",
|
version="0.29.2",
|
||||||
zip_safe=False,
|
zip_safe=False,
|
||||||
)
|
)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user