Compare commits

..

3 Commits

Author SHA1 Message Date
eb9231b0e7 Bump version: 0.29.1 → 0.29.2 2022-03-06 16:36:49 +02:00
763fbaaf9c Update wam logic 2022-03-06 16:36:35 +02:00
e9f3441678 style setting update 2022-03-06 16:35:49 +02:00
5 changed files with 23 additions and 16 deletions

View File

@ -21,7 +21,7 @@ insert_final_newline = false
indent_style = tab
[*.py]
max_line_length = 240
max_line_length = 120
line_length=120
multi_line_output=0
balanced_wrapping=True

View File

@ -4,7 +4,7 @@
__author__ = """Eriks Karls"""
__email__ = "eriks@72.lv"
__version__ = "0.29.1"
__version__ = "0.29.2"
from erepublik.citizen import Citizen

View File

@ -2340,7 +2340,7 @@ class _Citizen(
def work_as_manager(self) -> bool:
"""Does Work as Manager in all holdings with wam. If employees assigned - work them also
:return: if has more wam work to do
:return: if there is more wam work to do
:rtype: bool
"""
if self.restricted_ip:
@ -2348,17 +2348,24 @@ class _Citizen(
return False
self.update_citizen_info()
self.update_companies()
regions: Dict[int, classes.Holding] = {}
for holding in self.my_companies.holdings.values():
if holding.wam_count:
regions.update({holding.region: holding})
wam_holdings: List[classes.Holding] = [
holding for holding in self.my_companies.holdings.values() if holding.wam_count
]
# Check for current region
if self.details.current_region in regions:
self._wam(regions.pop(self.details.current_region))
self.update_companies()
for holding in wam_holdings:
if holding.region == self.details.current_region:
self._wam(holding)
self.update_companies()
wam_holdings: List[classes.Holding] = [
holding for holding in wam_holdings if not holding.region == self.details.current_region
]
for holding in regions.values():
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:
break
raw_usage = holding.get_wam_raw_usage()
free_storage = self.inventory.total - self.inventory.used
if (raw_usage["frm"] + raw_usage["wrm"]) * 100 > free_storage:

View File

@ -1,5 +1,5 @@
[bumpversion]
current_version = 0.29.1
current_version = 0.29.2
commit = True
tag = True
parse = (?P<major>\d+)\.(?P<minor>\d+)\.(?P<patch>\d+)\.?(?P<dev>\d+)?
@ -19,8 +19,8 @@ universal = 1
[flake8]
exclude = docs,.git,log,debug,venv
line_length = 140
max-line-length = 140
line_length = 120
max-line-length = 120
ignore = D100,D101,D102,D103,E203
[pycodestyle]
@ -38,4 +38,4 @@ warn_unused_configs = True
[isort]
multi_line_output = 2
line_length = 140
line_length = 120

View File

@ -49,6 +49,6 @@ setup(
test_suite="tests",
tests_require=test_requirements,
url="https://github.com/eeriks/erepublik/",
version="0.29.1",
version="0.29.2",
zip_safe=False,
)