Compare commits
14 Commits
v0.20.3.10
...
v0.21.0.3
Author | SHA1 | Date | |
---|---|---|---|
9de07950b8 | |||
766b7b2d95 | |||
c730981865 | |||
d70c3e2c9e | |||
d044af6d2f | |||
dd75b10d2f | |||
a45dd7e0c3 | |||
316a826c93 | |||
c9710733e2 | |||
9e678d6b51 | |||
88517cb076 | |||
01c8aef012 | |||
d7ac66bd69 | |||
e8739caca1 |
@ -4,7 +4,7 @@
|
||||
|
||||
__author__ = """Eriks Karls"""
|
||||
__email__ = 'eriks@72.lv'
|
||||
__version__ = '0.20.3.10'
|
||||
__version__ = '0.21.0.3'
|
||||
|
||||
from erepublik import classes, utils, constants
|
||||
from erepublik.citizen import Citizen
|
||||
|
@ -161,14 +161,14 @@ class ErepublikArticleAPI(CitizenBaseAPI):
|
||||
def _get_main_article_json(self, article_id: int) -> Response:
|
||||
return self.get("{}/main/articleJson/{}".format(self.url, article_id))
|
||||
|
||||
def _post_main_article_comments(self, article: int, page: int = 1) -> Response:
|
||||
data = dict(_token=self.token, articleId=article, page=page)
|
||||
def _post_main_article_comments(self, article_id: int, page: int = 1) -> Response:
|
||||
data = dict(_token=self.token, articleId=article_id, page=page)
|
||||
if page:
|
||||
data.update({'page': page})
|
||||
return self.post("{}/main/articleComments".format(self.url), data=data)
|
||||
|
||||
def _post_main_article_comments_create(self, message: str, article: int, parent: int = 0) -> Response:
|
||||
data = dict(_token=self.token, message=message, articleId=article)
|
||||
def _post_main_article_comments_create(self, message: str, article_id: int, parent: int = 0) -> Response:
|
||||
data = dict(_token=self.token, message=message, articleId=article_id)
|
||||
if parent:
|
||||
data.update({"parentId": parent})
|
||||
return self.post("{}/main/articleComments/create".format(self.url), data=data)
|
||||
@ -177,9 +177,9 @@ class ErepublikArticleAPI(CitizenBaseAPI):
|
||||
data = dict(_token=self.token, articleId=article_id, amount=amount)
|
||||
return self.post("{}/main/donate-article".format(self.url), data=data)
|
||||
|
||||
def _post_main_write_article(self, title: str, content: str, country: int, kind: int) -> Response:
|
||||
data = dict(_token=self.token, article_name=title, article_body=content, article_location=country,
|
||||
article_category=kind)
|
||||
def _post_main_write_article(self, title: str, content: str, country_id: int, kind_id: int) -> Response:
|
||||
data = dict(_token=self.token, article_name=title, article_body=content, article_location=country_id,
|
||||
article_category=kind_id)
|
||||
return self.post("{}/main/write-article".format(self.url), data=data)
|
||||
|
||||
def _post_main_vote_article(self, article_id: int) -> Response:
|
||||
@ -188,12 +188,12 @@ class ErepublikArticleAPI(CitizenBaseAPI):
|
||||
|
||||
|
||||
class ErepublikCompanyAPI(CitizenBaseAPI):
|
||||
def _post_economy_assign_to_holding(self, factory: int, holding: int) -> Response:
|
||||
data = dict(_token=self.token, factoryId=factory, action="assign", holdingCompanyId=holding)
|
||||
def _post_economy_assign_to_holding(self, factory_id: int, holding_id: int) -> Response:
|
||||
data = dict(_token=self.token, factoryId=factory_id, action="assign", holdingCompanyId=holding_id)
|
||||
return self.post("{}/economy/assign-to-holding".format(self.url), data=data)
|
||||
|
||||
def _post_economy_create_company(self, industry: int, building_type: int = 1) -> Response:
|
||||
data = {"_token": self.token, "company[industry_id]": industry, "company[building_type]": building_type}
|
||||
def _post_economy_create_company(self, industry_id: int, building_type: int = 1) -> Response:
|
||||
data = {"_token": self.token, "company[industry_id]": industry_id, "company[building_type]": building_type}
|
||||
return self.post("{}/economy/create-company".format(self.url), data=data,
|
||||
headers={"Referer": "{}/economy/create-company".format(self.url)})
|
||||
|
||||
|
@ -855,11 +855,7 @@ class CitizenCompanies(BaseCitizen):
|
||||
|
||||
Storage={1000: 1, 2000: 2} <- Building_type 2
|
||||
"""
|
||||
company_name = {1: "Food", 2: "Weapons", 4: "House", 23: "Aircraft",
|
||||
7: "FRM q1", 8: "FRM q2", 9: "FRM q3", 10: "FRM q4", 11: "FRM q5",
|
||||
12: "WRM q1", 13: "WRM q2", 14: "WRM q3", 15: "WRM q4", 16: "WRM q5",
|
||||
18: "HRM q1", 19: "HRM q2", 20: "HRM q3", 21: "HRM q4", 22: "HRM q5",
|
||||
24: "ARM q1", 25: "ARM q2", 26: "ARM q3", 27: "ARM q4", 28: "ARM q5", }[industry_id]
|
||||
company_name = constants.INDUSTRIES[industry_id]
|
||||
if building_type == 2:
|
||||
company_name = "Storage"
|
||||
self.write_log(f'{company_name} created!')
|
||||
@ -1260,8 +1256,8 @@ class CitizenMedia(BaseCitizen):
|
||||
4: "Political debates and analysis", 5: "Financial business",
|
||||
6: "Social interactions and entertainment"}
|
||||
if kind in kinds:
|
||||
data = {'title': title, 'content': content, 'country': self.details.citizenship, 'kind': kind}
|
||||
resp = self._post_main_write_article(**data)
|
||||
data = {'title': title, 'content': content, 'country': self.details.citizenship.id, 'kind': kind}
|
||||
resp = self._post_main_write_article(title, content, self.details.citizenship.id, kind)
|
||||
try:
|
||||
article_id = int(resp.history[1].url.split("/")[-3])
|
||||
self._report_action("ARTICLE_PUBLISH", f"Published new article \"{title}\" ({article_id})", kwargs=data)
|
||||
@ -1757,7 +1753,7 @@ class CitizenMilitary(CitizenTravel):
|
||||
if not rang or elite is None:
|
||||
r = self._get_main_citizen_profile_json(self.details.citizen_id).json()
|
||||
if not rang:
|
||||
rang = r['military']['militaryData']['air']['rankNumber']
|
||||
rang = r['military']['militaryData']['aircraft']['rankNumber']
|
||||
if elite is None:
|
||||
elite = r['citizenAttributes']['level'] > 100
|
||||
|
||||
|
@ -19,6 +19,9 @@ class Country:
|
||||
self.link = link
|
||||
self.iso = iso
|
||||
|
||||
def __hash__(self):
|
||||
return hash((self.id, self.name))
|
||||
|
||||
def __repr__(self):
|
||||
return f"Country({self.id}, '{self.name}', '{self.link}', '{self.iso}')"
|
||||
|
||||
@ -47,7 +50,7 @@ class Country:
|
||||
|
||||
class Industries:
|
||||
__by_name = {'food': 1, 'weapons': 2, 'house': 4, 'aircraft': 23,
|
||||
'foodRaw': 7, 'weaponsRaw': 12, 'houseRaw': 18, 'aircraftRaw': 24,
|
||||
'foodraw': 7, 'weaponraw': 12, 'weaponsraw': 12, 'houseraw': 18, 'aircraftraw': 24,
|
||||
'frm': 7, 'wrm': 12, 'hrm': 18, 'arm': 24,
|
||||
'frm q1': 7, 'frm q2': 8, 'frm q3': 9, 'frm q4': 10, 'frm q5': 11,
|
||||
'wrm q1': 12, 'wrm q2': 13, 'wrm q3': 14, 'wrm q4': 15, 'wrm q5': 16,
|
||||
@ -110,7 +113,7 @@ COUNTRIES: Dict[int, Country] = {
|
||||
44: Country(44, 'Greece', 'Greece', 'GRC'), 45: Country(45, 'Japan', 'Japan', 'JPN'),
|
||||
47: Country(47, 'South Korea', 'South-Korea', 'KOR'), 48: Country(48, 'India', 'India', 'IND'),
|
||||
49: Country(49, 'Indonesia', 'Indonesia', 'IDN'), 50: Country(50, 'Australia', 'Australia', 'AUS'),
|
||||
51: Country(51, 'South Africa', 'South Africa', 'ZAF'),
|
||||
51: Country(51, 'South Africa', 'South-Africa', 'ZAF'),
|
||||
52: Country(52, 'Republic of Moldova', 'Republic-of-Moldova', 'MDA'),
|
||||
53: Country(53, 'Portugal', 'Portugal', 'PRT'), 54: Country(54, 'Ireland', 'Ireland', 'IRL'),
|
||||
55: Country(55, 'Denmark', 'Denmark', 'DNK'), 56: Country(56, 'Iran', 'Iran', 'IRN'),
|
||||
|
@ -184,7 +184,7 @@ def send_email(name: str, content: List[Any], player=None, local_vars: Mapping[A
|
||||
from erepublik import Citizen
|
||||
|
||||
file_content_template = "<html><head><title>{title}</title></head><body>{body}</body></html>"
|
||||
if isinstance(player, Citizen):
|
||||
if isinstance(player, Citizen) and player.r:
|
||||
resp = write_request(player.r, is_error=True)
|
||||
else:
|
||||
resp = {"name": "None.html", "mimetype": "text/html",
|
||||
|
@ -1,5 +1,5 @@
|
||||
[bumpversion]
|
||||
current_version = 0.20.3.10
|
||||
current_version = 0.21.0.3
|
||||
commit = True
|
||||
tag = True
|
||||
parse = (?P<major>\d+)\.(?P<minor>\d+)\.(?P<patch>\d+)\.?(?P<dev>\d+)?
|
||||
|
4
setup.py
4
setup.py
@ -11,7 +11,7 @@ with open('README.rst') as readme_file:
|
||||
with open('HISTORY.rst') as history_file:
|
||||
history = history_file.read()
|
||||
|
||||
requirements = ['pytz==2020.1', 'requests==2.23.0']
|
||||
requirements = ['pytz==2020.1', 'requests==2.24.0']
|
||||
|
||||
setup_requirements = []
|
||||
|
||||
@ -43,6 +43,6 @@ setup(
|
||||
test_suite='tests',
|
||||
tests_require=test_requirements,
|
||||
url='https://github.com/eeriks/erepublik/',
|
||||
version='0.20.3.10',
|
||||
version='0.21.0.3',
|
||||
zip_safe=False,
|
||||
)
|
||||
|
Reference in New Issue
Block a user