Compare commits
4 Commits
Author | SHA1 | Date | |
---|---|---|---|
9de07950b8 | |||
766b7b2d95 | |||
c730981865 | |||
d70c3e2c9e |
@ -4,7 +4,7 @@
|
||||
|
||||
__author__ = """Eriks Karls"""
|
||||
__email__ = 'eriks@72.lv'
|
||||
__version__ = '0.21.0.1'
|
||||
__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)
|
||||
|
@ -50,7 +50,7 @@ class Country:
|
||||
|
||||
class Industries:
|
||||
__by_name = {'food': 1, 'weapons': 2, 'house': 4, 'aircraft': 23,
|
||||
'foodRaw': 7, 'weaponRaw': 12, '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,
|
||||
|
@ -1,5 +1,5 @@
|
||||
[bumpversion]
|
||||
current_version = 0.21.0.1
|
||||
current_version = 0.21.0.3
|
||||
commit = True
|
||||
tag = True
|
||||
parse = (?P<major>\d+)\.(?P<minor>\d+)\.(?P<patch>\d+)\.?(?P<dev>\d+)?
|
||||
|
Reference in New Issue
Block a user