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 indent_style = tab
[*.py] [*.py]
max_line_length = 240 max_line_length = 120
line_length=120 line_length=120
multi_line_output=0 multi_line_output=0
balanced_wrapping=True balanced_wrapping=True

View File

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

View File

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

View File

@ -1,5 +1,5 @@
[bumpversion] [bumpversion]
current_version = 0.29.1 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+)?
@ -19,8 +19,8 @@ universal = 1
[flake8] [flake8]
exclude = docs,.git,log,debug,venv exclude = docs,.git,log,debug,venv
line_length = 140 line_length = 120
max-line-length = 140 max-line-length = 120
ignore = D100,D101,D102,D103,E203 ignore = D100,D101,D102,D103,E203
[pycodestyle] [pycodestyle]
@ -38,4 +38,4 @@ warn_unused_configs = True
[isort] [isort]
multi_line_output = 2 multi_line_output = 2
line_length = 140 line_length = 120

View File

@ -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.1", version="0.29.2",
zip_safe=False, zip_safe=False,
) )